• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tables.table函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyrap.tables.table函数的典型用法代码示例。如果您正苦于以下问题:Python table函数的具体用法?Python table怎么用?Python table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了table函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _get_ra_and_decl_from_ms

    def _get_ra_and_decl_from_ms(self, measurement_set):
        """
        This function uses pyrap to read the ra and declanation from a 
        measurement set (used by expected_fluxes_in_fov). This is a position 
        in the sky. These values are stored in the field.phase_dir in the first
        row. All exceptions thrown are caught and logged, return None if reading
        failed
        """

        table = None;
        field = None;
        ra_and_decl = None;

        try:
            # open the ms, get the phase direction
            table = pt.table(measurement_set)
            field = pt.table(table.getkeyword("FIELD"))
            ra_and_decl = field.getcell("PHASE_DIR", 0)[0]

        except Exception, exception:
            #catch all exceptions and log
            self.logger.error("Error loading FIELD/PHASE_DIR from "
                              "measurementset {0} : {1}".format(measurement_set,
                                                                str(exception)))
            raise exception
开发者ID:kernsuite-debian,项目名称:lofar,代码行数:25,代码来源:imager_create_dbs.py


示例2: updateMSmetadata

def updateMSmetadata(msfile):
  #Update history to show that this script has modified original data
  tms = pt.table(msfile,readonly=False,ack=False)
  th = pt.table(tms.getkeyword('HISTORY'), readonly=False, ack=False)
  nr=th.nrows()
  th.addrows(1)
  tr=th.row()
  tr.put(nr,{'TIME': quantity('today').get('s').get_value(),
             'OBSERVATION_ID':0,
             'MESSAGE': 'Applied polarization modifications',
             'PRIORITY': 'NORMAL',
             'ORIGIN': '%s: version = %s' % (__file__,__version__),
             'OBJECT_ID':0, 
             'APPLICATION':__file__,
             'CLI_COMMAND':sys.argv,
             'APP_PARAMS': ['']})

  if not options.linear:
     #Change metadata information to be circular feeds
     feed = pt.table(tms.getkeyword('FEED'),readonly=False,ack=False)
     for tpart in feed.iter('ANTENNA_ID'):
      tpart.putcell('POLARIZATION_TYPE',0,['R','L'])

     polariz = pt.table(tms.getkeyword('POLARIZATION'),readonly=False,ack=False)
     polariz.putcell('CORR_TYPE',0,[5,6,7,8])
     tms.close()
开发者ID:2baOrNot2ba,项目名称:mscorpol,代码行数:26,代码来源:mscorpol.py


示例3: copy_column_to_ms

def copy_column_to_ms(ms, inputcol, outputcol, ms_from=None):
    """
    Copies one column to another, within an MS file or between two MS files

    Parameters
    ----------
    ms : str
        MS file receiving copy
    inputcol : str
        Column name to copy from
    outputcol : str
        Column name to copy to
    ms_from : str, optional
        MS file to copy from. If None, the column is copied internally

    """
    t = pt.table(ms, readonly=False, ack=False)
    if ms_from is not None:
        tf = pt.table(ms_from, readonly=False, ack=False)
        data = tf.getcol(inputcol)
        desc = tf.getcoldesc(inputcol)
    else:
        data = t.getcol(inputcol)
        desc = t.getcoldesc(inputcol)

    # Add the output column if needed
    if outputcol not in t.colnames():
        desc['name'] = outputcol
        t.addcols(desc)

    t.putcol(outputcol, data)
    t.flush()
    t.close()
开发者ID:Joshuaalbert,项目名称:factor,代码行数:33,代码来源:copy_column.py


示例4: load_and_compare_data_sets

def load_and_compare_data_sets(ms1, ms2):
    # open the two datasets
    ms1 = pt.table(ms1)
    ms2 = pt.table(ms2)

    #get the amount of rows in the dataset
    n_row = len(ms1.getcol('DATA'))
    n_complex_vis = 4

    # create a target array with the same length as the datacolumn
    div_array = numpy.zeros((n_row, 1, n_complex_vis), dtype=numpy.complex64)
    ms1_array = ms1.getcol('DATA')
    ms2_array = ms2.getcol('CORRECTED_DATA')

    div_max = 0
    for idx in xrange(n_row):
        for idy  in xrange(n_complex_vis):

            div_value = ms1_array[idx][0][idy] - ms2_array[idx][0][idy]
            if numpy.abs(div_value) > numpy.abs(div_max):
                div_max = div_value

            div_array[idx][0][idy] = div_value
    print "maximum different value between measurement sets: {0}".format(div_max)
    # Use a delta of about float precision
    if div_max > 1e-6:
        print "The measurement sets are contained a different value"
        print "failed delta test!"
        return False

    return True
