当前位置: 首页>>代码示例>>Python>>正文


Python AIPSTask.baddisk[1]方法代码示例

本文整理汇总了Python中AIPSTask.AIPSTask.baddisk[1]方法的典型用法代码示例。如果您正苦于以下问题:Python AIPSTask.baddisk[1]方法的具体用法?Python AIPSTask.baddisk[1]怎么用?Python AIPSTask.baddisk[1]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AIPSTask.AIPSTask的用法示例。


在下文中一共展示了AIPSTask.baddisk[1]方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: time_sort_data

# 需要导入模块: from AIPSTask import AIPSTask [as 别名]
# 或者: from AIPSTask.AIPSTask import baddisk[1] [as 别名]
def time_sort_data():
    """Time-sort data in AIPS with the UVSRT task."""

    print_header("Time-sorting data")

    uvsrt = AIPSTask('uvsrt')
    uvsrt.userno = AIPS.userno

    # -------------------------------------------------------------------------
    #    UVSRT the data
    # -------------------------------------------------------------------------

    # sort data to prevent down stream problems
    uvsrt.indisk = uvsrt.outdisk = DISK_ID
    uvsrt.baddisk[1] = BADDISK
    uvsrt.outcl = 'UVSRT'
    uvsrt.sort = 'TB'
    last = cat.last_entry()
    uvsrt.inname = last.name
    uvsrt.inclass = last.klass
    uvsrt.inseq = last.seq

    # will write to entry 1 because input sdf/uv files were removed
    uvsrt.go()

    nfiles = len(cat)

    for dbcon_entry in range(nfiles-1):
        cat.zap_entry(-1)  # remove the DBCON entries
开发者ID:nrao,项目名称:gbt-pipeline,代码行数:31,代码来源:load.py

示例2: remove_continuum

# 需要导入模块: from AIPSTask import AIPSTask [as 别名]
# 或者: from AIPSTask.AIPSTask import baddisk[1] [as 别名]
def remove_continuum(outseq):
    trans = AIPSTask("trans")
    imlin = AIPSTask("imlin")

    entry = cat.get_entry(1)  # get SDGRD entry
    img = cat.get_image(entry)
    nChan = round(img.header.naxis[2])

    # transpose image in order to run IMLIN
    trans.indisk = DISK_ID
    trans.outdisk = DISK_ID
    trans.baddisk[1] = BADDISK
    trans.inname = entry.name
    trans.inclass = "SDGRD"
    trans.inseq = outseq
    trans.transc = "312"
    trans.outcl = "trans"
    trans.go()

    # Run imlin task on trans file
    # remove a spectral baseline.  Output image is in Freq-RA-Dec order
    # (Transcod 312)
    imlin.indisk = DISK_ID
    imlin.outdisk = DISK_ID
    imlin.outcl = "IMLIN"
    last = cat.last_entry()
    imlin.inname = last.name
    imlin.inclass = last.klass
    imlin.inseq = last.seq
    imlin.nbox = 2
    # use only the end channels for the default baseline fits
    imlin.box[1][1] = round(nChan * 0.04)  # 4-12%
    imlin.box[1][2] = round(nChan * 0.12)
    imlin.box[1][3] = round(nChan * 0.81)  # 82-89%
    imlin.box[1][4] = round(nChan * 0.89)

    imlin.order = 0  # polynomial order
    print "IMLIN box", imlin.box
    imlin.go()

    # Run transpose again task on sdgrd file produced by IMLIN
    last = cat.last_entry()
    trans.inname = last.name
    trans.inclass = last.klass
    trans.inseq = last.seq
    trans.transc = "231"
    trans.outdi = DISK_ID
    trans.outcl = "baseli"
    trans.go()
开发者ID:nrao,项目名称:gbt-pipeline,代码行数:51,代码来源:image.py

示例3: round

# 需要导入模块: from AIPSTask import AIPSTask [as 别名]
# 或者: from AIPSTask.AIPSTask import baddisk[1] [as 别名]
avspc.channel=nAverage
avspc.ichansel[1][1] = 1
avspc.ichansel[2][1] = nChan
avspc.ichansel[3][1] = 1
avspc.avoption='SUBS'
avspc.go()

#now have fewer channels, with broader frequencies
nChan = round(nChan/nAverage)
dNu = nAverage*dNu
refChan = refChan/nAverage

