Skip to content

Commit da74a20

Browse files
committed
Merge branch 'master'
2 parents 47c2011 + 80a2a02 commit da74a20

56 files changed

Lines changed: 1740 additions & 127 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

source/cpp_src/Applications/fringex4.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ int main(int argc, char** argv)
636636

637637
// --- A-file header ---
638638
MHO_AFileInfoExtractor extractor;
639-
*out << extractor.GetAlistHeader(alist_version, 2, '*');
639+
*out << extractor.GetAlistHeader(alist_version, 2, '*', "fringex4");
640640

641641
// --- Current time for procdate ---
642642
std::string procdate_vex = hops_clock::to_vex_format(hops_clock::now(), true);

source/cpp_src/Applications/test/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ if(BASH_PROGRAM)
3030
chk_pythonpcphases
3131
chk_simplefringex4
3232
chk_simplefringex4_v6
33+
chk_adhoc_phase_fringex4
34+
chk_adhoc_phase_fringex4_part2
35+
chk_adhoc_phase_poly
36+
chk_adhoc_phase_sinewave
3337
)
3438
endif(PY_EXE)
3539

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/bash
2+
verb=false
3+
[ -n "$testverb" ] && verb=true
4+
5+
[ -d "$srcdir" ] || { echo srcdir not set; exit 1; }
6+
${HOPS_SETUP-'false'} || . $srcdir/chk_env.sh
7+
8+
9+
if [ ! -d "$srcdir/3764" ]; then
10+
echo "Directory $srcdir/3764 does not exist, will not apply this test"
11+
exit 127
12+
fi
13+
14+
export DATADIR=`cd $srcdir/3764; pwd`
15+
RET_VAL=0
16+
EXP_DIR=$DATADIR
17+
D2M4_EXP_NUM=.
18+
MK4_SCAN_DIR=104-1228
19+
SCAN_DIR=104-1228a
20+
cd $EXP_DIR
21+
22+
export HOPS_PLOT_DATA_MASK=0x83FFFFFF
23+
24+
echo "Running: fourfit4 -m 4 -c ./test2.cf -b AS -P RR ./${SCAN_DIR}/"
25+
output_file=$(time fourfit4 -m 4 -c ./test2.cf -b AS -P RR ./${SCAN_DIR}/ 2>&1 | awk '{print $NF}')
26+
echo "fourfit4 output file: $output_file"
27+
28+
#basic procedure to generate adhoc_phase file for consumption by fourfit3 (note: 3!)
29+
#fringex4 -i 1 -v 6 ./104-1228a/AS.Aa-Sw.X.RR.2GAB6T.1.frng -O ./out.alist
30+
#adhoc-baseline.pl -a ./out.alist -b AS
31+
#in general case, call:
32+
#print_adhoc_lines.pl
33+
#to generate control file lines,
34+
#then tweak the new control file (test_adhoc_phase.cf) to point to the adhoc files:
35+
#fourfit -c ./test_adhoc_phase.cf -P RR -b AS -pt ./104-1228/
36+
37+
#just for this test, we also have the silly step of reversing the channel labels
38+
#in the control file test...because the control files in this
39+
#directory are also testing the freq <-> channel labelling feature
40+
41+
#call fringex4 with 1 second bins on the new fringe file to generate an alist file
42+
echo "fringex4 -i 1 -v 6 ${output_file} -O ./out.alist"
43+
fringex4 -i 1 -v 6 ${output_file} -O ./out.alist
44+
45+
#generate the adhoc phase files for stations A & S with Vincent's perl script
46+
echo "adhoc-baseline.pl -o adhoc_phase_test -a ./out.alist -b AS"
47+
adhoc-baseline.pl -o adhoc_phase_test -a ./out.alist -b AS
48+
49+
#generate the control file lines
50+
echo "print_adhoc_lines.pl -b adhoc_phase_test -s AS"
51+
print_adhoc_lines.pl -b adhoc_phase_test -s AS | tee ./adhoc_lines.txt
52+
53+
#do in-place sed replacement of the channel ordering labels
54+
#This is not normal procedure! But rather due to the peculiarities of this test directory
55+
#and how test2.cf was put together
56+
sed -i 's/abcdefghijklmnopqrstuvwxyzABCDEF/FEDCBAzyxwvutsrqponmlkjihgfedcba/g' adhoc_lines.txt
57+
58+
#concatenate test2.cf and adhoc_lines.txt into test_adhoc.cf
59+
cat test2.cf adhoc_lines.txt > test_adhoc.cf
60+
61+
#now run fourfit3 with the adhoc file
62+
echo "Running: fourfit3 -m 4 -c ./test_adhoc.cf -b AS -P RR ./${MK4_SCAN_DIR} set plot_data_dir ./chk_adhoc "
63+
time fourfit3 -m 1 -c ./test_adhoc.cf -b AS -P RR ./${MK4_SCAN_DIR} set plot_data_dir ./chk_adhoc 2>&1 | tee ./ff.out
64+
65+
#grab the SNR value
66+
SNR=$(grep "fourfit: SNR" ./ff.out | awk '{print $NF}')
67+
result=$(echo "($SNR > 120) && ($SNR < 125)" | bc)
68+
echo "The SNR of the adhoc'd fringe = $SNR"
69+
echo "Result ok (121 < SNR < 125)? $result" # prints 1 if true, 0 if false
70+
71+
#invert the logic for the return code (0 is normal, 1 is fail)
72+
if [ "$result" -eq 1 ]; then
73+
exit 0
74+
else
75+
exit 1
76+
fi
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash
2+
verb=false
3+
[ -n "$testverb" ] && verb=true
4+
5+
[ -d "$srcdir" ] || { echo srcdir not set; exit 1; }
6+
${HOPS_SETUP-'false'} || . $srcdir/chk_env.sh
7+
8+
9+
if [ ! -d "$srcdir/3764" ]; then
10+
echo "Directory $srcdir/3764 does not exist, will not apply this test"
11+
exit 127
12+
fi
13+
14+
export DATADIR=`cd $srcdir/3764; pwd`
15+
RET_VAL=0
16+
EXP_DIR=$DATADIR
17+
D2M4_EXP_NUM=.
18+
MK4_SCAN_DIR=104-1228
19+
SCAN_DIR=104-1228a
20+
cd $EXP_DIR
21+
22+
export HOPS_PLOT_DATA_MASK=0x83FFFFFF
23+
24+
echo "Running: fourfit4 -m 4 -c ./test2.cf -b AS -P RR ./${SCAN_DIR}/"
25+
output_file=$(time fourfit4 -m 4 -c ./test2.cf -b AS -P RR ./${SCAN_DIR} 2>&1 | awk '{print $NF}')
26+
echo "fourfit4 output file: $output_file"
27+
28+
#basic procedure to generate adhoc_phase file for consumption by fourfit3 (note: 3!)
29+
#fringex4 -i 1 -v 6 ./104-1228a/AS.Aa-Sw.X.RR.2GAB6T.1.frng -O ./out.alist
30+
#adhoc-baseline.pl -a ./out.alist -b AS
31+
#in general case, call:
32+
#print_adhoc_lines.pl
33+
#to generate control file lines,
34+
#then tweak the new control file (test_adhoc_phase.cf) to point to the adhoc files:
35+
#fourfit -c ./test_adhoc_phase.cf -P RR -b AS -pt ./104-1228/
36+
37+
#also, just for this test, we also have the silly step of reversing the channel labels
38+
#in the control file test...because the control files in this
39+
#directory are also testing the freq <-> channel labelling feature (which flipped the nominal order)
40+
41+
#call fringex4 with 1 second bins on the new fringe file to generate an alist file
42+
echo "fringex4 -i 1 -v 6 ${output_file} -O ./out.alist"
43+
fringex4 -i 1 -v 6 ${output_file} -O ./out.alist
44+
45+
#generate the adhoc phase files for stations A & S with Vincent's perl script
46+
echo "adhoc-baseline.pl -o adhoc_phase_test -a ./out.alist -b AS"
47+
adhoc-baseline.pl -o adhoc_phase_test -a ./out.alist -b AS
48+
49+
#generate the control file lines
50+
echo "print_adhoc_lines.pl -b adhoc_phase_test -s AS"
51+
print_adhoc_lines.pl -b adhoc_phase_test -s AS | tee ./adhoc_lines.txt
52+
53+
#do in-place sed replacement of the channel ordering labels
54+
#This is not normal procedure! But rather due to the peculiarities of this test directory
55+
#and how test2.cf was put together
56+
sed -i 's/abcdefghijklmnopqrstuvwxyzABCDEF/FEDCBAzyxwvutsrqponmlkjihgfedcba/g' adhoc_lines.txt
57+
58+
#concatenate test2.cf and adhoc_lines.txt into test_adhoc.cf
59+
cat test2.cf adhoc_lines.txt > test_adhoc.cf
60+
61+
#now run fourfit3 with the adhoc file
62+
echo "Running: fourfit3 -m 4 -c ./test_adhoc.cf -b AS -P RR ./${MK4_SCAN_DIR} set plot_data_dir ./chk_adhoc "
63+
time fourfit3 -m 1 -c ./test_adhoc.cf -b AS -P RR ./${MK4_SCAN_DIR} set plot_data_dir ./chk_adhoc 2>&1 | tee ./ff.out
64+
65+
#grab the SNR value
66+
SNR=$(grep "fourfit3: SNR" ./ff.out | awk '{print $NF}')
67+
result=$(echo "($SNR > 120) && ($SNR < 125)" | bc)
68+
echo "The SNR of the fourfit3 adhoc'd fringe = $SNR"
69+
echo "fourfit3 result ok (121 < SNR < 125)? $result" # prints 1 if true, 0 if false
70+
71+
#now run fourfit4 with the adhoc file
72+
echo "Running: fourfit4 -m 4 -c ./test_adhoc.cf -b AS -P RR ./${SCAN_DIR}"
73+
output_file2=$(fourfit4 -m 4 -c ./test_adhoc.cf -b AS -P RR ./${SCAN_DIR} 2>&1 | awk '{print $NF}')
74+
echo "fourfit4 output file: $output_file2"
75+
76+
#convert the fringe file to json
77+
hops2json ${output_file2}
78+
79+
#use jq (json query) to extract the plot_data element and pipe to file
80+
echo "jq '.[].tags.plot_data | select( . != null )' "${output_file2}.json" > tee ./fdump_adhoc.json"
81+
jq '.[].tags.plot_data | select( . != null )' "${output_file2}.json" > ./fdump_adhoc.json
82+
83+
#now compare the results between fourfit3 and fourfit4, tolerance 0.5%
84+
compjsonpdd.py -r 0.003 ./fdump_adhoc.json ./chk_adhoc/104-1228-AS-B-RR.*
85+
RET_VAL=$?
86+
87+
exit $RET_VAL
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
verb=false
3+
[ -n "$testverb" ] && verb=true
4+
5+
[ -d "$srcdir" ] || { echo srcdir not set; exit 1; }
6+
${HOPS_SETUP-'false'} || . $srcdir/chk_env.sh
7+
8+
if [ ! -d "$srcdir/3764" ]; then
9+
echo "Directory $srcdir/3764 does not exist, will not apply this test"
10+
exit 127
11+
fi
12+
13+
export DATADIR=`cd $srcdir/3764; pwd`
14+
RET_VAL=0
15+
EXP_DIR=$DATADIR
16+
D2M4_EXP_NUM=.
17+
MK4_SCAN_DIR=104-1228
18+
SCAN_DIR=104-1228a
19+
cd $EXP_DIR
20+
21+
export HOPS_PLOT_DATA_MASK=0x83FFFFFF
22+
23+
SET_STRING="adhoc_phase polynomial adhoc_poly 10.0 0.0 0.0 adhoc_tref 500."
24+
25+
echo "Running: fourfit4 -m 4 -c ./test2.cf -b AS -P RR ./${SCAN_DIR}/ set ${SET_STRING}"
26+
output_file=$(time fourfit4 -m 4 -c ./test2.cf -b AS -P RR ./${SCAN_DIR} set ${SET_STRING} 2>&1 | awk '{print $NF}')
27+
echo "fourfit4 output file: $output_file"
28+
29+
#now run fourfit3 with the adhoc file
30+
echo "Running: fourfit3 -m 4 -c ./test2.cf -b AS -P RR ./${MK4_SCAN_DIR} set ${SET_STRING} plot_data_dir ./chk_adhoc_poly"
31+
time fourfit3 -m 4 -c ./test2.cf -b AS -P RR ./${MK4_SCAN_DIR} set ${SET_STRING} plot_data_dir ./chk_adhoc_poly 2>&1 | tee ./ff.out
32+
33+
#convert the fringe file to json
34+
hops2json ${output_file}
35+
36+
#use jq (json query) to extract the plot_data element and pipe to file
37+
echo "jq '.[].tags.plot_data | select( . != null )' "${output_file}.json" > tee ./fdump_adhoc.json"
38+
jq '.[].tags.plot_data | select( . != null )' "${output_file}.json" > ./fdump_adhoc.json
39+
40+
#now compare the results between fourfit3 and fourfit4, tolerance 0.5%
41+
compjsonpdd.py -r 0.003 ./fdump_adhoc.json ./chk_adhoc_poly/104-1228-AS-B-RR.*
42+
RET_VAL=$?
43+
44+
exit $RET_VAL
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
verb=false
3+
[ -n "$testverb" ] && verb=true
4+
5+
[ -d "$srcdir" ] || { echo srcdir not set; exit 1; }
6+
${HOPS_SETUP-'false'} || . $srcdir/chk_env.sh
7+
8+
if [ ! -d "$srcdir/3764" ]; then
9+
echo "Directory $srcdir/3764 does not exist, will not apply this test"
10+
exit 127
11+
fi
12+
13+
export DATADIR=`cd $srcdir/3764; pwd`
14+
RET_VAL=0
15+
EXP_DIR=$DATADIR
16+
D2M4_EXP_NUM=.
17+
MK4_SCAN_DIR=104-1228
18+
SCAN_DIR=104-1228a
19+
cd $EXP_DIR
20+
21+
export HOPS_PLOT_DATA_MASK=0x83FFFFFF
22+
23+
SET_STRING="adhoc_phase sinewave adhoc_amp 120.0 adhoc_period 5. adhoc_tref 1200."
24+
25+
echo "Running: fourfit4 -m 4 -c ./test2.cf -b AS -P RR ./${SCAN_DIR}/ set ${SET_STRING}"
26+
output_file=$(time fourfit4 -m 4 -c ./test2.cf -b AS -P RR ./${SCAN_DIR} set ${SET_STRING} 2>&1 | awk '{print $NF}')
27+
echo "fourfit4 output file: $output_file"
28+
29+
#now run fourfit3 with the adhoc file
30+
echo "Running: fourfit3 -m 4 -c ./test2.cf -b AS -P RR ./${MK4_SCAN_DIR} set ${SET_STRING} plot_data_dir ./chk_adhoc_sine"
31+
time fourfit3 -m 4 -c ./test2.cf -b AS -P RR ./${MK4_SCAN_DIR} set ${SET_STRING} plot_data_dir ./chk_adhoc_sine 2>&1 | tee ./ff.out
32+
33+
#convert the fringe file to json
34+
hops2json ${output_file}
35+
36+
#use jq (json query) to extract the plot_data element and pipe to file
37+
echo "jq '.[].tags.plot_data | select( . != null )' "${output_file}.json" > tee ./fdump_adhoc.json"
38+
jq '.[].tags.plot_data | select( . != null )' "${output_file}.json" > ./fdump_adhoc.json
39+
40+
#now compare the results between fourfit3 and fourfit4, tolerance 1.1%
41+
compjsonpdd.py -r 0.011 ./fdump_adhoc.json ./chk_adhoc_sine/104-1228-AS-B-RR.*
42+
RET_VAL=$?
43+
44+
exit $RET_VAL

