Reference Gain Calibration

From EOVSA Wiki
Jump to navigation Jump to search

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 scans are the good ones to use, and record the indices of useful scans as "scanidx". In this example, we were alternating between the low- and high-frequency receivers. The low-frequency receiver observations did not have delays adjusted. So we use scans with indices 1, 3, 5, 7, 9, 11, 13 which are associated with the high-frequency receiver scans.

scanidx=[1, 3, 5, 7, 9, 11, 13]

Then, we can further determine a finer selection of time range which has clean and stable phases (better to check more bands using ra.graph()). Observations within this time range (after the scanidx selection, if provided) will be used for averaging to get the reference phases/amps. Data will be flagged if the SNR is less than minsnr, which can be supplied. The default minsnr is set to 1.0.

timerange=Time(['2017-04-08T05:00','2017-04-08T07:00'])

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. Both refcal['refcal'] and refcal['flag'] have a shape of (15, 2, 34) -- which corresponds to # of antennas, # of polarizations, and # of bands.

If you determine some antenna, band, polarization need to be flagged/unflagged, they have to be manually changed in the returned refcal['flag'] array. In this example, Antenna 12 was not tracking, and the algorithm did not pick up all of them, so we have to do this manually -- setting refcal['flag'][11, :, :]=1

refcal['flag'][11]=1

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:

t=Time('2017-04-07T19:40')
refcal=ra.sql2refcal(t)

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/02 04:20-11:00 All 05:47-07:26 5, 7, 9, 11, 13, 15, 17, 19, 21, 23 Phase Amp Ant 12 was not tracking
2017/04/05 04:17-10:30 All 04:27-09:34 5, 7, 9, 11, 13, 15, 17, 19, 21, 23 Phase Amp Ant 12 was not tracking
2017/04/07 04:00-10:30 1, 3, 5, 7, 9, 11, 13, 15, 17 07:53-09:10 5~34 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 5~34 Phase Amp Ant 12 was not tracking. Ant 13 not working. Delay center change at ~03:00.
2017/04/10 04:30-10:30 2, 6, 8 5~34 Phase Amp Ant 12 was not tracking