# Now make an image using the last entry in the catalog
sdgrd.indisk=mydisk
sdgrd.outdisk=mydisk
sdgrd.baddisk[1]=baddisk
sdgrd.inname=AIPSCat()[mydisk][-1].name
sdgrd.inclass=AIPSCat()[mydisk][-1].klass
sdgrd.inseq=AIPSCat()[mydisk][-1].seq
sdgrd.optype='-GLS'
sdgrd.reweight[1] = 0
sdgrd.reweight[2] = -1.E-6
# must break up RA into hours minutes seconds
sdgrd.aparm[1]=math.floor(raDeg/15.)
sdgrd.aparm[2]=math.floor(((raDeg/15.)-sdgrd.aparm[1])*60.)
sdgrd.aparm[3]=round(((((raDeg/15.)-sdgrd.aparm[1])*60.)-sdgrd.aparm[2])*60.)
#now break up degrees, but must preserve sign
decSign = 1.
if decDeg < 0.:
    decSign = -1.
    decDeg = -1. * decDeg
开发者ID:jfoster17,项目名称:gbt-pipeline,代码行数:33,代码来源:mapNH3-50.py

示例4: make_cube

# 需要导入模块: from AIPSTask import AIPSTask [as 别名]
# 或者: from AIPSTask.AIPSTask import baddisk[1] [as 别名]
def make_cube(args):

    print_header("Making image cube")

    average_channels(args.average)

    sdgrd = AIPSTask("sdgrd")

    # Now make an image using the last entry in the catalog
    sdgrd.indisk = DISK_ID
    sdgrd.outdisk = DISK_ID
    sdgrd.baddisk[1] = BADDISK
    last = cat.last_entry()
    sdgrd.inname = last.name
    sdgrd.inclass = last.klass
    sdgrd.inseq = last.seq
    sdgrd.optype = "-GLS"
    sdgrd.reweight[1] = 0

    spectra = cat.get_uv(last)
    if "center" in args and args.center:
        raDeg, decDeg = args.center
    else:
        raDeg, decDeg = spectra.header.crval[3], spectra.header.crval[4]

    # must break up RA into hours minutes seconds
    hh, mm, ss = ra_deg2hms(raDeg)
    sdgrd.aparm[1] = hh
    sdgrd.aparm[2] = mm
    sdgrd.aparm[3] = ss

    # now break up degrees, but must preserve sign
    decSign = 1
    if decDeg < 0:
        decSign = -1
        decDeg = -1 * decDeg

    hh, mm, ss = dec_deg2hms(decDeg)
    sdgrd.aparm[4] = hh
    sdgrd.aparm[5] = mm
    sdgrd.aparm[6] = ss

    # deal with degrees and/or minutes == 0
    if decSign < 0.0:
        sdgrd.aparm[4] = -1 * sdgrd.aparm[4]
        if sdgrd.aparm[4] == 0:
            sdgrd.aparm[5] = -1 * sdgrd.aparm[5]
            if sdgrd.aparm[5] == 0:
                sdgrd.aparm[6] = -1 * sdgrd.aparm[6]

    print raDeg, decDeg, "->", sdgrd.aparm[1:7]

    # transfer cellsize
    cellsize = round(spectra.header.cdelt[4] * 3600.0)
    sdgrd.cellsize[1] = sdgrd.cellsize[2] = cellsize

    # sdgrd.xtype=-16         # sync/bessel convolving type
    sdgrd.xtype = -12  # gaussian convolving type

    # sync/bessel function parameters
    if sdgrd.xtype == -16:
        sdgrd.xparm[1] = 3.0 * cellsize
        sdgrd.xparm[2] = 2.5 * cellsize
        sdgrd.xparm[3] = 1.5 * cellsize
        sdgrd.xparm[4] = 2
        sdgrd.reweight[2] = 0.01

    # gaussian parameters
    if sdgrd.xtype == -12:
        sdgrd.xparm[1] = 5.0 * cellsize
        sdgrd.xparm[2] = 1.5 * cellsize  # Parameter sets Gaussian FWHM
        sdgrd.xparm[3] = 2
        sdgrd.xparm[4] = 0
        sdgrd.reweight[2] = -1.0e-6

    # always make a circuluar convolving function
    sdgrd.ytype = sdgrd.xtype

    if "size" in args and args.size:
        imxSize, imySize = args.size
    else:
        imxSize = (2 * round(spectra.header.crpix[3] / 1.95)) + 20
        imySize = (2 * round(spectra.header.crpix[4] / 1.95)) + 20

    print "Ra, Dec          : {0}, {1}".format(raDeg, decDeg)
    print "Image size (X,Y) : {0}, {1}".format(imxSize, imySize)
    print "Cell size        : {0}".format(cellsize)

    sdgrd.imsize[1] = imxSize
    sdgrd.imsize[2] = imySize
    sdgrd.go()

    seqno, restFreqHz = update_header(args)
    outcube = write_image_cube(restFreqHz, args.uniqueid)

    return seqno, restFreqHz, outcube
