コード例 #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
コード例 #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'
コード例 #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'
コード例 #4
0
def get_data_beam_pos(startscan, endscan, refscan, obsrecordfile):
    #Get data for a startscan,endscan, and a scan specified as reference to get relative positions
    #For the switching observations, use crosscal infrastructure:
    scans = cc.ScanSpecification()
    scans.setstartscan(startscan)
    scans.setendscan(endscan)
    cc.copy_scans(scans,
                  obsrecordfile,
                  '/data/adams/apertif/beampos',
                  run=True)

    #for the reference scan, want to retrieve all beams
    #This is so I can have coordinates/relative positions of beams for visualization
    #Since I changed directory above, I should still be there (hope!)
    altadata_string_command = "python /home/adams/altadata/getdata_alta.py {0}-{0} 00-36".format(
        refscan)
    os.system(altadata_string_command)
コード例 #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
コード例 #6
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_number_wenddate(self):
     scans = cc.ScanSpecification()
     scans.setenddate(20180512)
     assert scans.enddate == '20180512'
コード例 #7
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_good_enddate(self):
     scans = cc.ScanSpecification()
     scans.setenddate('20180512')
     assert scans.enddate == '20180512'
コード例 #8
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_short_enddate(self):
     scans = cc.ScanSpecification()
     scans.setenddate('180512')
     assert scans.enddate == ''
コード例 #9
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_initialize_nscan_ScanSpec(self):
     scans = cc.ScanSpecification()
     assert scans.nscan == ''
コード例 #10
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_nscan_bad_string(self):
     scans = cc.ScanSpecification()
     scans.setnscan('asgase')
     assert scans.nscan == ''
コード例 #11
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_nscan_good_int(self):
     scans = cc.ScanSpecification()
     scans.setnscan(235)
     assert scans.nscan == '235'
コード例 #12
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_beam_too_large_string(self):
     scans = cc.ScanSpecification()
     scans.setbeam('42')
     assert scans.beam == ''
コード例 #13
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_beam_double_integer(self):
     scans = cc.ScanSpecification()
     scans.setbeam(15)
     assert scans.beam == '15'
コード例 #14
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_beam_single_integer(self):
     scans = cc.ScanSpecification()
     scans.setbeam(3)
     assert scans.beam == '03'
コード例 #15
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
コード例 #16
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_initialize_enddate_ScanSpec(self):
     scans = cc.ScanSpecification()
     assert scans.enddate == ''
コード例 #17
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_number_endscan(self):
     scans = cc.ScanSpecification()
     scans.setendscan(180512001)
     assert scans.endscan == '180512001'
コード例 #18
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_beam_too_large_int(self):
     scans = cc.ScanSpecification()
     scans.setbeam(42)
     assert scans.beam == ''
コード例 #19
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_nscan_float_string(self):
     scans = cc.ScanSpecification()
     scans.setnscan('235.7')
     assert scans.nscan == '235'
コード例 #20
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_beam_too_small_string(self):
     scans = cc.ScanSpecification()
     scans.setbeam(-1)
     assert scans.beam == ''
コード例 #21
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_initialize_beam_ScanSpec(self):
     scans = cc.ScanSpecification()
     assert scans.beam == ''
コード例 #22
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_beam_float_string(self):
     scans = cc.ScanSpecification()
     scans.setbeam('21.5')
     assert scans.beam == ''
コード例 #23
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_bad_string_enddate(self):
     scans = cc.ScanSpecification()
     scans.setenddate('nd39sl2k')
     assert scans.enddate == ''
コード例 #24
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_short_startscan(self):
     scans = cc.ScanSpecification()
     scans.setstartscan('18051201')
     assert scans.startscan == ''
コード例 #25
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_early_enddate(self):
     scans = cc.ScanSpecification()
     scans.setenddate('20050812')
     assert scans.enddate == ''
コード例 #26
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_long_string_startscan(self):
     scans = cc.ScanSpecification()
     scans.setstartscan('18asdkglbnasldkgjaesltkj')
     assert scans.startscan == ''
コード例 #27
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_long_string_enddate(self):
     scans = cc.ScanSpecification()
     scans.setenddate('2018asdkglbnasldkgjaesltkj')
     assert scans.enddate == ''
コード例 #28
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_early_endscan(self):
     scans = cc.ScanSpecification()
     scans.setendscan('080512001')
     assert scans.endscan == ''
コード例 #29
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_beam_good_string(self):
     scans = cc.ScanSpecification()
     scans.setbeam('03')
     assert scans.beam == '03'
コード例 #30
0
ファイル: test_crosscal.py プロジェクト: eakadams/apertif
 def test_set_good_endscan(self):
     scans = cc.ScanSpecification()
     scans.setendscan('180512001')
     assert scans.endscan == '180512001'