PSRPL: Create the METM database

Creating an METM calibrator solution database consists of 3 steps
  1. Create a series of MEM calibrator solutions using the MEM script
  2. Select the best solutions and integrate the calibrated data to create a well-calibrated, high S/N standard (or template).
  3. Run the METM script

Step One: Create the MEM calibrator solutions

For the band and backend of interest, first complete the following two steps
  1. Clean up the data
  2. Prepare five-minute integrations
for each of the following sources
  • J0437-4715
  • 0407-658
That is, assuming that all goes smoothly, simply run the following commands
cd $PSRPL_DIR
./psrpl_zap.csh J0437-4715
./psrpl_cleaned_integrate.csh J0437-4715
./psrpl_sessions.csh J0437-4715

./psrpl_zap.csh 0407-658
./psrpl_cleaned_integrate.csh 0407-658
./psrpl_sessions.csh 0407-658
Then create two calibrator databases
cd $PSRPL_DIR
./psrpl_cal_dbase.csh 0407-658
./psrpl_cal_dbase.csh J0437-4715_R
Finally, run MEM and clean up the failures. Note that the psrpl_pcm_trash.csh script is tuned to Parkes 21-cm Multibeam receiver quality data; new thresholds may be required in other bands or at other telescopes. For example,
psrpl_pcm.csh mem J0437-4715 20cm bri00e19
psrpl_pcm_trash.csh mem J0437-4715 20cm bri00e19

Step Two: Select the best MEM solutions

First, have a look at the results; e.g.
cd $PSRPL_OUT/calibrators/mem_bri00e19/J0437-4715/20cm
psrplot -p calm */pcm.fits
and the goodness-of-fit
cd $PSRPL_OUT/calibrators/mem_bri00e19/J0437-4715/20cm
psrplot -p calm */pcm.fits -c gof=1
and the degree of polarization of the noise diode
cd $PSRPL_OUT/calibrators/mem_bri00e19/J0437-4715/20cm
psrplot -p calm */pcm.fits -c calp=1
Choose the session with the best goodness-of-fit; e.g.
psrstat -c '{sum{$pcal:eqn:chisq}/sum{$pcal:eqn:nfree}}' */pcm.fits | sort -nrk2
and use MTM to match all of the calibrated, integrated totals to the best one; e.g.
ln -s 2015-08-31-1700_1382/total.ar chosen.ar
foreach file ( */total.ar )
  pcm -t8 -n 128 -1 -S chosen.ar $file
end
Check the MTM goodness-of-fit
psrplot -p calm */*.mtm -c gof=1
and then EITHER add a bunch of good fits to the best one and create a high S/N standard OR simply copy the best one and call it the standard.

Place the newly created standard/template in the place where the METM scripts will look for it; e.g.

mkdir -p $PSRPL_OUT/templates/J0437-4715/20cm
mv standard.ar $PSRPL_OUT/templates/J0437-4715/20cm/1382.std

Step Two: Run the METM script

psrpl_pcm.csh metm J0437-4715 20cm bri00e19
Use squeue to determine when all of the jobs have completed.

At this point, you could choose to add all of the observations with a good fit together (e.g. select the observations with reduced chisq < 1.1)

cd $PSRPL_OUT/calibrators/metm_bri00e19/J0437-4715/20cm
psrstat -c '{sum{$pcal:eqn:chisq}/sum{$pcal:eqn:nfree}}' */alpha/pcm.fits > chis
q.txt
awk '$2<1.1 {print $1}' chisq.txt | sed -e 's|pcm\.fits|total\.ar|' > total.ls
psradd -T -o total_sum.ar -M total.ls