Summary — Project summary metadata.¶
This module defines the Summary class.
-
class
admit.Summary.
Summary
[source]¶ Defines and manages the summary metadata for the ADMIT object, which is ingested by ALMA Archive and also used by data browser.
The Summary is metadata provided by the various tasks. and written to the ADMIT object and admit.xml. It is used as project information for the ALMA archive to ingest and for the data browser to display. There will be one summary object per FITS cube, which means that for flows with multiple Ingests there can be multiple Summaries. Each entry in the Summary will be a dictionary of
{ key, [ SummaryEntry ] }
where the value is a list of zero or more SummaryEntry. The summaryEntry contains the actual data value, the taskname string, the taskid integer, and string task arguments to be displayed in the web page. Each key also has a value type and description which is the same for every entry in the list. These are retrieved using getType(key) and getDescription(key). In the case where different tasks or different instances of the same task write to the same key, the new value will be appended:
{ key, [SummaryEntry task1, SummaryEntry task2,...]}
Because they are needed by the ALMA archive, the keys, value types, and description will be strictly defined ahead of time. Individual ATs will be responsible for providing the actual value data through their summary() method as a dictionary of {key, [value, taskname, taskid]}. ADMIT Summary keywords that map directly to standard FITS keywords shall have their values copied directly from the FITS header (by Ingest_AT). Below is a draft list, necessarily incomplete until we have all ATs implemented. Keywords ending in n indicate multiple keywords 1 to NAXIS (as in FITS). The table below summarizes the keys.
Key Description Type Typically Provided by FITSNAME Pathless filename of FITS cube string Ingest_AT OBJECT Object name string Ingest_AT/FITS NAXIS Number of Axes integer Ingest_AT/FITS NAXISn size of axis n integer Ingest_AT/FITS CRPIXn Reference pixel axis n float Ingest_AT/FITS CRVALn axis value at CRPIXn float Ingest_AT/FITS CTYPEn axis type string Ingest_AT/FITS CDELTn axis increment float Ingest_AT/FITS CUNITn axis unit string Ingest_AT/FITS RESTFREQ rest frequency, Hz float Ingest_AT/FITS BMAJ beam major axis, radians float Ingest_AT/FITS BMIN beam minor axis, radians float Ingest_AT/FITS BPA beam position angle, deg float Ingest_AT/FITS BUNIT units of pixel values string Ingest_AT/FITS TELESCOP telescope name string Ingest_AT/FITS OBSERVER observer name string Ingest_AT/FITS DATE-OBS date of observation string Ingest_AT/FITS DATAMAX maximum data value float Ingest_AT or CubeStats_AT DATAMIN minimum data value float Ingest_AT or CubeStats_AT DATAMEAN mean data value float CubeStats_AT DYNRANGE dynamic range, equal to DATAMAX/CHANRMS float CubeStats_AT CHANRMS one-sigma noise in cube float CubeStats_AT RMSMETHD method and parameters used to compute RMS list CubeStats_AT SPECTRA Spectra extracted by any method list CubeSpectrum_AT LINELIST Table of parameters of identified spectral lines. admit.util.Table LineID_AT LINECUBE Info about any LineCubes produced (name, channel range, image name). list LineCube_AT CUBESUM Info about any CubeSum produced list CubeSum_AT MOMENTS Table of moments computed from the original cube. admit.util.Table Moment_AT PVSLICES Table of position-velocity slices computed from original cube. list PVSlice_AT PVCORR List of PV correlation diagrams computed from input cube. list PVCorr_AT SEGMENTS List of segments found by segment-finding algorithm list LineSegment_AT SOURCES Table of sources found by a feature-finding algorithm admit.util.Table SFind2D_AT SMOOTH Info about any smoothing done to cube. list Smooth_AT OVERLAP Overlap integral input and output images information list OverlapIntegral_AT PCA Principal component analysis information. list of admit.util.Table PrincipalComponent_AT PEAKPNT Peak Point Plot optionally produced by CubeStats_AT list CubeStats_AT VELDEF User or ASDM/source.xml derived source velocity information (value, reference frame, etc) list Ingest_AT? @TODO: the following entries are in the summary_defs.tab file, but not documented here:
Note: Keys are stored in all lower case. All key access will change argument to lower case before accessing.
casaname, equinox, badpixel, vlsr, continuumsub, template, regrid, bdpingest
FORMATS AND EXAMPLES OF COMPLICATED SUMMARIES RMSMETHD: [[method type, method args], input cube]
Examples:
[['metabdevmed'], foobar.im] [['robust', 'chauvenet', 21.3, 123], foobar.im] [['robust', 'classic', 'auto'], foobar.im]
SPECTRA: [x,y, box, axis type, display image, thumbnail image, caption, input cube]
Example:
[[ '00h47m33.159s','-25d17m17.41s',(10,-10,-20,22),'frequency','spect1.svg','spect1_thumb.svg', "Spectrum at Emission Peak", foobar.im], [ +10,-20,(),'velocity','spect.svg','spect2_thumb.svg', "Pencil beam spectrum", foobar.im]]
LINELIST: [Format same as output from LineList_AT]
Example:
[['H2CS_103.0405', 103.04055,'H2CS', ...], ['NH2CHO_102.0643',102.06427, 'NH2CHO', ...]]
MOMENTS: [table of moment data ]
Columns: [Line UID, Moment value, display image, thumbnail image, caption, casa image].
If thumbnail image is not present, an empty string is given.
Example:
[['H2CS_103.0405', 0, 'foo_mom0.png', 'foo_mom0_thumb.png', 'Moment 0 of H2CS', ''], ['H2CS_103.0405', 1, 'foo_mom1.svg', '', 'Moment 1 of H2CS clipped at 3 sigma', 'foobar_mom1.im']]
PVSLICES: [pvslice type, pvslice args, display image, thumbnail image, caption, input cube, output image].
Example:
[['slice', start, end, width, 'slice1.png', 'slice1_thumb.png','pvslice of h2co','foobar.im', 'slice.im'], ['slit', center, length, pa, width, 'slit1.png', 'slit1_thumb.png', 'pvslit of h2co','foobar.im', 'slit.im']]
PVCORR: [display image, thumbnail image, caption, input cube, output image]. Attributes
_metadata (dictionary of lists {key, [SummaryEntry]}.) _datatype (dictionary of {key, valuetype} where the keys are the as in _metadata and valuetype is defined in $ADMIT/etc/summary_defs.tab) _description (dictionary of {key, description} where the keys are the as in _metadata and description string is defined in $ADMIT/etc/summary_defs.tab) Methods
delItemsByTaskID
(taskid)Deletes all summary entries belonging to task #`taskid`. get
(key)Get the value for the input key. getAllTaskIDs
()Get a list of all integer task IDs that have written to this Summary for the input key. getDescription
(key)Get the description for the input key. getFull
(key)Get the full entry [[value(s)], valuetype, description] for the input key. getItemsByTaskID
(taskid)Return all Summary items that were produced getItemsByTaskname
(taskname)Return all Summary items that were produced getLineTable
([index])Get the table of spectral lines found getLinefluxes
([index])Get an estimate of the line fluxes from the line list by multiplying Peak * Linewidth. getLinelist
([index])Get the list of spectral lines found getLinenames
([index])Get the names of spectral lines found getTaskID
(key)Get the integer task ID number that produced the data for the input key. getTaskIDsforTaskname
(taskname)Get the task ID(s) matching the input taskname. getTaskname
(key)Get the name of the task that produced the data for the input key. getTasknameForTaskID
(taskid)Get the task name matching the input taskid. getType
(key)Get the value type for the input key. html
(outdir, flowmanager[, dotdiagram, editor])insert
(key, value)Set, replace, or append the SummaryEntry value to the list for an existing input key If the key is not yet set, it will be set with the value. isTable
(key)Return True if this key corresponds to an item that is natively an ADMIT table. makesvghtml
(image, caption, outdir)set
(key, value)Set the SummaryEntry value for an existing input key show
([showunset])Display the all entries [key, values, description]. unset
(key)Determine if the key has any data. write
(root)Method to write out the summary data to XML -
delItemsByTaskID
(taskid)[source]¶ Deletes all summary entries belonging to task #`taskid`.
Parameters: taskid : int
ID of task for which to delete summary information.
Returns: None
-
get
(key)[source]¶ Get the value for the input key.
Parameters: key : str
Key to retrieve, case insensitive.
-
getAllTaskIDs
()[source]¶ Get a list of all integer task IDs that have written to this Summary for the input key.
Parameters: None
Returns: Sorted list of zero or more integer task ids that produced data for the Summary.
If no tasks ids, the list is empty because you have empty Summary!
-
getDescription
(key)[source]¶ Get the description for the input key.
Parameters: key : str
Key to retrieve, case insensitive.
Returns: String description for the key
-
getFull
(key)[source]¶ Get the full entry [[value(s)], valuetype, description] for the input key.
Parameters: key : str
Key to retrieve, case insensitive.
-
getItemsByTaskID
(taskid)[source]¶ Return all Summary items that were produced by the given taskid, as dict of SummaryEntrys
Parameters: taskid : int
Task ID to look up
Returns: Return a dictionary of all SummaryEntrys that were produced
by the given task, with keys as in Summary or an empty
dictionary if there is no match for the input taskid.
Notes
The values in the returned dictionary may be single SummaryEntry instances or a list of entries; in general, caller code needs to check this explicitly for every key...
-
getItemsByTaskname
(taskname)[source]¶ Return all Summary items that were produced by the given task, as dict of SummaryEntrys
Parameters: taskname : str
Task name to look up, case-insensitive
Returns: Return a dictionary of all SummaryEntrys that were produced
by the given task, with keys as in Summary or an empty
dictionary if there is no match for the input taskid.
Notes
The values in the returned dictionary may be single SummaryEntry instances or a list of entries; in general, caller code needs to check this explicitly for every key...
-
getLineTable
(index=0)[source]¶ Get the table of spectral lines found
Parameters: None
Returns: An admit.Table with spectral line entries or empty Table if
no lines were found
-
getLinefluxes
(index=0)[source]¶ Get an estimate of the line fluxes from the line list by multiplying Peak * Linewidth.
Parameters: None
Returns: A dictionary of ‘image filename’:flux for all non-blended spectral lines in the line list,
or an empty dictionary if no line list is available or linecubes were not created.
-
getLinelist
(index=0)[source]¶ Get the list of spectral lines found
Parameters: None
Returns: A Python list with spectral line entries or empty list if
no lines were found
-
getLinenames
(index=0)[source]¶ Get the names of spectral lines found
Parameters: None
Returns: A list of string spectral line names or empty list if
no lines were found
-
getTaskID
(key)[source]¶ Get the integer task ID number that produced the data for the input key.
Parameters: key : str
Key to retrieve, case insensitive.
Returns: List of zero or more integer taskids that produced data for the
input key. If no tasks did, the list is empty.
-
getTaskIDsforTaskname
(taskname)[source]¶ Get the task ID(s) matching the input taskname.
Parameters: taskname : str
Task name to look up
Returns: List of taskids matching the taskname. Empty list if none.
-
getTaskname
(key)[source]¶ Get the name of the task that produced the data for the input key.
Parameters: key : str
Key to retrieve, case insensitive.
Returns: List of zero or more string task names that produced data for the
input key. If no tasks did, the list is empty.
-
getTasknameForTaskID
(taskid)[source]¶ Get the task name matching the input taskid.
Parameters: taskid : int
Task ID to look up
Returns: String task name or empty string if no match
-
getType
(key)[source]¶ Get the value type for the input key.
Parameters: key : str
Key to retrieve, case insensitive.
Returns: String indicating underlying data type, e.g., ‘float’, ‘table’
-
insert
(key, value)[source]¶ Set, replace, or append the SummaryEntry value to the list for an existing input key If the key is not yet set, it will be set with the value. If the key is set, the taskid(s) will be checked and the value will replace the existing value(s) if the keys match. If the taskids do not match the input value(s) will be appended to the existing value.
Parameters: key : str
Key to insert, case insensitive. Key must already exist.
value : SummaryEntry or list of SummaryEntry
Entry to insert
Returns: None
-
isTable
(key)[source]¶ - Return True if this key corresponds to an item that is
- natively an ADMIT table.
Parameters: key : str
Key to set, case insensitive. Key must already exist.
Returns: boolean
True if this key corresponds to an item that is natively an ADMIT table, False otherwise
-
set
(key, value)[source]¶ Set the SummaryEntry value for an existing input key
Parameters: key : str
Key to set, case insensitive. Key must already exist.
value : SummaryEntry or list of SummaryEntry
Entry to set
Returns: None
-
show
(showunset=False)[source]¶ Display the all entries [key, values, description].
Parameters: showunset : boolean
If True, show unset values in addition to set values. Default: False
Returns: None
-
-
class
admit.Summary.
SummaryEntry
(value=[], taskname='', taskid=-1, taskargs='')[source]¶ Defines a single ‘row’ of a Summary data entry. A Summary key can refer to a list of SummaryEntry. This class makes management of complicated data entries easier. It was getting tough to slice and unzip all those lists!
Attributes
taskargs
The arguments of the task to display in the data browser web page. taskid
The integer task ID that created this SummaryEntry taskname
The name of the task that created this SummaryEntry value
The underlying data value Methods
getTaskArgs
()Get the arguments of the task to display in the data browser web page. getTaskID
()Get the ID of the task that created this SummaryEntry. getTaskname
()Get the name of the task that created this SummaryEntry. getValue
()Get the underlying data value from this SummaryEntry. setTaskArgs
(args)Set any arguments of the task that should be displayed in the data browser web page. setTaskID
(taskid)Set the ID of the task that created this SummaryEntry. setTaskname
(name)Set the name of the task that created this SummaryEntry. unset
()Find out if this SummaryEntry instance has data or not. write
(root)Method to write out the SummaryEntry data to XML -
getTaskArgs
()[source]¶ Get the arguments of the task to display in the data browser web page.
Parameters: None
Returns: str
The string task arguments
-
getTaskID
()[source]¶ Get the ID of the task that created this SummaryEntry.
Parameters: None
Returns: int
The integer task ID that produced the data value
-
getTaskname
()[source]¶ Get the name of the task that created this SummaryEntry.
Parameters: None
Returns: str
The string task name that produced the data value
-
getValue
()[source]¶ Get the underlying data value from this SummaryEntry. Value will be list containing zero or more items.
Parameters: None
Returns: list
A (possibly empty) list of SummaryEntry.
-
setTaskArgs
(args)[source]¶ Set any arguments of the task that should be displayed in the data browser web page.
Parameters: args : str
The task args that produced the data value
Returns: None
-
setTaskID
(taskid)[source]¶ Set the ID of the task that created this SummaryEntry.
Parameters: taskid : int
The task id number that produced the data value
Returns: None
-
setTaskname
(name)[source]¶ Set the name of the task that created this SummaryEntry.
Parameters: name : str
The task name that produced the data value
Returns: None
-
taskargs
¶ The arguments of the task to display in the data browser web page.
-
taskid
¶ The integer task ID that created this SummaryEntry
-
taskname
¶ The name of the task that created this SummaryEntry
-
unset
()[source]¶ Find out if this SummaryEntry instance has data or not.
Parameters: None
Returns: bool
True if this SummaryEntry has no data set
-
value
¶ The underlying data value
-