Beispiel #1
0
    def runTest(self):
        try:
            # instantiate the class
            a = admit.Project(self.admitDir)
            a.plotparams(admit.PlotControl.BATCH,admit.PlotControl.PNG)

            fitsin = admit.Ingest_AT(file=self.inputFile)
            task0id = a.addtask(fitsin)

            l = admit.LineID_AT()
            task2id = a.addtask(l)
            l._needToSave = True
            ll = admit.LineList_BDP()

#             ll.addRow([115.271,"CO","CO-115.271","Carbon Monoxide","1-0",0.0,0.0,3.2,0.01,1.3,0.0,5.0,15,20,5.2])
#             ll.addRow([115.832,"U", "U-115.832", "", "",0.0,0.0,0.0,0.0,0.0,0.0,0.0,25,35,2.4])

            # keys (column names of LineList_BDP)
            # "frequency", "uid", "formula", "name", "transition", "velocity", 
            # "El", "Eu", "linestrength", "peakintensity", "peakoffset", "fwhm", 
            # "startchan", "endchan", "peakrms", "blend"
            keys = {"frequency":115.271, "uid":"CO","formula":"CO-115.271",
                    "name":"Carbon Monoxide", "transition":"1-0",
                    "velocity":0.0,
                    "linestrength":0.01, "peakintensity":1.3,
                    "peakoffset":0.0, "fwhm":5.0,
                    "peakrms":5.2, "blend":0}

            data = admit.LineData()
            data.setkey(name=keys)
            ll.addRow(data)

            keys = {"frequency":115.832, "uid":"U","formula":"U-115.832",
                    "name":"", "transition":"",
                    "velocity":0.0,
                    "linestrength":0.0, "peakintensity":0.0,
                    "peakoffset":0.0, "fwhm":0.0,
                    "peakrms":2.4, "blend":0}

            data.setkey(name=keys)
            ll.addRow(data)

            l.addoutput(ll)
            l.markUpToDate()

            # instantiate a linecube_AT
            lcube = admit.LineCube_AT()
            task1id = a.addtask(lcube,[(task0id,0),(task2id,0)])

            # check the fm 
            a.fm.verify()

            # run admit 
            a.run()
            a.write()
            # read in the admit.xml and bdp files
            a2 = admit.Project(self.admitDir)

            self.assertEqual(len(a.fm),len(a2.fm))
            for atask in a.fm:
                self.assertEqual(len(a.fm[atask]._bdp_out),
                                 len(a2.fm[atask]._bdp_out))
            self.assertEqual(a.fm._connmap,a2.fm._connmap)
            for at in a.fm:
                for i in range(len(a.fm[at]._bdp_out)) :
                    self.assertEqual( a.fm[at]._bdp_out[i]._taskid,
                                     a2.fm[at]._bdp_out[i]._taskid)
                    self.assertEqual( a.fm[at]._bdp_out[i].xmlFile,
                                     a2.fm[at]._bdp_out[i].xmlFile)
            self.success = "OK"
        except Exception, e:
            m = "exception=%s, file=%s, lineno=%s" % ( sys.exc_info()[0].__name__, os.path.basename(sys.exc_info()[2].tb_frame.f_code.co_filename), sys.exc_info()[2].tb_lineno)
            self.success = "FAILED"
            traceback.print_exc()
            self.fail("%s failed with: %s" % (self.__class__.__name__ , m))
Beispiel #2
0
    t0 = p.addtask(admit.Ingest_AT(file=FITS_CUBE))
    t1 = p.addtask(admit.CubeStats_AT(ppp=True), [t0])
    t2 = p.addtask(admit.Moment_AT(mom0clip=2.0, numsigma=[NUM_SIGMA]),
                   [t0, t1])
    t3 = p.addtask(admit.CubeSpectrum_AT(), [t0, t2])
    t5 = p.addtask(
        admit.LineSegment_AT(maxgap=MAX_CHAN,
                             minchan=MIN_CHAN,
                             numsigma=NUM_SIGMA,
                             csub=[0, 0]), [t1, t3])
    t6 = p.addtask(admit.ContinuumSub_AT(), [t0, t5])
    t7 = p.addtask(admit.CubeStats_AT(ppp=True), [t6])
    t8 = p.addtask(admit.Moment_AT(mom0clip=2.0, numsigma=[NUM_SIGMA]),
                   [t6, t7])
    t9 = p.addtask(admit.CubeSpectrum_AT(), [t6, t8])
    t10 = p.addtask(
        admit.LineID_AT(allowexotics=True,
                        maxgap=MAX_CHAN,
                        minchan=MIN_CHAN,
                        numsigma=NUM_SIGMA,
                        recomblevel='deep',
                        tier1width=10.0,
                        vlsr=VLSR,
                        csub=[0, None]), [t7, t9])
    t11 = p.addtask(admit.LineCube_AT(), [t6, t10])
    t12 = p.addtask(admit.Moment_AT(mom0clip=2.0, moments=[0, 1, 2]),
                    [t11, t7])
    t13 = p.addtask(admit.CubeSpectrum_AT(), [t11, t12])

    p.run()
Beispiel #3
0
proj.addtask(admit.Ingest_AT(file=ifile, alias='cube'))

