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):

ra.graph(out)

By default it displays only bands 5, 11, 17, 23 and polarization XX. To change the bands and polarization to display, use the "bandplt" and 'pol' parameter.

ra.graph(out, bandplt=[5,13,19,25], pol=1)

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)

It will generate four plots. First and second are phases and amplitudes of the data similar as those produced by ra.graph(), but with the selected time range for averaging highlighted (one can use "bandplt" and "pol" to choose bands and polarization to display as well). The 3rd plot is the averaged phase vs. frequency and the 4th is the averaged amplitude vs. frequency. Those data will be our "analyzed" reference calibration data saved in the returned dictionary (named "refcal" here). The dictionary contains 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 Timestamp Obs Trange Scan Idx Avg Trange Bands Phase Plot Amp Plot Comments
2017/04/02 06:36:50 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. Delay center change at 11:38:17.
2017/04/04 09:32:50 04:43~10:57 All 08:46~10:19 5, 7, 9, 11, 13, 15, 17, 19, 21, 23 Phase Amp Ant 12 was not tracking. Delay center change at 16:43:51.
2017/04/05 06:44:10 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/06 09:54:50 04:14~10:49 All 05:39~08:11 5, 7, 9, 11, 13, 15, 17, 19, 21, 23 Phase Amp Ant 12 was not tracking.
2017/04/07 08:30:51 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 06:14:51 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 2017-04-08T03:12:26. Another refcal record is added at 2017-04-09T06:14:45.
2017/04/10 06:57:10 04:30~10:30 2, 6, 8 5~34 Phase Amp Ant 12 was not tracking. Delay center change at 2017-04-08 13:20:39.
2017/04/16 06:36:48 03:00~11:00 05:55~07:20 5~34 Phase Amp Ant 12 was not tracking.
2017/04/17 06:41:51 03:29~10:07 All 05:55~07:29 5~34 Phase Amp Ant 12 was not tracking. Delay center change at 19:12:58.
2017/04/26 08:06:52 02:50~09:28 All 07:21~08:57 5~34 Phase Amp Ant 12 was not tracking. Delay center change at 04:37:28 and 11:51:26.
2017/06/16 13:05:48 0 5~34 Phase Amp No calibration for: Ant 12
2017/06/20 13:06:26 0 5~34 Phase Amp No calibration for: Ant 1 Ant 12
2017/06/21 13:06:38 0 5~34 Phase Amp No calibration for: Ant 12
2017/06/22 13:06:53 0 5~34 Phase Amp No calibration for: Ant 12
2017/06/23 13:07:09 0 5~34 Phase Amp No calibration for: Ant 12
2017/06/24 02:25:49 All 5~34 Phase Amp Ant 12 was not tracking.
2017/06/24 13:07:25 0 5~34 Phase Amp No calibration for: Ant 12
2017/06/25 13:07:43 0 5~34 Phase Amp No calibration for: Ant 10 Ant 12
2017/06/26 13:15:47 0 5~34 Phase Amp No calibration for: Ant 10 Ant 12