This is an old revision of the document!

Legacy Fourfit notes

Please note: This information is likely out-of-date. It has simply been ported directly over from the old wiki for reference purposes.

Fourfit is the software that performs the multi-band delay fitting to the correlator visibilities. At present, magilla is set up with the latest version and has scripts installed which remove some of the donkey-work in preparing properly fringe-fitted data sets. The following recipe will work for data sets correlated at Curtin.

  • Download the following files from the Pawsey server to ~/Downloads: AUG013.MARK4.tar.gz, aug013.vex and aug013.v2d
  • Run “ aug013” to copy the data across to /data/AUSTRAL/ extract them into the appropriate folders. It will also get you to check the ovex files station ID assignments and generate the apriori SNR file (delete all the leading text before the first two headers).
  • After completing the initial fringe-fitting (using the default settings defined by /data/AUSTRAL/cf_aust), you will be prompted to enter a command like “cd /data/AUSTRAL/aug013/1344 ; export CORDATA=/data/AUSTRAL/aug013/ ; export DATADIR=/data/AUSTRAL/aug013/ ; aedit -f alist.ed.out”. Do so, and you will be able to make a first inspection of the data.


After running “edi dup snr”, run “psplot” and check for either grey scans (uncorrelated data) or brown ones indicating non-detections. If found, make sure there's a sensible/known reason for them (module failure, antenna windstowed, etc). If there's no explanation, get in contact with the correlator ASAP.

There are two machines set up to run fourfit at present - hex2 (through the hex2:1 VNC session) or ACECOMPUTE (using The two systems give slightly different results, thought to be due to the difference in the 32/64-bit compilers. The 32-bit version on hex2 occasionally gives unreliable estimates of the SNR, while the 64-bit version on ACECOMPUTE does not. Bonn also uses the 64-bit version, so ACECOMPUTE in strongly recommended for use in processing the data.


Make a directory and download the tarball from CURTIN into this directory [mkdir AUST10 ; cd AUST10; wget -c]

Untar the AUST10.MARK4.tar file to create the 1234 directory. Copy the ~/cf_aust template file into the 1234 directory as cf_1234 [cp ~/cf_aust ~/AUST10/1234/]

Change to the 1234 directory and create a list of scans with cd ~/AUST10/1234/ ; ls -d 219-* 220* > /tmp/scans (Replacing the 219 and 220 with the appropriate DOYs for the experiment.

Now perform an initial fourfit on the data. You need to do this scanwise as there are often corrupted scans in the data set which will crash fourfit otherwise. The script below gives verbose output for each scan:

 for i in $(cat /tmp/scans) ; do fourfit -m 1 -c cf_1234 $i ; done

A more concise version is included below:

parallel fourfit -c cf_1234 ::: $(ls -d 12*)

Once the fourfit processes are complete (15-30 minutes?), run alist with alist * and then edit the file with the following commands

 sed -i 's/ 16383 / 1234 /g' alist.out
 grep -v  '0.000000 0.000  -1  -1' alist.out > alist.ed.out

Download the skd file and reprocess it into an ovex file. NB - needs to have internet access - you'll need to define the proxy settings for most machines. aust10.skd 1234 > 1234.ovex

Edit the ovex file & change the site IDs to match the Curtin ones

 Warkworth = W 
 Hobart12 = L
 Hart15 = g
 Katherine = i
 Yarragadee = e
 Hobart26 = H
 Hart26m = x 

Define these two variables as the directories that contain the 1234 directory.

 export CORDATA=/u/rd_scope/AUST10/
 export DATADIR=/u/rd_scope/AUST10/

Then run alist and make it ready for use with:

 aedit -f alist.ed.out
       edi dup snr 

Phase Cal estimation

To generate pcal estimates for all the stations with working pcals, run the follwing commands in aedit

 qc 1-9 
 sort basel 
 sort freq
 edi inp
 param 72 54 55 22 
 pwrite additivephase.txt

Then run

 ~/phasedisp_c additivephase 7 30
 fgrep Median phasedisp_c.out > med.txt 

Check med.txt for the baselines. If your chosen reference station is the first station in the baseline, then the sign is correct, otherwise reverse it. Paste the median values in the “pc_phases..” lines in the cf_1234 file.

Once you've got these in the cf_1234 file, delete previous fourfit scans with

 cd /data/AUSTRAL/AUST11/1234/
 find . -name '??.X.*' -delete
 find . -name '??.S.*' -delete

and then reprocess all the scans with the correct pcal settings.

for i in $(cat /tmp/scans) ; do echo $i ; fourfit -c cf_1234 $i ; done

Then re-create the alist file with

 alist *
 sed -i 's/ 16383 / 1234 /g' alist.out
 grep -v  '0.000000 0.000  -1  -1' alist.out > alist.ed.out

Run aedit to check the results. “sum 2” should have a better tally of good scans and only a few H or G-codes.

NB - G-codes are caused by having a bad channel in the frequency group where it's sensitivity is < half of the average. For S-band, it's generally RFI that causes this but some stations have chronic poor performance in some LSB channels. If you detect a large number of G-codes, it may be worth dropping the channel. To do so, you need to edit the cd_1234 file once again and add a line like

 if station W and f_group X
    freqs g h i j k l m n+

This will flag out the X8L channel [dubbed n- in HOPS] in the Warkworth data from the fitting process. Re-run fourfit on the affected scans and quickly check the results [ e,g, remove previous fourfit results with the find command above & then run fourfit -pt -m 1 -c cf_1234 ddd-hhmm. Check that the G-code error is gone & that the scan is good. If so, reprocess the entire data set with the updated cf file and resume.

Manual Phasecal

If you have a station with no [or weak] phase-cal, you will need to do a manual pcal. To do this, pick a scan with good SNR (50+) in both bands - you can check this within aedit with

 axis snr 
 baselines LW
 device /xs

[L == Hobart12 is being used as the reference station here, and W == Warkworth is the station lacking phasecal]

Once you've identified your scan, exit aedit

Modify your cf_1234 file to include these sections

 if station W and f_group X
    pc_mode manual
    pc_phases ghijklmn 0 0 0 0 0 0 0 0 
 if station W and f_group S
    pc_mode manual
    pc_phases abcdef 0 0 0 0 0 0 

With the modified the cf_1234 file, run fourfit on your selected scan [219-1239 in this example]

fourfit -pt -m 1 -c ../cf_1234 -bLW 219-1239

In he debugging output of each plot will be the estimated pcal phases for that scan. If the baseline is reference→manual pcal target, you'll need to reverse the sign on these after pasting them into your control file.

Once the cf_1234 file is updated, re-run fourfit and check that the phases are aligned on zero in all the individual IF channels for that scan. If not, check for a sign error? Also, check that other scans also show the IF phases aligned (although not necessarily on zero). If the manual pcal stops working after a certain time, you can re-fringe fit and specify valid time ranges for the varrious pcal values with

 if station O and f_group S and scan < 256-165000
   pc_phases abcdef -4.0    2.3    2.8   -1.7    1.0   -0.4
 if station O and f_group S and scan  256-170000 to 258-165000
   pc_phases abcdef   -4.0 290.3 146.8  -1.7  73.0  -0.
 if station O and f_group S and scan > 258-165000
   pc_phases abcdef -4.0   2.3   2.8  -1.7   1.0  -0.4 

Recreate the alist [with sed & grep -v as before], load it in aedit and check the “sum 2” or psplot outputs to make sure it's improved things.

If everything looks ok, then you're done with fourfit!