# Cube manipulation template.
tmpl = proj.addtask(admit.Template_AT(imgslice=550, specpos=(183, 151)),
                    ['cube'])

# Calculate some statistics on the FITS cube (including peak point plot).
cstats = proj.addtask(admit.CubeStats_AT(ppp=True), ['cube'])

# Calculate the moment-0 (integrated intensity) map for the entire cube.
csum = proj.addtask(admit.CubeSum_AT(numsigma=4., sigma=99.), ['cube', cstats])

# Calculate the source spectrum at (by default) the peak position in the cube.
cspect = proj.addtask(admit.CubeSpectrum_AT(), ['cube', csum])

# Identify lines in the cube.
lines = proj.addtask(admit.LineID_AT(numsigma=4.0, minchan=3),
                     [cspect, cstats])

# Cut input cube into line-specific sub-cubes (padding lines by 10 channels).
lcubes = proj.addtask(admit.LineCube_AT(pad=10), ['cube', lines])

# Finally, compute moment-0,1,2 maps and peak position spectrum for each line.
# Since lcubes is variadic, the following tasks will be replicated as needed.
mom = proj.addtask(admit.Moment_AT(moments=[0, 1, 2], mom0clip=2.0),
                   [lcubes, cstats])
csp = proj.addtask(admit.CubeSpectrum_AT(alias='lcs'), [lcubes, mom])

# Run project and save to disk. (Open project index.html to view summary.)
proj.run()
Beispiel #4
0
a.run()

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

nlines = len(a[lltab1[0]][0])
print "Found %d lines in LineID" % nlines

# special case, exit here if you don't want any linecubes
if maxlines == 0:
    print "maxlines=0; no linecube's will be produced - end of admit1"
    a.exit(1)

#
if len(bandcube1_orig) > 0 and not useSmooth: bandcube1 = bandcube1_orig
# LineCube
linecube1 = a.addtask(admit.LineCube_AT(), [bandcube1, lltab1])
a[linecube1].setkey('pad', pad)  # +growth on either side

#a.exit(1)

# 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()

nlines = len(a[linecube1])
print "Found %d lines in LineCube" % nlines

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

x = range(nlines)  # place holder to contain mol/line
Beispiel #5
0
# Flow tasks.
t0 = p.addtask(admit.Ingest_AT(file='concat.spw17.image.fits'))
t1 = p.addtask(admit.CubeStats_AT(), [t0])
t2 = p.addtask(admit.CubeSum_AT(numsigma=5.0, sigma=1.0), [t0, t1])
t3 = p.addtask(admit.CubeSpectrum_AT(alias='spec11'), [t0, t2])
t4 = p.addtask(admit.LineSegment_AT(minchan=4, maxgap=4, numsigma=6.0),
               [t1, t3])
t5 = p.addtask(admit.ContinuumSub_AT(fitorder=1, pad=40), [t0, t4])
t5a = p.addtask(admit.CubeStats_AT(), [t5])
t6 = p.addtask(admit.CubeSpectrum_AT(alias='spec12'), [t5, t2])
t7 = p.addtask(admit.Moment_AT(mom0clip=2.0, numsigma=[3.0]), [t5, t1])
t8 = p.addtask(admit.PVSlice_AT(clip=0.3, width=5), [t5, t2])
t9 = p.addtask(admit.PVCorr_AT(), [t8, t1])
t10 = p.addtask(
    admit.LineID_AT(csub=[1, 1], minchan=3, maxgap=4, numsigma=6.0), [t5a, t6])
t11 = p.addtask(admit.LineCube_AT(pad=40), [t5, t10])
t12 = p.addtask(admit.Moment_AT(mom0clip=2.0, moments=[0, 1, 2]), [t11, t1])
t13 = p.addtask(admit.CubeSpectrum_AT(), [t11, t12])

p.run()

# Flow tasks.
t20 = p.addtask(admit.Ingest_AT(file='concat.spw19.image.fits'))
t21 = p.addtask(admit.CubeStats_AT(), [t20])
t22 = p.addtask(admit.CubeSum_AT(numsigma=4.0, sigma=1), [t20, t21])
t24 = p.addtask(admit.CubeSpectrum_AT(alias='spec13'), [t20, t22])
t26 = p.addtask(admit.LineSegment_AT(minchan=3, numsigma=4.0), [t21, t24])
t26a = p.addtask(admit.ContinuumSub_AT(fitorder=1, pad=60), [t20, t26])
t26b = p.addtask(admit.CubeSpectrum_AT(alias='spec14'), [t26a, t21])
t23 = p.addtask(admit.Moment_AT(mom0clip=2.0, numsigma=[3.0]), [t26a, t21])
t25 = p.addtask(admit.PVSlice_AT(clip=0.3, width=5), [t26a, t22])
Beispiel #6
0
 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
 # Moment_AT's default behavior of putting the zeroth moment in the
 # BDP index 0.
 Tasks.append(
Beispiel #7
0
    # 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:
            Tasks.append(p.addtask(admit.Ingest_AT (alias='incont',     file=contfile, pb=KEYS["contpb"])))
Beispiel #8
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}")