コード例 #1
0
    def runTest(self):
        try:
            # instantiate the class

            a = admit.Project(self.admitdir)

            #use a GenerateSpectrum_AT that reads in a spectrum
            gs1 = a.addtask(
                admit.GenerateSpectrum_AT(file=self.specfile,
                                          freq=124.470,
                                          seed=-1))
            gstab1 = (gs1, 0)

            # instantiate a LineSegment AT and set parameters
            l = admit.LineSegment_AT()
            task1id = a.addtask(l, [gstab1])
            a.fm.verify()
            a.run()
            # read in the admit.xml and bdp files
            a2 = admit.Project(self.admitdir)
            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))
コード例 #2
0
NUM_SIGMA = 2
MIN_CHAN = 2
MAX_CHAN = 10
FITS_CUBE = "/media/haotian/documents-local/ASTR4998/data/products/SerpS_TC_spw5.pbcor_cutout_180_180_100_line.fits"
VLSR = 8.0

if __name__ == "__main__":
    p = admit.Project("{}.admit_BDP".format(FITS_CUBE), dataserver=True)
    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])
コード例 #3
0
    def runTest(self):
        print "####  %s ####" % self.testName
        try:
            for i in range(len(self.transitions)):
                spec = self.a.addtask(
                    admit.GenerateSpectrum_AT(seed=self.seed[i],
                                              nchan=self.nchan[i],
                                              contin=self.contin[i],
                                              delta=self.delta[i],
                                              freq=self.freq[i],
                                              transitions=self.transitions[i],
                                              alias="test_%i" % (i)))
                bdp_in = [(spec, 0)]
                csub = [1, 1]
                segment = "ADMIT"
                numsigma = 2.0
                minchan = 5
                maxgap = 3
                vlsr = 0.0

                linesegment1 = self.a.addtask(
                    admit.LineSegment_AT(segment=segment, csub=csub), bdp_in)
                self.a[linesegment1].setkey('numsigma', numsigma)
                self.a[linesegment1].setkey('minchan', minchan)
                self.a[linesegment1].setkey('maxgap', maxgap)

                lineid1 = self.a.addtask(
                    admit.LineID_AT(vlsr=vlsr, segment=segment, csub=csub),
                    bdp_in)
                self.a[lineid1].setkey('numsigma', numsigma)
                self.a[lineid1].setkey('minchan', minchan)
                self.a[lineid1].setkey('maxgap', maxgap)
                self.a[lineid1].setkey('identifylines', False)

                print "################## RUNNING TRANSITION %d: %s ######################### " % (
                    i, self.transitions[i][0][0])

                self.a.run()

                segtable = self.a.fm[linesegment1]._bdp_out[0].table
                linetable = self.a.fm[lineid1]._bdp_out[0].table
                number_of_segments = len(segtable)
                number_of_lines = len(linetable)
                self.assertEqual(
                    number_of_segments,
                    number_of_lines,
                    msg=
                    "Number of Line Segments doesn't match number of LineIDs")

                for rowindex in range(min(number_of_segments,
                                          number_of_lines)):
                    rowS = segtable.getRowAsDict(rowindex)
                    rowL = linetable.getRowAsDict(rowindex)
                    self.assertEqual(
                        rowS, rowL,
                        "Values for row %d of segment table and line table do not match"
                        % rowindex)
            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))
コード例 #4
0
ファイル: admit1.py プロジェクト: astroumd/admit
    #print "CSP: using %d bpd's" % (len(bdp_in))
    #print "BDP_IN",bdp_in
    cubespectrum1 = a.addtask(admit.CubeSpectrum_AT(), bdp_in)
    a[cubespectrum1].setkey('sources', sources)

csptab1 = (cubespectrum1, 0)

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

# Find line segments from cubestats and/or cubespect
# For SD maps cubestats should not be used, since there is a false (negative) continuum
if lineSEG:
    bdp_in = []
    if contbdp[0]: bdp_in.append(csptab1)  # CubeSpectrum
    if contbdp[1]: bdp_in.append(csttab1)  # CubeStats
    segment1 = a.addtask(admit.LineSegment_AT(), bdp_in)
    if len(linepar) > 0:
        a[segment1].setkey('numsigma', linepar[0])
        a[segment1].setkey('minchan', linepar[1])
        a[segment1].setkey('maxgap', linepar[2])
    else:
        a[segment1].setkey('numsigma', 5.0)
        a[segment1].setkey('minchan', 4)
        a[segment1].setkey('maxgap', 3)
    #a[segment1].setkey('csub',[1,1])
    a[segment1].setkey('csub', [0, 0])
    a[segment1].setkey('smooth', llsmooth)
    a[segment1].setkey('iterate', iterate)
    lstab1 = (segment1, 0)
    a.run()
コード例 #5
0
ファイル: admit5.py プロジェクト: teuben/admit
#
# Example multi-file admit flow, hardcoded for a specific 4-spw case
#
# REMOVE existing project directory before running script for the first time!
#
import admit

# Master project.
p = admit.Project('all-cubes.admit', commit=False)

# 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()
コード例 #6
0
ファイル: admit4.py プロジェクト: teuben/admit
    a.showsetkey()
    sys.exit(0)      # doesn't work in IPython!

# Default ADMIT plotting environment
a.plotparams(plotmode,plottype)

# GenerateSpectrum
# here we use a little backdoor in GenerateSpectrum_AT that reads in
# a spectrum 
gs1 = a.addtask(admit.GenerateSpectrum_AT(file=file,seed=-1,alias=alias))
gstab1 = (gs1,0)

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

# 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])
コード例 #7
0
ファイル: admit_script.py プロジェクト: xinglunju/reduction
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}")