# PVSlice_AT — Creates a position-velocity slice through a cube.¶

This module defines the PVSlice_AT class.

class admit.at.PVSlice_AT.PVSlice_AT(**keyval)[source]

Create a PV Slice through a cube.

Keywords
slice: 4 element list
Beginning and ending positions of the slice: [x0,y0,x1,y1] Only (0 based) pixel coordinates are allowed.
slit: 4 element list
XCenter, Ycenter, SlitLength and SlitPA. Pixel coordinates for now, for both center (0 based) and length. PA in degrees, east of north, in the traditional astronomy convention.
width: int
Width of the slice/slit in the XY plane. Higher numbers will of course increase the signal to noise, but also blurr the signal in velocity if there are velocity gradients across the slit, defeating the purpose if this PVSlice is used. for LineID. Numbers need to be odd, since it includes the central pixel, as well as a number on either side of the slit/slice. Warning: large widths can also cause CASA’s impv program to crash as it runs over the edge near the endpoints of the slit. Default: 1.
clip: float
Clip value applied to input Moment_BDP map in case the slice/slit is to be derived from an automated moment of inertia analysis. It is interpreted as a “numsigma”, i.e. how many times over the noise in the map it should use. If no signal is found, it iteratively lowers this value until some signal is found (but probably creating a lousy PV Slice) Default: 0.0.
gamma: float
Gamma factor applied to input Moment_BDP map in case the slice/slit is to be derived from an automated moment of inertia analysis. Default: 1.0.
pvsmooth: list of 2
Smoothing (in pixels) to apply to PV Slice. By default no smoothing is done. Currently no further processing on this smoothed version is done, although it is available for inspection. Default: [].
zoom: int
Image zoom ratio applied to the map plots. This does not impact the base (CASA) images. Default: 1.

Input BDPs

SpwCube_BDP: count: 1
Spectral window cube, as from an Ingest_AT or ContinuumSub_AT.
Moment_BDP: count: 1 (optional)
Map from a CubeSum_AT or Moment_AT where a moment of inertia is used to derive a best slice.
CubeStats_BDP: count: 1 (optional)
The peakpoints from this table are used to compute a moment of inertia to obtain a best slice. Normally the output of a CubeStats_AT.

Output BDPs

PVSlice_BDP: count: 1
Output PV Slice, a 2D map. Naming convention: extension replaced with “pv” (e.g. x.im -> x.pv).
Parameters: keyval : dictionary, optional

Attributes

 _version (string)

Methods

 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. 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.
run()[source]

Parameters: None None
summary()[source]

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

Key type Description
pvcorr list correlation diagram
Parameters: None dict Dictionary of SummaryEntry
admit.at.PVSlice_AT.convert_to_slit(m, x, y, nx, ny, gamma=1.0, expand=1.0)[source]

compute best slit for PV Slice from set of points or masked array using moments of inertia m=mass (intensity) x,y = positions

admit.at.PVSlice_AT.expand_line(x0, y0, x1, y1, nx, ny, edge=6)[source]

expand a line, but stay inside the box [0..nx,0..ny] sadly casa.impv cannot think outside the box, this routine takes a line, and makes it fit within the box, minus edge pixels from the edges, since that’s what impv wants. CASA bug? edge=2 is advertised should work, but 5 still fails, 6 is ok

returns: [x0,y0,x1,y1]

admit.at.PVSlice_AT.expand_slice(slice, expand=1.2)[source]
admit.at.PVSlice_AT.map_to_slit(fname, clip=0.0, gamma=1.0)[source]

take all values from a map over clip, compute best slit for PV Slice

admit.at.PVSlice_AT.tab_to_slit(xym, clip=0.0, gamma=1.0)[source]

take all values from a map over clip, compute best slit for PV Slice