开发者ID:saiyanprince,项目名称:pyimager,代码行数:31,代码来源:target_pipeline.py


示例5: splitdataset

def splitdataset(dataset, interval, out):
    name = dataset.split("/")[-1]
    print "Splitting {0} by {1} sec intervals...".format(name, interval)
    t = pt.table(dataset, ack=False)
    starttime = t[0]["TIME"]
    endtime = t[t.nrows() - 1]["TIME"]
    numberofsplits = int((endtime - starttime) / interval)
    for split in range(0, numberofsplits):
        outputname = os.path.join(out, "splitMS", name + ".{0}sec_{1:04d}.split".format(int(interval), split + 1))
        if split == 0:
            thisstart = starttime - 2.0
        else:
            thisstart = starttime + (float(split) * interval)
        thisend = starttime + ((float(split) + 1) * interval)
        t1 = t.query(
            "TIME > "
            + str(thisstart)
            + " && \
		TIME < "
            + str(thisend),
            sortlist="TIME,ANTENNA1,ANTENNA2",
        )
        t1.copy(outputname, True)
        t1.close()
        if split == 0:
            thisstart += 2.0
        t1 = pt.table(outputname + "/OBSERVATION", ack=False, readonly=False)
        thistimerange = np.array([thisstart, thisend])
        t1.putcell("TIME_RANGE", 0, thistimerange)
        t1.putcell("LOFAR_OBSERVATION_START", 0, thisstart)
        t1.putcell("LOFAR_OBSERVATION_END", 0, thisend)
        t1.close()
    t.close()
开发者ID:vheesen,项目名称:rsmpp,代码行数:33,代码来源:lofar-imager.py


示例6: main

def main(inms='',beVerbose=False):
        didWarn = False
        whatSkipped = {}
        t = pt.table(inms, ack=False)
        th = pt.table(t.getkeyword('HISTORY'), ack=False)
        colnames = th.colnames()
        nrows = th.nrows()
        print 'The HISTORY table in %s has %d rows' % (inms, nrows)
        for row in th:
                if row['APPLICATION'] == 'imager' or row['APPLICATION'] == 'OLAP' or row['APPLICATION'] == 'ms':
                        if beVerbose:
                                print '%s was run at time %f with parameters:' % (row['APPLICATION'],row['TIME'])
                                for r in row['APP_PARAMS']:
                                        print '\t%s' % (r)
                        else:
                                if not didWarn:
                                        print '(Skipping OLAP, imager, and ms rows, use -v to print them)'
                                        didWarn = True
                                if row['APPLICATION'] in whatSkipped:
                                        whatSkipped[row['APPLICATION']] += 1
                                else:
                                        whatSkipped[row['APPLICATION']] = 1
                else:
                        print '%s was run at time %f with parameters:' % (row['APPLICATION'],row['TIME'])
                        for r in row['APP_PARAMS']:
                                print '\t%s' % (r)
        print 'Overview of skipped rows:'
        for key in whatSkipped:
                print '\t%s:\tskipped %d times' % (key,whatSkipped[key])
开发者ID:Davidmul,项目名称:LOFAR-Contributions,代码行数:29,代码来源:msHistory.py


示例7: copy_column_to_bands

def copy_column_to_bands(mslist, ms_from, inputcol, outputcol):
    """
    Copies one column from an MS file to multiple MS files (bands)

    Parameters
    ----------
    mslist : list
        MS files receiving copy
    ms_from : str
        MS file to copy from.
    inputcol : str
        Column name to copy from
    outputcol : str
        Column name to copy to

    """
    datain = pt.table(ms_from)
    data = datain.getcol(inputcol, nrow=1)
    numberofchans = numpy.int(numpy.shape(data)[1])
    chanperms = numberofchans/numpy.int(len(mslist))

    for ms_id, ms in enumerate(mslist):
        if os.path.isdir(ms):
            data = datain.getcolslice(inputcol, [chanperms*ms_id,0], [(chanperms*(ms_id+1))-1,3])
            dataout = pt.table(ms, readonly=False)
            dataout.putcol(outputcol, data)
            dataout.flush()
            dataout.close()
