CubeSpectrum_AT — Cuts one or more spectra through a cube.

This module defines the CubeSpectrum_AT class.


Define one (or more) spectra through a cube.

Either a list of positions is given directly (via the pos= keyword) or a set of BDP’s can be given, each of which will accumulate its positions to a list of points for which the spectra are computed, as detailed below.

See also CubeSpectrum_AT for the design document.

pos: list of int or string
List of ra-dec position pairs. Each pair will produce a separate spectrum and plot. Positions can be given as two integers, in which case they are interpeted as (0 based) pixel coordinates, e.g. pos=[121,119], or in CASA’s ra/dec region format, e.g. pos=[‘00h47m33.159s’,’-25d17m17.41s’]. Different pairs do not need to be of the same type, so you can mix int’s and strings. If no positions are given, a position will be derived from the input BDPs. See below how this is done. This also means if an input BDP is given, the keyword values are ignored. If no input pos is given, and no optional BPD’s, the center of the map is used.
: list of int
A python list of source indices (0 being the first) from the SourceList_BDP to be selected for a spectrum. A blank list, [], selects all. Normally the SourceList is ordered by total flux. Default : [0]
xaxis: string
Select the X axis plotting style: channel number (the default), frequency (in GHz), or velocity (for this the restfreq needs to be in the image header). Currently ignored, channel is defaulted for SpwCube_BDP, and velocity for LineCube_BDP.

Input BDPs

SpwCube_BDP or LineCube_BDP: count: 1
One of more spectra are taken through this cube, as from an Ingest_AT, ContinuumSub_AT or LineCube_AT.
CubeStats_BDP: count: 1 (optional)
If given, the cube maxpos from this table will be used for pos=[]. Normally the output of a CubeStats_AT.
Moment_BDP: count: 1 (optional)
If given, the maxpos from this moment map will be used for pos=[]. Note : currently this is computed on the fly, as maps don’t store their maxpos. Typically the output of a CubeSum_AT or Moment_AT.
SourceList_BDP: count: 1 (optional)
If given, the positions in this source list will be used. By default only the strongest source (index 0) is selected. Typically the output from SFind2D_AT on a continuum map is given here.

Output BDPs

CubeSpectrum_BDP: count: 1
Spectra through the cube. Stored as a single multi-plane table if more than one point was used. Output BDP name takes from the input Image by replacing the extension with “csp”. See also CubeSpectrum_BDP — Data cube spectra..
Parameters:keyval : dictionary, optional


_version (string)


addinput(item[, slot]) Add a BDP input to an AT.
addinputbdp(item[, slot, insert]) Add a BDP to the _bdp_in list.
addoutput(item[, slot]) Add a BDP output product to an AT.
addoutputbdp(item[, slot, insert]) Add a BDP to the _bdp_out list.
baseDir([path]) Get/set project base directory.
bestMatch(at1, at2) Determines the better match of two tasks to the current one.
checkfiles() Check if the files from all the BDP_out’s in an AT exist.
checktype(item) Check the type of an object to see if it is a BDP.
clearinput() Clear the input BDP list.
clearoutput([delete]) Clear the output BDP list.
copy() Creates an independent duplicate of the task.
delete() Method to delete the AT and underlying BDPs.
delinput(slot) Delete a specific BDP in the _bdp_in list.
deloutput(slot) Delete a specific BDP in the _bdp_out list.
dir([filename]) Absolute directory reference of the ADMIT project.
dryrun() Method to do a dry run of the AT, generally just checks input values for errors.
enabled([state]) Returns current task enabled setting, with optional reset.
execute([args]) Executes the task.
freeAlias(aliases[, alias]) Deletes alias reservation, if present.
get(attrib) Method to get the given attributes value
getProject() Retrieves project ID associated with the task.
getVersion() Return the version string.
getdtd(fl) Method to write out the dtd data.
geteffectivelevel() Method to get the effective logging level of the logging subsystem
getkey(key) Retrieval value for a key.
getloggername() Method to get the name of the logger for this AT instance
getlogginglevel() Method to get the current logging level of the AT
haskey(key) Query if a key exists for an AT.
html(inheader) Method to represent the current AT in HTML format.
id([strip]) Returns task ID number.
isAutoAlias([withEmpty, compat]) Whether the task alias appears to be auto-generated.
isequal(at) Method to determine if two ATs are the same.
isstale() Returns whether the AT is out of date.
len2() Returns the length of _bdp_in and _bdp_out in a tuple.
link() Increments the task link count.
markChanged() Mark an AT that it’s state was changed, so it would need to be rerun.
markUpToDate() Resets _stale to indicate that the AT does not need to be run.
maxpos_im(im) Find the position of the maximum in an image.
merge(at[, aliases]) Merges attributes from another task.
mkdir(dirname) Make a directory in the ADMIT hierarchy.
mkext(filename, ext[, alias]) Return a new filename with a new extension with optional ADMIT alias.
newId(tid) Assigns the task a new ID number.
reset(a) Performs an in-place shallow copy.
run() Runs the task.
running([state]) Returns current task execution flag, with optional reset.
save() Save (write) any BDPs connected to this AT.
set(item, val) Method to set protected attributes, rather than direct access
setAlias(aliases[, alias, auto]) Sets and registers the task alias, guaranteed unique among registered aliases.
setProject(pid) Adds a project ID to task ID.
set_bdp_in([bdpin]) Validate the _valid_bdp_in list and digest it into the appropriate attributes.
set_bdp_out([bout]) Validate the _valid_bdp_out list and digest it into the appropriate attributes.
seteffectivelevel(level) Method to set the effective logging level of the logging subsystem
setkey([name, value, isinit]) Set keyword value.
setloggername(name) Method to set the name of the logger for this AT instance
setlogginglevel(level) Method to set the logging level
show() Return the AT type.
statusicons() return some html icons representing the enabled/stale status of this task
summary() Returns the summary dictionary from the AT, for merging into the ADMIT Summary object.
unlink() Decrements the task link count.
userdata() Returns the user dictionary from the AT, for merging into the ADMIT userdata object.
validateinput([describe]) Method to validate the _bdp_in’s against a dictionary of expected types.
validatekeys() Method to error check all input keys.
write(node) Method to write the AT to disk.

Find the position of the maximum in an image. Helper function returns the position of the maximum value in the image as an [x,y] list in 0-based pixel coordinates.


im : String, CASA image name



[x,y] list in 0-based pixel coordinates.


Runs the task.


Returns the summary dictionary from the AT, for merging into the ADMIT Summary object.

CubeSpectrum_AT adds the following to ADMIT summary:

Key type Description
spectra list the spectral plots




Dictionary of SummaryEntry, de)[source]
this peculiar function converts something like
‘18:29:56.713’, ‘+’
‘18h29m56.713s’, ‘+01d13m15.61s’

It’s a mystery why the output format from casa.sourcefind() has this peculiar H:M:S/D.M.S format