예제 #1
0
 def __init__(self, trange):
     ''' Create the object for the specified timerange specified by the 
         2-element Time() trange.  The timerange is used to create a list 
         of Miriad database files to read, and the data are read.
     '''
     # Read data
     out = dump_tsys.rd_miriad_tsys(trange)
     nt, nf, nant = out['xtsys'].shape
     self.xdata = out['xtsys']
     self.ydata = out['ytsys']
     self.fghz = out['fghz']
     self.time = Time(out['ut_mjd'], format='mjd')
     self.tidx = [0, len(self.time)]
     self.fidx = [116, 448]
     # Read calibration
     fghz, self.calfac, self.offsun = offline.read_calfac(trange[0])
     self.bidx = [0, 100]
     self.drange = [None, None]
     self.antlist = range(nant)
     self.cbar = True
     self.showants = range(nant)
     self.domedian = True
     self.docal = True
     self.dolog = False
     self.dosub = True
     self.ax = None
     self.version = __version__
예제 #2
0
 def __init__(self,trange):
     ''' Create the object for the specified timerange specified by the 
         2-element Time() trange.  The timerange is used to create a list 
         of Miriad database files to read, and the data are read.
     '''
     # Read data
     out = dump_tsys.rd_miriad_tsys(trange)
     nt, nf, nant = out['xtsys'].shape
     self.xdata = out['xtsys']
     self.ydata = out['ytsys']
     self.fghz = out['fghz']
     self.time = Time(out['ut_mjd'],format='mjd')
     self.tidx = [0,len(self.time)]
     self.fidx = [116,448]
     # Read calibration
     fghz, self.calfac, self.offsun = offline.read_calfac(trange[0])
     self.bidx = [0,100]
     self.drange = [None,None]
     self.antlist = range(nant)
     self.cbar = True
     self.showants = range(nant)
     self.domedian = True
     self.docal = True
     self.dolog = False
     self.dosub = True
     self.ax = None
     self.version = __version__
예제 #3
0
def solpntanal(t, udb=False, auto=False):
    ''' Does a complete analysis of SOLPNTCAL, reading information from the SQL
        database, finding and dumping the corresponding Miriad IDB data, and 
        doing gaussian fit to beam to return the beam parameters.  The outputs
        are identical dictionaries for x and y polarizations.
    '''
    
    def fname2mjd(filename):
        fstem = filename.split('/')[-1]
        fstr = fstem[3:7]+'-'+fstem[7:9]+'-'+fstem[9:11]+' '+fstem[11:13]+':'+fstem[13:15]+':'+fstem[15:17]
        return Time(fstr).mjd

    pnt = solpnt.get_solpnt(t)
    proc = solpnt.process_solpnt(pnt)
    trange = Time([pnt['Timestamp'],pnt['Timestamp']+300.],format='lv')
    if trange[0].mjd < 57450:
        if auto: print "Warning: 'auto' keyword does nothing for older data.  Keyword ignored."
        otp = dump_tsys.rd_miriad_tsys(trange,udb=udb)
    else:
        otp = dump_tsys.rd_miriad_tsys_16(trange, udb=udb, auto=auto)
#    if udb:
#        fstr = t1.iso
#        folder = '/data1/UDBTXT/'+fstr[:4]
#        files = glob.glob(folder+'/UDB'+fstr.replace('-','').split()[0]+'*_xtsys.txt')
#        files.sort()
#        for filename in files:
#            mjd = fname2mjd(filename)
#            if mjd >= t1.mjd:
#                xfile = filename
#                yfile = filename.replace('xtsys','ytsys')
#                sfile = filename.replace('xtsys','sfreq')
#                break
#    else:
#        xfiles, yfiles = solpnt.dmp_tsys(t)
#        # Give it some time for the files to be written and closed.
#        time.sleep(5)
#        xfile = xfiles[0]
#        yfile = yfiles[0]
#        sfile = '/common/tmp/txt/sfreq.txt'
#    otp = solpnt.rd_tsys(xfile,sfile)
    fghz = otp['fghz']
    xra,xdec,xrao,xdeco = solpnt.process_tsys(otp,proc,pol=0)
    x = {'ut_mjd':otp['ut_mjd'],'fghz':fghz,'ra0':proc['ra0'],'dec0':proc['dec0'],'raparms':xra,'decparms':xdec,'rao':xrao,'deco':xdeco}