source/cpp_src/Applications/test/chk_simplefringesearch.sh

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,8 @@ if [ ! -d "./${D2H_EXP_NUM}" ]; then
2222
fi
2323

2424
echo "Running: fourfit4 -m 4 -c ./cf_test4 -b GE -P XX ./${D2H_EXP_NUM}/${HOPS4_DIR}/"
25-
outfile=$(fourfit4 -m 4 -c ./cf_test4 -b GE -P XX ./${D2H_EXP_NUM}/${HOPS4_DIR}/ 2>&1)
26-
27-
#parse the print out (fourfit4: <fringe_filename>) into just the fringe_filename
28-
echo "$outfile"
29-
old_IFS=$IFS
30-
IFS=" "
31-
set -- $outfile
32-
IFS=$old_IFS
33-
cmdname=$1
34-
output_file=$2
35-
echo "output file: $output_file"
25+
output_file=$(fourfit4 -m 4 -c ./cf_test4 -b GE -P XX ./${D2H_EXP_NUM}/${HOPS4_DIR}/ 2>&1 | awk '{print $NF}')
26+
echo "fourfit4 output file: $output_file"
3627

3728
#convert the fringe file to json
3829
hops2json ${output_file}

source/cpp_src/Applications/test/chk_simplefringesearch3.sh

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,8 @@ cd $EXP_DIR
2222
export HOPS_PLOT_DATA_MASK=0x83FFFFFF
2323

