pvslice1 = (slice1, 0) corr1 = a.addtask(admit.PVCorr_AT(), [pvslice1, csttab1]) pvcorr1 = (corr1, 0) #----------- Workaround because ALMA data don't include VLSR in header ----------------- # Need to run now, since LineID_AT needs the vlsr a.run() a.write() source = a.summaryData.get('object')[0].getValue()[0] vlsr = get_vlsr(source, vlsr) print "OBJECT = %s VLSR = ", (source, vlsr) #--------------------------------------------------------------------------------------- # LineID uses integer segment=<STRING>: pick ASAP or ADMIT lineid1 = a.addtask(admit.LineID_AT(vlsr=vlsr, segment="ADMIT"), [csptab1, csttab1, pvcorr1]) lltab1 = (lineid1, 0) # LineCube linecube1 = a.addtask(admit.LineCube_AT(), [bandcube1, lltab1]) a[linecube1].setkey('grow', 10) # +growth # RUN_1: now we need to run the flow, since we need to # know the number of Lines found and produce the linecubes # for the next for-loop. a.run() a.write() nlines = len(a[linecube1]) print "Found %d lines during runtime" % nlines
pb=pbcorfile, box=KEYS["box"]))) Tasks.append(p.addtask(admit.CubeStats_AT(alias='instats'), ['incube'])) Tasks.append( p.addtask(admit.CubeSum_AT(sigma=1, numsigma=3.0, alias='insum'), ['incube', 'instats'])) Tasks.append( p.addtask(admit.CubeSpectrum_AT(alias='spec1'), ['incube', 'insum'])) Tasks.append( p.addtask(admit.PVSlice_AT(alias="cubepv", width=KEYS["width"]), ['incube', 'insum'])) Tasks.append( p.addtask( admit.LineID_AT(csub=[1, 1], minchan=KEYS["minchan"], numsigma=KEYS["numsigma"], alias='lines'), ['instats', 'spec1'])) Tasks.append( p.addtask(admit.LineCube_AT(alias='cutcubes', pad=KEYS["pad"]), ['incube', 'lines'])) Tasks.append( p.addtask( admit.Moment_AT(alias='linemom', mom0clip=3.0, numsigma=KEYS["cutoff"], moments=[0, 1, 2]), ['cutcubes', 'instats'])) Tasks.append( p.addtask(admit.CubeSpectrum_AT(alias='linespec'), ['cutcubes', 'linemom'])) # 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
a = admit.Project(projdir, name='Testing LineID', create=True, loglevel=loglevel) # Default ADMIT plotting environment a.plotparams(plotmode, plottype) for i in range(len(transitions)): spec = a.addtask( admit.GenerateSpectrum_AT(seed=seed[i], nchan=nchan[i], contin=contin[i], delta=delta[i], freq=freq[i], transitions=transitions[i], alias="test_%i" % (i))) bdp_in = [(spec, 0)] lineid1 = a.addtask( admit.LineID_AT(vlsr=0.0, segment="ADMIT", csub=[1, 1]), bdp_in) a[lineid1].setkey('numsigma', 2.0) a[lineid1].setkey('minchan', 5) a[lineid1].setkey('maxgap', 3) # 20 for the SB outflows print "################## RUNNING TRANSITION %d ######################### " % i # keep run() inside loop so that failures won't # prevent us seeing output from previous tasks in the flow a.run() # note: explicit call to a.updateHTML() is not needed -- a.run() already calls it.
# 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. # # Add spectral line processing to flow if KEYS["specpb"] == None: Tasks.append(p.addtask(admit.Ingest_AT(file=cubefile, alias='incube'))) else: Tasks.append(p.addtask(admit.Ingest_AT(file=cubefile, alias='incube', pb=KEYS["specpb"]))) Tasks.append(p.addtask(admit.CubeStats_AT (alias='instats'), ['incube'])) Tasks.append(p.addtask(admit.CubeSum_AT (alias='insum', sigma=1, numsigma=3.0), ['incube', 'instats'])) Tasks.append(p.addtask(admit.CubeSpectrum_AT (alias='spec1'), ['incube', 'insum'])) Tasks.append(p.addtask(admit.PVSlice_AT ( width=KEYS["width"]), ['incube', 'insum'])) Tasks.append(p.addtask(admit.LineID_AT (alias='lines', csub=[0,0], minchan=KEYS["minchan"], numsigma=KEYS["numsigma"]), ['instats','spec1'])) Tasks.append(p.addtask(admit.LineCube_AT (alias='cutcubes', pad=KEYS["pad"]), ['incube', 'lines'])) Tasks.append(p.addtask(admit.Moment_AT (alias='linemom', mom0clip=2.0, numsigma=KEYS["cutoff"], moments=[0, 1, 2]), ['cutcubes', 'instats'])) Tasks.append(p.addtask(admit.CubeSpectrum_AT (alias='linespec'), ['cutcubes', 'linemom'])) # 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:
pvcorr1 = (corr1, 0) if stop == 'pvcorr': a.exit(1) a.run() source = a.summaryData.get('object')[0].getValue()[0] print "OBJECT = ", source # lineID bdp_in = [] if linebdp[0]: bdp_in.append(csptab1) if linebdp[1]: bdp_in.append(csttab1) if linebdp[2]: bdp_in.append(pvcorr1) if vlsr == None: # let vlsr be inherited by the Summary lineid1 = a.addtask(admit.LineID_AT(), bdp_in) else: # @todo problem: vlsr is also in the Summary, and can be different from this vlsr lineid1 = a.addtask(admit.LineID_AT(vlsr=vlsr), bdp_in) # hidden!! #a[lineid1].boxcar = False # if lineUID: a[lineid1].setkey('identifylines', False) #a[lineid1].setkey('recomblevel','OFF') #a[lineid1].setkey('recomblevel','DEEP') if len(linepar) > 0: a[lineid1].setkey('numsigma', linepar[0]) # 5.0 a[lineid1].setkey('minchan', linepar[1]) # 4 a[lineid1].setkey('maxgap', linepar[2]) # 3
# LineSegment ls1 = a.addtask(admit.LineSegment_AT(),[gstab1]) if len(linepar) > 0: a[ls1].setkey('numsigma',linepar[0]) a[ls1].setkey('minchan', linepar[1]) a[ls1].setkey('maxgap', linepar[2]) a[ls1].setkey('csub',[0,csub]) a[ls1].setkey('iterate',iterate) a[ls1].setkey('smooth',llsmooth) lstab1 = (ls1,0) if stop == 'segment': a.exit(1) # LineID ll1 = a.addtask(admit.LineID_AT(),[gstab1]) if len(linepar) > 0: a[ll1].setkey('numsigma',linepar[0]) a[ll1].setkey('minchan', linepar[1]) a[ll1].setkey('maxgap', linepar[2]) if lineUID: a[ll1].setkey('identifylines',False) a[ll1].setkey('csub',[0,csub]) a[ll1].setkey('iterate',iterate) a[ll1].setkey('smooth',llsmooth) a[ll1].setkey('vlsr',vlsr) a[ll1].setkey('references',reflist) a[ll1].setkey('online',online) a[ll1].setkey('tier1width',tier1width) lltab1 = (ll1,0)
project = os.getenv('PROJECT') if project is None: raise ValueError else: print(f"Project -> {project}") basefn = os.path.basename(project).replace(".image", "") print(f"basefn = {basefn}") p = admit.Project(f'{basefn}.admit', dataserver=True) # Flow tasks. t0 = p.addtask(admit.Ingest_AT(file=basefn + '.image')) t1 = p.addtask(admit.CubeStats_AT(ppp=True), [t0]) t2 = p.addtask(admit.CubeSum_AT(numsigma=5.0, sigma=99.0), [t0, t1]) t3 = p.addtask(admit.CubeSpectrum_AT(), [t0, t2]) t4 = p.addtask( admit.LineSegment_AT(csub=[0, 0], minchan=4, maxgap=6, numsigma=5.0), [t1, t3]) t5 = p.addtask(admit.ContinuumSub_AT(fitorder=1, pad=60), [t0, t4]) t6 = p.addtask(admit.CubeStats_AT(ppp=True), [t5]) t7 = p.addtask(admit.CubeSpectrum_AT(), [t5, t6]) t8 = p.addtask(admit.Moment_AT(mom0clip=2.0, numsigma=[3.0]), [t5, t6]) t9 = p.addtask(admit.LineID_AT(csub=[0, 0], minchan=4, maxgap=6, numsigma=5.0), [t6, t7]) t10 = p.addtask(admit.LineCube_AT(pad=40), [t5, t9]) t11 = p.addtask(admit.Moment_AT(mom0clip=2.0, moments=[0, 1, 2]), [t10, t6]) t11 = p.addtask(admit.CubeSpectrum_AT(), [t10, t11]) p.run() print(f"Done running ADMIT for {basefn} <-> {project}")