Ejemplo n.º 1
0
# ingest-cont:  only used for source finding for CubeSpectrum, this map is not used
#               to subtract the continuum, since there is no guarentee about the
#               resolution ('cont' maps usually mismatch, 'mfs' maps are ok but not
#               part of the ALMA pipeline
if cont != '':
    # @todo   note we don't have an option here to do pb?
    ingest2 = a.addtask(
        admit.Ingest_AT(file=cont, basename=basename, alias='sfcont'))
    contmap = (ingest2, 0)
    a.run()
    #
    cubestats2 = a.addtask(admit.CubeStats_AT(), [contmap])
    #a[cubestats1].setkey('robust',robust)
    csttab2 = (cubestats2, 0)
    sfind2 = a.addtask(admit.SFind2D_AT(), [contmap, csttab2])
    cslist = (sfind2, 0)
    a.run()
    ncs = len(a[cslist[0]][0])
    print "N Cont sources in ingested contmap :", ncs
    if ncs == 0:
        cslist = ()
else:
    cslist = ()

# cubestats
cubestats1 = a.addtask(admit.CubeStats_AT(), [bandcube1])
a[cubestats1].setkey('robust', robust)
a[cubestats1].setkey('ppp', usePPP)
a[cubestats1].setkey('psample', psample)
csttab1 = (cubestats1, 0)
Ejemplo n.º 2
0
    # While 'linemom' produces 3 moment image BDPs, the default input is taken 
    # here, which is the first BDP which is the zeroth moment.  This relies on
    # Moment_AT's default behavior of putting the zeroth moment in the 
    # BDP index 0.
    Tasks.append(p.addtask(admit.PVSlice_AT        (                  width=KEYS["width"]),                                            ['cutcubes', 'linemom']))


    # If given, add continuum map processing to flow
    if contfile != None:
        if KEYS["contpb"] == None:
            Tasks.append(p.addtask(admit.Ingest_AT (alias='incont',     file=contfile)))
        else:
            Tasks.append(p.addtask(admit.Ingest_AT (alias='incont',     file=contfile, pb=KEYS["contpb"])))

        Tasks.append(p.addtask(admit.CubeStats_AT  (alias='contstats'),                                                                ['incont']))
        Tasks.append(p.addtask(admit.SFind2D_AT    (alias='contsfind'),                                                                ['incont','contstats']))

        # Only add this CubeSpectrum_at to flow if SFind2D found at least one source.
        # This can only be known by running up the flow to now.
        p.run()

        if p['contsfind'][0] != None and len(p['contsfind'][0]) > 0:
            Tasks.append(p.addtask(admit.CubeSpectrum_AT (alias='contspec'),                                                           ['cutcubes','contsfind']))

    #
    #  Execute ADMIT flow
    #
    p.run()

if __name__ == "__main__":
Ejemplo n.º 3
0
    # or do LineID with bandcube2, but make linecube's from bandcube1
    bandcube1 = bandcube2
    
    if stop == 'smooth':  a.exit(1)

# CubeStats - will also do log(Noise),log(Peak) plot
cubestats1 = a.addtask(admit.CubeStats_AT(), [bandcube1])
a[cubestats1].setkey('robust',robust)
a[cubestats1].setkey('ppp',False)
csttab1 = (cubestats1,0)

if stop == 'cubestats':  a.exit(1)

#sfind1 = a.addtask(admit.SFind2D_AT(), [bandcube1])
#NEW:
sfind1 = a.addtask(admit.SFind2D_AT(), [bandcube1,pbmap1,csttab1])
#OLD
#sfind1 = a.addtask(admit.SFind2D_AT(), [bandcube1,csttab1])
#a[sfind1].setkey('numsigma',6.0)
#a[sfind1].setkey('sigma',-1.0)
#a[sfind1].setkey('robust',())
#a[sfind1].setkey('robust',('classic','auto'))
#a[sfind1].setkey('robust',('hin',1.5))
#a[sfind1].setkey('robust',('chau',-1.0))
#a[sfind1].setkey('robust',('fit-half','zero'))      # bug
#a[sfind1].setkey('snmax',40.0)

# finish off !
a.run()

a.showsetkey(adir+'/admit.apar')
Ejemplo n.º 4
0
    # in this model, it would be better to use insmooth= for Ingest_AT, it doesn't
    # need the extra space to hold bandcube1
    #
    # Another model could be to have two flows in this script, up to LineID,
    # one with each (or more) smoothing factor and decide which one to continue with
    # or do LineID with bandcube2, but make linecube's from bandcube1
    bandcube1 = bandcube2

# If a continuum image was given, set up to ingest it and run
# source-find on it.
if cont != '':
    ingest2 = a.addtask(admit.Ingest_AT(file=cont, alias=alias + '-cont'))
    contmap = (ingest2, 0)
    cubestats2 = a.addtask(admit.CubeStats_AT(), [contmap])
    csttab2 = (cubestats2, 0)
    sfind2 = a.addtask(admit.SFind2D_AT(), [contmap, csttab2])
    cslist = (sfind2, 0)
else:
    cslist = ()

# CubeStats - will also do log(Noise),log(Peak) plot
cubestats1 = a.addtask(admit.CubeStats_AT(), [bandcube1])
a[cubestats1].setkey('robust', robust)
a[cubestats1].setkey('ppp', usePPP)
csttab1 = (cubestats1, 0)

# CubeSum
moment1 = a.addtask(admit.CubeSum_AT(), [bandcube1, csttab1])
a[moment1].setkey('numsigma', 4.0)  # Nsigma clip in cube
# >0 force single cuberms sigma from cubestats; <0 would use rms(freq) table
a[moment1].setkey('sigma', 99.0)
Ejemplo n.º 5
0
    try:
        KEYS["numsigma"] = float(KEYS["numsigma"])
        KEYS["snmax"]   = float(KEYS["snmax"])
    except Exception, e:
        print("Exception converting keyword value to number:",e)
        return
    #
    # Set-up all ADMIT Flow tasks for execution including their aliases and connections
    # The aliases allow you to refer to a task's input by the alias name of the (previous) 
    # task providing that input.
    #
    if pbcorfile == None:
        Task0  = p.addtask(admit.Ingest_AT(alias='inimage',file=imagefile))
    else:
        Task0  = p.addtask(admit.Ingest_AT( alias='inimage', file=imagefile, pb=pbcorfile ))
    Task1  = p.addtask(admit.CubeStats_AT(alias='instats'), ['inimage'])
    Task2  = p.addtask(admit.SFind2D_AT(alias='srcfind',numsigma=KEYS["numsigma"], snmax=KEYS["snmax"]), ['inimage', 'instats'])
    #
    #  Execute ADMIT flow
    #
    p.run()

if __name__ == "__main__":

    # Command line processing to pick-up file name and define
    #        ADMIT directory that you will be creating
    argv = admit.utils.casa_argv(sys.argv)

    # now do the work
    _run(argv)