2424
echo "Running: fourfit4 -m 4 -c ./test0.cf -b AS -P RR ./${SCAN_DIR}/"
25-
outfile=$(time fourfit4 -m 4 -c ./test0.cf -b AS -P RR ./${SCAN_DIR}/ 2>&1)
26-
27-
#parse the print out (fourfit4: <fringe_filename>) into just the fringe_filename
28-
echo "$outfile"
29-
old_IFS=$IFS
30-
IFS=" "
31-
set -- $outfile
32-
IFS=$old_IFS
33-
cmdname=$1
34-
output_file=$2
35-
echo "output file: $output_file"
25+
output_file=$(fourfit4 -m 4 -c ./test0.cf -b AS -P RR ./${SCAN_DIR}/ 2>&1 | awk '{print $NF}')
26+
echo "fourfit4 output file: $output_file"
3627

3728
#convert the fringe file to json
3829
hops2json ${output_file}
@@ -41,7 +32,6 @@ hops2json ${output_file}
4132
echo "jq '.[].tags.plot_data | select( . != null )' "${output_file}.json" > tee ./fdump.json"
4233
jq '.[].tags.plot_data | select( . != null )' "${output_file}.json" > ./fdump.json
4334

44-
4535
echo "Running: fourfit3 -m 4 -c ./test0.cf -b AS -P RR ./${MK4_SCAN_DIR} set plot_data_dir ./chk3 "
4636
time fourfit3 -m 1 -c ./test0.cf -b AS -P RR ./${MK4_SCAN_DIR} set plot_data_dir ./chk3 2>&1 | tee ./ff.out
4737