#    otp = solpnt.rd_tsys(yfile,sfile)
    yra,ydec,yrao,ydeco = solpnt.process_tsys(otp,proc,pol=1)
    y = {'ut_mjd':otp['ut_mjd'],'fghz':fghz,'ra0':proc['ra0'],'dec0':proc['dec0'],'raparms':yra,'decparms':ydec,'rao':yrao,'deco':ydeco}
    qual = sp_check_qual(x,y)
    return x,y, qual
예제 #4
0
 def __init__(self, trange):
     ''' Create the object for the specified timerange specified by the 
         2-element Time() trange.  The timerange is used to create a list 
         of Miriad database files to read, and the data are read.
     '''
     # Read data, assuming 16-element correlator if after 2016 May 1
     if trange[0].lv > 3544905600.0:
         out = dump_tsys.rd_miriad_tsys_16(trange)
     else:
         out = dump_tsys.rd_miriad_tsys(trange)
     nant, npol, nf, nt = out['tsys'].shape
     self.xdata = out['tsys'][:, 0, :, :]
     self.ydata = out['tsys'][:, 1, :, :]
     self.fghz = out['fghz']
     self.time = Time(out['ut_mjd'], format='mjd')
     self.tidx = [0, len(self.time)]
     # Read calibration
     fghz, self.calfac, self.offsun = offline.read_dbcalfac(trange[0])
     # Make sure frequencies in data and calibration agree
     calidx, dataidx = common_val_idx((fghz * 1000).astype(np.int),
                                      (self.fghz * 1000).astype(np.int))
     self.bidx = [0, 100]
     self.fghz = self.fghz[dataidx]
     self.xdata = self.xdata[:, dataidx, :]
     self.ydata = self.ydata[:, dataidx, :]
     if self.calfac is not None:
         # Select frequencies and swap axes to put into standard form
         self.calfac = np.rollaxis(self.calfac[:, calidx, :], 2)
         self.offsun = np.rollaxis(self.offsun[:, calidx, :], 2)
         fghz = fghz[calidx]
     # Set frequency index range (fidx) to default to show only frequencies > 2.5 GHz
     lowf, = np.where(self.fghz > 2.5)
     self.fidx = [lowf[0], len(self.fghz)]
     self.drange = [None, None]
     self.antlist = range(nant)
     self.cbar = True
     self.showants = range(nant)
     self.domedian = True
     self.docal = True
     self.dolog = False
     self.dosub = True
     self.ax = None
     self.version = __version__
예제 #5
0
 def __init__(self,trange):
     ''' Create the object for the specified timerange specified by the 
         2-element Time() trange.  The timerange is used to create a list 
         of Miriad database files to read, and the data are read.
     '''
     # Read data, assuming 16-element correlator if after 2016 May 1
     if trange[0].lv > 3544905600.0:
         out = dump_tsys.rd_miriad_tsys_16(trange)
     else:
         out = dump_tsys.rd_miriad_tsys(trange)
     nant, npol, nf, nt = out['tsys'].shape
     self.xdata = out['tsys'][:,0,:,:]
     self.ydata = out['tsys'][:,1,:,:]
     self.fghz = out['fghz']
     self.time = Time(out['ut_mjd'],format='mjd')
     self.tidx = [0,len(self.time)]
     # Read calibration
     fghz, self.calfac, self.offsun = offline.read_dbcalfac(trange[0])
     # Make sure frequencies in data and calibration agree
     calidx, dataidx = common_val_idx((fghz*1000).astype('int'),(self.fghz*1000).astype('int'))
     self.bidx = [0,100]
     self.fghz = self.fghz[dataidx]
     self.xdata = self.xdata[:,dataidx,:]
     self.ydata = self.ydata[:,dataidx,:]
     if self.calfac is not None:
         # Select frequencies and swap axes to put into standard form
         self.calfac = np.rollaxis(self.calfac[:,calidx,:],2)
         self.offsun = np.rollaxis(self.offsun[:,calidx,:],2)
         fghz = fghz[calidx]
     # Set frequency index range (fidx) to default to show only frequencies > 2.5 GHz
     lowf, = np.where(self.fghz > 2.5)
     self.fidx = [lowf[0],len(self.fghz)]
     self.drange = [None,None]
     self.antlist = range(nant)
     self.cbar = True
     self.showants = range(nant)
     self.domedian = True
     self.docal = True
     self.dolog = False
     self.dosub = True
     self.ax = None
     self.version = __version__