开发者ID:Joshuaalbert,项目名称:factor,代码行数:28,代码来源:copy_column.py


示例8: gain2matlab

def gain2matlab(msname='test1.MS', gainfilename='bbsgain.mat', timeslot=0, instrumentname='instrument'):
  parmdb=msname+'/'+instrumentname
  antenna=msname+'/ANTENNA'

  valstable=table(parmdb,ack=False)
  namestable=table(parmdb+"::NAMES",ack=False)
  antennatable=table(antenna,ack=False)

  vals=valstable.col('VALUES')
  names=namestable.col('NAME')
  antennas=antennatable.col('NAME')
  antennamap={};
  for i in range(antennas.nrows()):
    antennamap[antennas[i]]=i

  g = np.zeros((len(antennamap)*2,2),dtype=np.complex)

  for i in range(vals.nrows()):
    (bla, xcor, ycor, reim, ant) = names[i].split(':')
    antnr=antennamap[ant]
    (xcor,ycor)=(int(xcor),int(ycor))
    if reim=="Real":
      val=vals[i][timeslot][0]
    elif reim=="Imag":
      val=vals[i][timeslot][0]*(1.j)
    elif reim=="Phase":
      val=cmath.rect(1,vals[i][timeslot][0])
    #print antnr, xcor, ycor, antnr*2+xcor, ycor, val
    g[antnr*2+ycor][xcor]+=val.conjugate()

  scipy.io.savemat(gainfilename, dict(g=g), oned_as='row')
  print "Stored timeslot",timeslot,"gains from", msname, "/",instrumentname,"as",gainfilename
开发者ID:twshimwell,项目名称:lofarscripts,代码行数:32,代码来源:gain2matlab.py


示例9: __init__

 def __init__(self,mslist,mss=None):
     """
     mslist is the MS list filename
     """
     import pyrap.tables as pt
     if mss is not None:
         self.mss=mss
         self.mslist=None
     else:
         self.mslist=mslist
         self.mss=[s.strip() for s in open(mslist).readlines()]
     self.obsids = [os.path.basename(ms).split('_')[0] for ms in self.mss]
     self.freqs=[]
     self.channels=[]
     self.hascorrected=[]
     self.dysco=[]
     for ms in self.mss:
         t = pt.table(ms,readonly=True,ack=False)
         colname='CORRECTED_DATA'
         try:
             dummy=t.getcoldesc(colname)
         except RuntimeError:
             dummy=None
         self.hascorrected.append(not(dummy is None))
         self.dysco.append('Dysco' in t.showstructure())
         t.close()
         t = pt.table(ms+'/SPECTRAL_WINDOW', readonly=True, ack=False)
         self.freqs.append(t[0]['REF_FREQUENCY'])
         self.channels.append(t[0]['CHAN_FREQ'])
开发者ID:mhardcastle,项目名称:ddf-pipeline,代码行数:29,代码来源:auxcodes.py


示例10: read_ms

def read_ms(infile, verbosity=1):
    """ Convert MS to a HDF file
    :param infile:  Measurement Set path
    :return: HDU version of Measurement Set
    """
    pp = PrintLog(verbosity=verbosity)
    ms = pt.table(infile)

    # Create a HDU List for storing HDUs
    hdul = IdiHdulist(verbosity=verbosity)

    # Add each column to the main HDU
    hdu_main = table2hdu(ms, "MAIN", verbosity=verbosity, close_after=False)
    hdul["MAIN"] = hdu_main

    # Now look for other keyword tables
    for key, val in ms.getkeywords().items():
        pp.debug(val)
        if type(val) in (unicode, str):
            if val.startswith("Table: "):
                tblpath = val.strip().split("Table: ")[1]
                pp.h2("Opening %s" % key)
                t = pt.table(tblpath)
                t_hdu = table2hdu(t, key, verbosity=verbosity)
                hdul[key] = t_hdu
        else:
            hdul["MAIN"].header.vals[key] = val

    ms.close()
    return hdul
