Ejemplo n.º 1
0
    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)

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

# CubeSum
moment1 = a.addtask(admit.CubeSum_AT(), [bandcube1, csttab1])
a[moment1].setkey('numsigma', 4.0)  # Nsigma clip in cube
a[moment1].setkey('sigma',
                  99.0)  # >0 force single cuberms sigma from cubestats
#a[moment1].setkey('sigma',-1.0)    # use rms(freq) table
a[moment1].setkey('pad', pad)
csmom0 = (moment1, 0)

if False:
    # testing Export_AT()
    fits000 = a.addtask(admit.Export_AT(basename="testCubeSum"), [csmom0])

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

# SFind2D on CSM
if True:
Ejemplo n.º 2
0
# Create (or re-open) the ADMIT project.
# Our project directory is the input path with extension set to admit.
proj = admit.Project(os.path.splitext(ifile)[0] + '.admit', commit=False)

# Ingest the FITS cube.
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])
Ejemplo n.º 3
0
#! /usr/bin/env casarun
#
# 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()
Ejemplo n.º 4
0
    if pbcorfile == None:
        Tasks.append(
            p.addtask(
                admit.Ingest_AT(alias='incube', file=cubefile,
                                box=KEYS["box"])))
    else:
        Tasks.append(
            p.addtask(
                admit.Ingest_AT(alias='incube',
                                file=cubefile,
                                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']))
Ejemplo n.º 5
0
# Default ADMIT plotting environment
a.plotparams(plotmode, plottype)

# Ingest
ingest1 = a.addtask(admit.Ingest_AT(file=file, alias=alias))
a[ingest1].setkey('mask', useMask)
bandcube1 = (ingest1, 0)

# 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)
csmom0 = (moment1, 0)

# CubeSpectrum
if len(maxpos) > 0:
    cubespectrum1 = a.addtask(admit.CubeSpectrum_AT(), [bandcube1])
    a[cubespectrum1].setkey('pos', maxpos)
else:
    cubespectrum1 = a.addtask(admit.CubeSpectrum_AT(), [bandcube1, csmom0])
csptab1 = (cubespectrum1, 0)

# PVSlice
if len(pvslice) == 4:
Ejemplo n.º 6
0
    # list object for Tasks so we don't have to individually name them
    Tasks = []
    #
    # 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:
Ejemplo n.º 7
0
import os

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