Reference Gain Calibration
Reference complex gain calibration refers to determining the "system" amplitude and phase with high precision as a function of IF band (i.e. integrated over each 500 MHz IF band). A typical reference calibration would cover 34 bands, 2 polarizations, and 13 antennas. I have a routine to retrieve and analyze the data, named refcal_anal.py. Start from a time range during which reference calibration observation occurred
import refcal_anal as ra from util import Time trange=Time(['2017-04-08T05:00','2017-04-08T15:30'])
Ideally, we would like all reference calibrations to have a designated PROJECTID "REFCAL". For all data before May 2017, however, all reference calibrations had PROJECTID of "PHASECAL", but most of them were on 3C273 (1229+020). So I am using:
out=ra.rd_refcal(trange, projid='PHASECAL', srcid='1229+020')
Take a look at the phases (averaged over each band). To change the bands to display, update the "bandplt" parameter (default is [4, 8, 12, 16]). Default is to plot polarization XX (pol=0). To display YY, change to pol=1.
ra.graph(out, bandplt=[4,8,12,16], pol=0)
From the plot one can determine which time range has clean enough phases (stable over time), which will be used for averaging to get the reference phase/amp. One can also supply a list of scan indices to indicate scans you want with "scanidx" (default is to use all scans found). Data will be flagged if the SNR is less than minsnr, which can be supplied.
timerange=Time(['2017-04-08T05:00','2017-04-08T07:00']) scanidx=[1, 3, 5, 7, 9, 11, 13] refcal=ra.refcal_anal(out,timerange=timerange,scanidx=scanidx,bandplt=[4,10,15,20])
The returned refcal is a dictionary, containing the actual complex values (refcal['refcal']), a flag array with the same shape (refcal['flag']), and some timestamps, e.g., refcal['t_mid'] is the middle of the time range used for averaging. If you determine some antenna, band, polarization need to be flagged/unflagged, they have to be manually changed in the returned refcal['flag'] array.
If satisfied with the results (by looking at the plots), we can go ahead and send them to the SQL database
import cal_header as ch ch.refcal2sql(refcal)
To retrieve the refcal data back from SQL database based on, e.g., a solar data one wish to calibrate. We can provide a time:
The resulted refcal have three keys: 'amp' (15 x 2 x 34 array), 'pha' (15 x 2 x 34 array), and 'timestamp' (in jd). The refcal data found will be the closest one PRIOR to the supplied observation time.
List of Analyzed Reference Calibrations
|Date||Obs Trange||Scan Idx||Avg Trange||Bands||Phase Plot||Amp Plot||Comments|
|2017/04/05||04:17-10:30||All||04:27-09:34||4, 6, 8, 10, 12, 14, 16, 18, 20, 22||Phase||Amp||Ant 12 was not tracking|
|2017/04/08||05:00-10:30||1, 3, 5, 7, 9, 11, 13||05:00-07:00||4~33||Phase||Amp||Ant 12 was not tracking. Ant 13 not working|