开发者ID:scienceopen,项目名称:fits2hdf,代码行数:30,代码来源:msio.py


示例11: get_summary

 def get_summary(self):
     subtables = self.ms.keywordnames()
     for subtable in ('POLARIZATION', 'OBSERVATION', 'FIELD', 
                      'SPECTRAL_WINDOW'):
         if subtable not in subtables:
             sys.stderr.write("Subtable %s missing from MS\n" % subtable)
             sys.exit()
     frequencies = self.get_frequencies()
     self.get_antenntas()
     polarization = {'count': pt.table(
             os.path.join(self.filename, 'POLARIZATION'), ack=False).getcol(
             'NUM_CORR')[0]}
     times = {'time': pt.table(
             os.path.join(self.filename, 'OBSERVATION'), ack=False).getcol(
             'TIME_RANGE')[0]}
     fieldnames = {'fieldnames': pt.table(
             os.path.join(self.filename, 'FIELD'), ack=False).getcol('NAME')}
     phases = {'direction': pt.table(
             os.path.join(self.filename, 'FIELD'), ack=False).getcol('PHASE_DIR')}
     self.summary = {
         'frequencies': frequencies,
         'polarization': polarization,
         'fieldnames': fieldnames,
         'times': times,
         'phases': phases
         }
开发者ID:Davidmul,项目名称:LOFAR-Contributions,代码行数:26,代码来源:msinfo.py


示例12: __init__

 def __init__(self, MSfile, timecorr, block, solint, ionfactor, ncores,
     resume, parset, skymodel, parmdb, clobber, solver):
     self.file = MSfile
     self.msname = self.file.split('/')[-1]
     sw = pt.table(self.file + '/SPECTRAL_WINDOW', ack=False)
     self.freq = sw.col('REF_FREQUENCY')[0]
     sw.close()
     obs = pt.table(self.file + '/FIELD', ack=False)
     self.ra = np.degrees(float(obs.col('REFERENCE_DIR')[0][0][0]))
     if self.ra < 0.:
         self.ra=360.+(self.ra)
     self.dec = np.degrees(float(obs.col('REFERENCE_DIR')[0][0][1]))
     obs.close()
     ant = pt.table(self.file + '/ANTENNA', ack=False)
     diam = float(ant.col('DISH_DIAMETER')[0])
     ant.close()
     self.fwhm_deg = 1.1*((3.0e8/self.freq)/diam)*180./np.pi
     self.name = str(self.freq)
     self.timecorr = timecorr
     self.sol_block = block
     self.ionfactor = ionfactor
     self.ncores = ncores
     self.resume = resume
     self.solint = solint
     self.parset = parset
     self.input_parmdb = parmdb
     self.output_parmdb = 'instrument'
     self.skymodel = skymodel
     self.clobber = clobber
     self.solver = solver
开发者ID:darafferty,项目名称:DistCal,代码行数:30,代码来源:libs.py


示例13: __init__

    def __init__(self, ms):
        self.timepara={'start':0, 'end':0, 'step':0, 'cent':0}
	self.freqpara={'start':0, 'end':0, 'step':0, 'cent':0}
	self.msname = ms
	if not os.path.isdir(ms): sys.exit('INPUT MS DOES NOT EXIST!')
        ##########Getting Time parameters first#############
	t = pt.table(ms, readonly=True, ack=False)
	t1 = t.sort ('unique desc TIME')
	self.timepara['step'] = t.getcell('EXPOSURE',0)
	self.timepara['start'] =  np.min(t.getcol('TIME'))-self.timepara['step']/2.
	self.timepara['end'] =  np.max(t.getcol('TIME'))+self.timepara['step']/2.
	self.timepara['cent'] = self.timepara['start']+(self.timepara['end']-self.timepara['start'])/2.
	self.mstimevalues = t1.getcol('TIME')[::-1]
	t1.close()
        ##########Getting Frequency Parameters###################
	freq=pt.table(t.getkeyword("SPECTRAL_WINDOW"), readonly=True, ack=False)
	self.fullband = freq.getcell('TOTAL_BANDWIDTH', 0)
	self.freqpara['cent'] = freq.getcell('REF_FREQUENCY', 0)
	self.freqpara['step'] = freq.getcell('CHAN_WIDTH', 0)[0]
        self.msfreqvalues = freq.getcell('CHAN_FREQ', 0)
	self.freqpara['start'] = self.msfreqvalues[0]-self.freqpara['step']/2.
	self.freqpara['end'] = self.msfreqvalues[-1]+self.freqpara['step']/2.
	freq.close()
        ##########Getting Station Names###################
        antennas = pt.table(t.getkeyword("ANTENNA"), readonly=True, ack=False)
        self.stations = antennas.getcol('NAME')
        antennas.close()
	t.close()