source/cpp_src/Applications/test/chk_simplefringesearch4.sh

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,8 @@ fi
2424
# time fourfit4 -c ./cf_test5 -b GE -P I ./${D2H_EXP_NUM}/${SCAN_DIR} | grep max555 | tee ./sfs.out
2525

2626
echo "Running: fourfit4 -m 4 -c ./cf_test5 -b GE -P I ./${D2H_EXP_NUM}/${HOPS4_DIR}/"
27-
outfile=$( fourfit4 -m 4 -c ./cf_test5 -b GE -P I ./${D2H_EXP_NUM}/${HOPS4_DIR}/ 2>&1)
28-
29-
#parse the print out (fourfit4: <fringe_filename>) into just the fringe_filename
30-
echo "$outfile"
31-
old_IFS=$IFS
32-
IFS=" "
33-
set -- $outfile
34-
IFS=$old_IFS
35-
cmdname=$1
36-
output_file=$2
37-
echo "output file: $output_file"
27+
output_file=$(fourfit4 -m 4 -c ./cf_test5 -b GE -P I ./${D2H_EXP_NUM}/${HOPS4_DIR}/ 2>&1 | awk '{print $NF}')
28+
echo "fourfit4 output file: $output_file"
3829

3930
#convert the fringe file to json
4031
hops2json ${output_file}

