Ejemplo n.º 1
0
def get_coords_and_offsets(startscan, endscan, refscan, obsrecordfile):
    #want to get my coordinates and offsets for full range of scans
    #first, get scan & beam list to help make life easier:
    scans = cc.ScanSpecification()
    scans.setstartscan(startscan)
    scans.setendscan(endscan)
    mode, scan_list, beam_list = cc.get_scan_list(scans, obsrecordfile)

    #then set arrays of the right length to store coordinates
    coord_list = np.empty(len(scan_list), dtype=object)
    offset_list = np.empty(len(scan_list), dtype=object)
    #get reference coordinate
    refMS = 'WSRTA{0}_B000.MS'.format(refscan)
    t_field = pt.table(refMS + "::FIELD", readonly=True)
    phasedir = t_field[0]["PHASE_DIR"]
    ref_coord = SkyCoord(phasedir[0, 0], phasedir[0, 1], unit='rad')
    #now go through each observation to get coordinates
    for i, (scan, beam) in enumerate(zip(scan_list, beam_list)):
        #format the msfile:
        msfile = 'WSRTA{0}_B{1:0>3}.MS'.format(scan, beam)
        #read the FIELD table
        t_field = pt.table(msfile + "::FIELD", readonly=True)
        #take PHASE_DIR as center coordinate of beam
        phasedir = t_field[0]["PHASE_DIR"]
        #this is [ra,dec] in radians
        #put into a SkyCoord object - easy to handle
        c = SkyCoord(phasedir[0, 0], phasedir[0, 1], unit='rad')
        coord_list[i] = c
        offset_list[i] = c.separation(ref_coord).value
    return coord_list, offset_list, beam_list
Ejemplo n.º 2
0
 def test_get_scanlist_variabilitymode(self):
     scans = cc.ScanSpecification()
     scans.setbeam('23')
     scans.setenddate('20180607')
     scans.setstartdate('20180504')
     mode, scanlist, beamlist = cc.get_scan_list(scans, obsrecordfile)
     assert mode == 'variability'
Ejemplo n.º 3
0
 def test_get_26oct_3C147_switching(self):
     scans = cc.ScanSpecification()
     scans.setstartscan('181026063')
     scans.setendscan('181026099')
     mode, scanlist, beamlist = cc.get_scan_list(scans, obsrecordfile)
     assert scanlist[14] == '181026077'
     assert beamlist[14] == '14'
     assert scanlist[3] == '181026066'
     assert beamlist[3] == '3'
Ejemplo n.º 4
0
 def test_get_scanlist_endscanonly(self):
     scans = cc.ScanSpecification()
     scans.setendscan('180403023')
     mode, scanlist, beamlist = cc.get_scan_list(scans, obsrecordfile)
     assert mode == None
Ejemplo n.º 5
0
 def test_get_scanlist_nscanonly(self):
     scans = cc.ScanSpecification()
     scans.setnscan(24)
     mode, scanlist, beamlist = cc.get_scan_list(scans, obsrecordfile)
     assert mode == None
Ejemplo n.º 6
0
 def test_get_scanlist_startscan_nscan(self):
     scans = cc.ScanSpecification()
     scans.setstartscan('180403001')
     scans.setnscan(23)
     mode, scanlist, beamlist = cc.get_scan_list(scans, obsrecordfile)
     assert mode == 'switch'
Ejemplo n.º 7
0
 def test_get_scanlist_startdate_enddate_nobeam(self):
     scans = cc.ScanSpecification()
     scans.setstartdate('20180403')
     scans.setenddate('20180508')
     mode, scanlist, beamlist = cc.get_scan_list(scans, obsrecordfile)
     assert mode == None
Ejemplo n.º 8
0
 def test_get_scanlist_enddateonly(self):
     scans = cc.ScanSpecification()
     scans.setenddate('20180507')
     mode, scanlist, beamlist = cc.get_scan_list(scans, obsrecordfile)
     assert mode == None