开发者ID:AHorneffer,项目名称:prefactor,代码行数:28,代码来源:transfer_gains_RMextract.py


示例14: read_ms

def read_ms(logger, msname, ateam, diameter=None):
    def get_station_diameter(table):
        histable = pt.table(table.getkeyword('HISTORY'), ack=False)
        for line in histable.getcell('APP_PARAMS', 0):
            try:
                key, value = line.split("=")
            except:
                pass
            if key == "Observation.antennaSet":
                antenna_set = value
                break
        if antenna_set == "LBA_INNER":
            logger.debug("LBA_INNER mode")
            return STATION_DIAMETER["LBA_INNER"]
        elif antenna_set[:3] == "LBA":
            logger.debug("LBA_(OUTER,SPARSE,X,Y) mode")
            return STATION_DIAMETER["LBA"]
        elif antenna_set[:3] == "HBA":
            logger.debug("HBA mode")
            return STATION_DIAMETER["HBA"]
        else:
            logger.error("Failed to identify antenna set")

    def field_size_ateam(table):
        logging.debug('Computing field size for A-team')
        fieldtable = table.getkeyword('FIELD').split()[1]
        taqloutput = pt.taql("calc from %s calc max(angdist (DELAY_DIR[0,], [%s]))" % (fieldtable, ", ".join(",".join(src) for src in ATEAM))  )
        return taqloutput[0]

    def field_size_nominal(table, wavelength, diameter):
        if not diameter:
            diameter = get_station_diameter(table)
        logger.debug("Station diameter %f m" % diameter)
        return 1.22*wavelength/diameter

    t = pt.table(msname, readonly=True, ack=False)
    interval = t.getcell('INTERVAL', 0)
    swtable = t.getkeyword('SPECTRAL_WINDOW')
    tsw = pt.table(swtable, readonly=True, ack=False)
    freq = tsw.getcell('REF_FREQUENCY', 0)
    wavelength = 299792458./freq
    maxbl = pt.taql("calc sqrt(max([select sumsqr(UVW[0:1]) from %s]))" % msname)[0] / wavelength
    chwidth = tsw.getcell('CHAN_WIDTH', 0)[0]

    if ateam:
        fieldsize = field_size_ateam(t)
    else:
        fieldsize = field_size_nominal(t, wavelength, diameter)

    logger.debug('Frequency is %f MHz'%(freq/1.e6))
    logger.debug('Wavelength is %f m'%(wavelength))
    logger.debug('Maximum baseline length is %f m = %f lambdas'%(maxbl*wavelength,maxbl))
    logger.debug('Integration time is %f sec'%(interval))
    logger.debug('Channel width is %f Hz'%(chwidth))
    logger.debug('Field size is %f degrees'%(fieldsize*180./3.14159))

    return fieldsize, maxbl, freq, interval, chwidth
开发者ID:revoltek,项目名称:scripts,代码行数:57,代码来源:smearing_ms.py


示例15: rename2

def rename2(SB, obsid):
	SBtable=pt.table("{0}/OBSERVATION".format(SB), ack=False)
	beam=int(SBtable.col("LOFAR_SUB_ARRAY_POINTING")[0])
	SBtable.close()
	SBtable=pt.table("{0}/SPECTRAL_WINDOW".format(SB), ack=False)
	sbno=int(SBtable.col("NAME")[0].split("-")[-1])
	SBtable.close()
	newname="{0}_SAP{1:03d}_SB{2:03d}_uv.MS.dppp".format(obsid,beam,sbno)
	return newname
开发者ID:ajstewart,项目名称:rsmpp-old,代码行数:9,代码来源:rsmpp-rename.py


示例16: ms