source/cpp_src/Applications/test/chk_simplefringex4.sh

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,12 @@ rm ${EXP_DIR}/fringex3*.alist
2424

2525
#run fourfit4
2626
echo "Running: fourfit4 -m 4 -c ./cf_3686_GEHSVY_pstokes2 -b GE -P YY ./${D2H_EXP_NUM}/${HOPS4_DIR}/"
27-
outfile4=$(fourfit4 -m 4 -c ./cf_3686_GEHSVY_pstokes2 -b GE -P YY ./${D2H_EXP_NUM}/${HOPS4_DIR}/ 2>&1)
28-
29-
#parse the print out (fourfit4: <fringe_filename>) into just the fringe_filename
30-
echo "$outfile4"
31-
old_IFS=$IFS
32-
IFS=" "
33-
set -- $outfile4
34-
IFS=$old_IFS
35-
cmdname=$1
36-
output_file4=$2
27+
output_file4=$(fourfit4 -m 4 -c ./cf_3686_GEHSVY_pstokes2 -b GE -P YY ./${D2H_EXP_NUM}/${HOPS4_DIR}/ 2>&1 | awk '{print $NF}')
3728
echo "fourfit4 output file: $output_file4"
3829

3930
#run fourfit and dump its data to a 'plot_data_dir' file
4031
echo "Running: fourfit3 -m 4 -c ./cf_3686_GEHSVY_pstokes2 -b GE -P YY ./${D2M4_EXP_NUM}/${SCAN_DIR}"
41-
outfile3=$(fourfit3 -m 4 -c ./cf_3686_GEHSVY_pstokes2 -b GE -P YY ./${D2M4_EXP_NUM}/${SCAN_DIR} 2>&1)
42-
43-
#parse the print out (fourfit4: <fringe_filename>) into just the fringe_filename
44-
echo "$outfile3"
45-
old_IFS=$IFS
46-
IFS=" "
47-
set -- $outfile3
48-
IFS=$old_IFS
49-
cmdname=$1
50-
output_file3=$2
32+
output_file3=$(fourfit3 -m 4 -c ./cf_3686_GEHSVY_pstokes2 -b GE -P YY ./${D2M4_EXP_NUM}/${SCAN_DIR} 2>&1 | awk '{print $NF}')
5133
echo "fourfit3 output file: $output_file3"
5234

5335
#run fringex4 on the fourfit4 ouput
@@ -60,7 +42,6 @@ fringex -o -v 5 -i 5 ${output_file3} > ${EXP_DIR}/fringex3.alist
6042
# #run fringex (original) on the fourfit3 output
6143
# fringex -v 5 -i 10 ${output_file3} > ${EXP_DIR}/fringex3.alist
6244

63-
6445
#compare the two alist outputs
6546
@PY_EXE@ @CMAKE_CURRENT_BINARY_DIR@/compare_alist_v5.py \
6647
${EXP_DIR}/fringex4.alist \

0 commit comments

Comments
 (0)