开发者ID:nrao,项目名称:gbt-pipeline,代码行数:98,代码来源:image.py

示例5: dbcon

# 需要导入模块: from AIPSTask import AIPSTask [as 别名]
# 或者: from AIPSTask.AIPSTask import baddisk[1] [as 别名]

#.........这里部分代码省略.........
            for iii in range(0,nObjects):
                if (allObjects[iii] == spectra.header.object):
                    notFound = False
            # if not in the list add to list and increment count
            if (notFound):
                allObjects[nObjects] = spectra.header.object
                nObjects = nObjects+1
            spectra.zap()
    
    #print nObjects,' Object(s) Observed: ', allObjects
    objectName = allObjects[0]
    for iii in range(1,nObjects):
        if len(allObjects[iii]) > 0:
            objectName = objectName + '+' + allObjects[iii]
    
    print nObjects,' Object(s) Observed: ', objectName
    
    if nObjects > 2:
        objectName = allObjects[0] + '+' + str( nObjects-1)
    
    # Extract the observations summary
    spectra = AIPSUVData(AIPSCat()[mydisk][-1].name, AIPSCat()[mydisk][-1].klass, mydisk, AIPSCat()[mydisk][-1].seq)
    
    # Read parameters passed inside the spectra data header
    nChan    = round(spectra.header.naxis[2])
    cellsize = round(spectra.header.cdelt[4] * 3600.)
    refChan  = spectra.header.crpix[2]
    imxSize  = 2*round(spectra.header.crpix[3]/1.5 )
    imySize  = 2*round(spectra.header.crpix[4]/1.5 )
    raDeg    = spectra.header.crval[3]
    decDeg   = spectra.header.crval[4]
    nuRef    = spectra.header.crval[2]
    dNu      = spectra.header.cdelt[2]
    
    print "Ra,Dec:", raDeg, decDeg, "Image:", imxSize, imySize, cellsize, 
    #print spectra.header
    
    #now free up slot 0
    image = WizAIPSImage(AIPSCat()[mydisk][0].name, \
                         AIPSCat()[mydisk][0].klass, \
                         mydisk, AIPSCat()[mydisk][0].seq)
    image.zap()
    
    # sort data to prevent down stream probelms
    uvsrt.indisk=mydisk
    uvsrt.outdisk=mydisk
    uvsrt.baddisk[1]=baddisk
    uvsrt.outcl='UVSRT'
    uvsrt.sort='TB'
    uvsrt.inname=AIPSCat()[mydisk][-1].name
    if kount < 2:
        uvsrt.inclass=AIPSCat()[mydisk][-1].klass
        uvsrt.inseq=kount    
    else:
        uvsrt.inclass='DBCON'
        uvsrt.inseq=kount - 1
    uvsrt.go()
    
    # now clean up the last of the input files
    spectra.zap()
    
    ## and write the last thing now in the catalog to disk
    fittp.indisk=mydisk
    fittp.inname=AIPSCat()[mydisk][-1].name
    fittp.inclass=AIPSCat()[mydisk][-1].klass
    fittp.inseq=AIPSCat()[mydisk][-1].seq
    outName = os.path.splitext(sdf_files[0])[0]
    # Trim out the source name
    iUnder = outName.find("_")
    if iUnder > 0:
        outName = outName[iUnder+1:]
    # Trim out the beam number
    iUnder = outName.find("_")
    if iUnder > 0:
        outName = outName[iUnder+1:]
    # Trim out the first scan number
    iUnder = outName.find("_")
    if iUnder > 0:
        outName = outName[iUnder+1:]
    # Trim out the sampler number
    iUnder = outName.rfind("_")
    if iUnder > 0:
        outName = outName[0:iUnder]
    #Now prepend the objects
    lObjectName = len(objectName)
    if lObjectName > 40:
        objectName = objectName[:40]
    outimage = objectName+'_'+outName+'_dbcon.fits'
    if os.path.exists(outimage):
        os.remove(outimage)
        print 'Removed existing file to make room for new one :',outimage
    
    fittp.dataout='PWD:'+outimage
    fittp.go()

    if keeptempfiles != '1':
        [os.unlink(xx) for xx in sdf_files]
        if os.path.isdir('summary'):
            [os.unlink('summary/'+xx) for xx in os.listdir('summary')]
            os.rmdir('summary')
开发者ID:jfoster17,项目名称:gbt-pipeline,代码行数:104,代码来源:make_sdf_and_dbcon.py


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