def ms (msname="$MS",subtable=None,write=False):
  """Opens the MS or a subtable (read-only by default), returns table object."""
  msname = interpolate_locals("msname");
  if not msname:
    raise ValueError("'msname' or global MS variable must be set");
  if subtable:
    msname = table(msname,ack=False).getkeyword(subtable);
  tab = table(msname,readonly=not write,ack=False);
  return tab;
开发者ID:SpheMakh,项目名称:pyxis,代码行数:9,代码来源:ms.py


示例17: compareColumn

    def compareColumn(self, columnname, taql=False):
        if self.verbose:
            print "Comparing "+  bcolors.OKBLUE + columnname + bcolors.ENDC + " columns." # DEBUG

        passed=False
        errorcount=0                                # counter that counts rows with differying columns

        if taql==False:                             # If taql is not to be used for comparison, use numpy difference
          if self.debug:
            print "compareColumn() using numpy" 

          reftab=pt.table(self.MS)                # Open reference MS in readonly mode
          testtab=pt.table(self.test_MS)          # Open test MS in readonly mode     
     
          tc_ref=reftab.col(columnname)           # get column in reference table as numpy array
          tc_test=testtab.col(columnname)         # get column in test table as numpy array
  
          nrows=testtab.nrows()                  
          for i in progressbar( range(0, nrows-1), "comparing " + columnname + " ", 60):
              difference = numpy.max(abs(tc_test[i] - tc_ref[i]))    # Use numpy's ability to substract arrays from each other
              #sum=numpy.sum(difference)
              
              #if sum > (self.acceptancelimit/len(difference)):     # determine if this failed the test
              if difference > self.acceptancelimit:                 # determine if this failed the test
                  passed=False
              else:
                  passed=True
  
          reftab.close()
          testtab.close()
        else:
            if self.debug:
              print "compareColumn() using TaQL"          # DEBUG
  
            self.addRefColumnToTesttab(columnname)      # add reference table column as forward column
        
            testcolumnname = "test_" + columnname       # create name which is used in test_MS if refcolum was added
        
            # Loop over columns, compute and check difference (must be within self.acceptancelimit)            
            # use TaQL for this? How to select from two tables? TODO: check this!
            
#            taqlcmd = "SELECT * FROM '" + self.test_MS + "' WHERE !all(NEAR(Real("+columnname+"), Real("+testcolumnname+")) AND NEAR(Imag("+columnname+"), Imag("+testcolumnname+")))"
#            errorcount = result.nrows()
            taqlcmd = "SELECT * FROM '" + self.test_MS + "' WHERE !all(NEARABS(Real("+columnname+"), Real("+testcolumnname+")," + str(self.acceptancelimit) + ") AND NEARABS(Imag("+columnname+"), Imag("+testcolumnname+"),"+ str(self.acceptancelimit) +"))"
#            print "taqlcmd = ", taqlcmd     # DEBUG
            errorcount=pt.taql(taqlcmd).nrows()            
            
            if self.verbose or self.debug:
              print "errorcount = ", errorcount         # display number of errors=No. of rows

            # If test_MS COLUMN and reference COLUMN have any discrepancy...            
            if errorcount > 0:
                passed=False      # ... the test is failed
            else:
                passed=True
        return passed
开发者ID:jjdmol,项目名称:LOFAR,代码行数:56,代码来源:testsip.py


示例18: updatehistory

def updatehistory(outms):
  """
  Update history to show that this script has modified original data
  """
  tc = pt.table(outms,readonly=False)
  th = pt.table(tc.getkeyword('HISTORY'), readonly=False, ack=False)
  nr=th.nrows()
  th.addrows(1)
  tr=th.row()
  tr.put(nr,{'TIME': quantity('today').get('s').get_value(), 'OBSERVATION_ID':0,'MESSAGE': ' ', 'PRIORITY': ' ', 'ORIGIN': ' ','OBJECT_ID':0, 'APPLICATION':'mslin2circ','CLI_COMMAND':[''],'APP_PARAMS': ['']})
开发者ID:revoltek,项目名称:scripts,代码行数:10,代码来源:mslin2circ.py


示例19: getantlist

 def getantlist(self):
         print 'Listing antennas in MS '+self.inputEntry.get()+'\n'
         ttmp = pt.table(self.inputEntry.get(),readonly=True,ack=False)
         tant = pt.table(ttmp.getkeyword('ANTENNA'),readonly=True,ack=False)
         antlist = tant.getcol('NAME')
         self.antList.delete(0,END)
         ninserted = 0
         for ant in antlist:
                 self.antList.insert(END, ant)
                 self.antList.selection_set(ninserted)
                 ninserted += 1
开发者ID:carosko,项目名称:LOFAR-Contributions,代码行数:11,代码来源:uvplot.py


示例20: updateObsTable

def updateObsTable (image, msName, minbl, maxbl, aswvl,
                    usedCounts, visCounts, minTime, maxTime, totTime):
    obstab = pt.table (image.name() + "/LOFAR_OBSERVATION", readonly=False,
                       ack=False)
    oritab = pt.table (image.name() + "/LOFAR_ORIGIN", ack=False)
    minfreq = pt.taql ("calc min([select FREQUENCY_MIN from '" +
                       oritab.name() + "'])")
    maxfreq = pt.taql ("calc max([select FREQUENCY_MAX from '" +
                       oritab.name() + "'])") 
    obstab.putcell ("OBSERVATION_FREQUENCY_MIN", 0, minfreq[0]);
    obstab.putcell ("OBSERVATION_FREQUENCY_MAX", 0, maxfreq[0]);
    obstab.putcell ("OBSERVATION_FREQUENCY_CENTER", 0, (minfreq[0]+maxfreq[0])/2);
    obstab.putcell ("OBSERVATION_INTEGRATION_TIME", 0, totTime);
    obstab.putcell ("OBSERVATION_START", 0, minTime);
    obstab.putcell ("OBSERVATION_END", 0, maxTime);
    obstab.putcell ("TIME_RANGE", 0, (minTime, maxTime));
    obstab.putcell ("FILENAME", 0, os.path.basename(image.name()))
    obstab.putcell ("FILETYPE", 0, "sky")
    pt.taql ("update '" + obstab.name() + "' set FILEDATE = mjd(date()), " +
             "RELEASE_DATE = mjd(date()+365)")
    # Determine minimum and maximum baseline length
    # If needed, convert from wavelengths to meters.
    mstab = pt.table(msName, ack=False)
    if aswvl:
        minbl *= 2.99792e8 / maxfreq[0]
        maxbl *= 2.99792e8 / minfreq[0]
    if minbl <= 0:
        mbl = pt.taql ("calc sqrt(min([select sumsqr(UVW[:2]) from " + msName + "]))")
        minbl = max(mbl[0], abs(minbl))
    if maxbl <= 0:
        mbl = pt.taql ("calc sqrt(max([select sumsqr(UVW[:2]) from " + msName + "]))")
        if maxbl == 0:
            maxbl = mbl[0]
        else:
            maxbl = min(mbl[0], abs(maxbl))
    mstab.close()
    # Add and fill a few extra columns.
    col1 = pt.makescacoldesc ("MIN_BASELINE_LENGTH", 0, valuetype='double')
    col2 = pt.makescacoldesc ("MAX_BASELINE_LENGTH", 0, valuetype='double')
    col3 = pt.makearrcoldesc ("NVIS_USED", 0, valuetype='int')
    col4 = pt.makearrcoldesc ("NVIS_TOTAL", 0, valuetype='int')
    obstab.addcols (pt.maketabdesc ([col1, col2, col3, col4]))
    obstab.putcolkeyword ("MIN_BASELINE_LENGTH", "QuantumUnits", ["m"])
    obstab.putcolkeyword ("MAX_BASELINE_LENGTH", "QuantumUnits", ["m"])
    obstab.putcell ("MIN_BASELINE_LENGTH", 0, minbl)
    obstab.putcell ("MAX_BASELINE_LENGTH", 0, maxbl)
    # Get sum for all MSs.
    tusedCounts = usedCounts.sum (axis=0)
    tvisCounts  =  visCounts.sum (axis=0)
    obstab.putcell ("NVIS_USED", 0, tusedCounts)
    obstab.putcell ("NVIS_TOTAL", 0, tvisCounts)
    obstab.close()
    oritab.close()
    print "Updated subtable LOFAR_OBSERVATION"
开发者ID:jjdmol,项目名称:LOFAR,代码行数:54,代码来源:addImagingInfo.py



注:本文中的pyrap.tables.table函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tables.taql函数代码示例发布时间:2022-05-27
下一篇:
Python quanta.quantity函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap