pipeline.infrastructure.utils¶
utils sub-package.
The utils package contains a set of utility classes and functions that are useful to the pipeline framework and to tasks manipulating pipeline framework objects, Python data types, and CASA data types.
The utils package is intended to be free of any task-specific logic. Code that assumes knowledge or logic beyond that of the task-independent framework should be housed in the h.common package (or hif.common, hifv.common, hsd.common, etc. as appropriate).
- Modules:
utils: Core utility functions (imported first to prevent circular imports) caltable_tools: Caltable utilities casa_data: Utilities for handling CASA data structures conversion: Data conversion utilities diagnostics: Diagnostic and debugging tools framework: Pipeline framework utilities imaging: Image processing utilities math: Mathematical functions and algorithms positioncorrection: Position correction utilities parallactic_range: Parallactic range calculation utilties ppr: Pipeline processing request utilities sorting: Sorting algorithms and utilities weblog: Web logging utilities
Functions¶
|
Return an absolute path of a given file. |
|
Convert a string to the corresponding antenna IDs. |
|
Returns the antenna names from the specified caltable's ANTENNA table. |
|
Return True if two numbers are equal within the given tolerance. |
|
Return True if the contents of the given arrays are equal. |
|
Return a comma-separated string from refantignore and ignorerefant, ignoring empty strings. |
|
Computes the zenith distance and parallactic angle chi. |
|
|
|
Returns the frequency (in GHz) of the specified spw channel in a caltable. |
|
Convert channel selection to frequency tuples for a given CASA cube. |
|
Iterates over existing loggers and updates the stream of their StreamHandlers to the given new_stream. |
|
Check PPR to make sure all tasks exist in the CASA task dictionary. |
Clear the time cache in the CASA measures tool. |
|
|
Return the public properties of an object as a dictionary |
|
Convert the string list into the textual description. |
|
Calculate zenith distance for a field at a given time and observatory. |
|
Return True if the given context contains single-dish data. |
|
Convert all absolute and relative file paths in command string to basenames. |
|
Remove duplicate entries from a list, but preserve the order. |
|
Remove any kind of quotes from a string to facilitate comparisons. |
|
Recursively merge dictionaries. |
|
Applies mean wide field position correction to FITS WCS in place. |
|
Log file descriptors to the CASA log every n seconds. |
|
|
|
Approximate equality check up to a given number of digits. |
|
Execute the same function on both client and worker (dask-worker or mpiserver) processes. |
|
|
|
Convert a string to the corresponding field IDs. |
|
Indicate if the fieldname is allowed as-is. |
|
Prepare field string to be used as CASA argument. |
|
Filter string of comma-separated intents to keep only those that are present in the given MS. |
|
Identify numeric ranges in string or list. |
|
Idendity isnads of ones in input array or list. |
|
Flatten a list of lists into a single list without pipelineaq.QAScore. |
|
|
|
Convert a datetime to a formatted string representation. |
|
Convert a timedelta to a formatted string representation. |
|
Convert frequency selection to channel tuples for a given CASA cube. |
|
Convert frequency to radial velocity using radio convention. |
|
Convert a MJD float into a datetime |
|
Makes a hash from a dictionary, list, tuple or set to any level, that contains only other hashable types (including any lists, tuples, sets, and dictionaries). |
|
Returns a list of all unique antenna ids in the caltable |
|
Get the CalFroms of the requested type from the callibrary. |
|
Wrapper around quanta.quantity() that handles None input. |
Get the current CASA session details. |
|
|
Calculate the total size of a directory in megabytes (MB). |
|
Convert a CASA 'epoch' measure into a Python datetime. |
Maps numeric field IDs to field names. |
|
|
Return a readable hex string of the MD5 hash of a given file |
|
Get a string with information about the modification date and MD5 hash of a file |
|
Get the integration intervals for scans processed by a calibration. |
|
Return the ISO 8601 datetime string corresponding to the modification time of a given file |
|
Get the logrecords for the result, removing any duplicates |
|
Obtain number of polarisations from calibration table. |
|
Estimate the size of a Python object. |
|
Get the file information (MD5 hash and modification date) for a given Solar System object. |
|
Get a single-valued task input argument from a CalApp. |
|
|
|
|
|
Return dictionary of receiver types for requested spectral window IDs. |
|
Return the number of rows in the specified table that match the given TaQL query. |
|
Obtain the best SI unit prefix option for a numeric value. |
|
Return the data files corresponding to a Solar System object |
Returns a dictionary of spectral specs mapped to corresponding spectral window IDs for requested list of spectral window objects. |
|
|
Return a dict of requested statistics for the given image. |
|
Get the labels of all stokes planes present in a CASA image. |
|
Count occurrences of a task result in the context.results list. |
|
Retrieve past CASA/tclean() call parameters from the image history. |
|
Get the tracebacks for the result, from any failures that may have occurred during the task. |
|
Fetches one or more URLs from an environment variable. |
|
Get the name to be used for the MS from the given plots. |
|
Determine the VLASS image type based on specific substrings in the filename. |
|
Return a sorted list of paths matching a pathname pattern. |
|
Converts a file size in bytes to a human-readable string format. |
|
A context manager to ignore pointing tables of MSes during I/O operations. |
|
Import a module. |
|
Extract desired stats properties (per Stokes) using ia.statistics(). |
|
Compute intersection of ranges. |
|
Compute intersection of ranges through weight arrays and a threshold. |
|
Inverts a dictionary so that values become keys and keys become grouped in a list. |
Return True if the callee if executing as part of a top-level task. |
|
|
Convert list or numpy.ndarray into string. |
|
Merge jobs that are identical apart from the arguments named in ignore. |
|
Merge overlapping and adjacent ranges and yield the merged ranges in order. |
|
Merge HTML TD columns with identical values using rowspan. |
|
Merge HTML TD rows with identical values using colspan. |
|
Convert list of MJD seconds to a list of equivalent datetime objects. |
|
Emulate mkdir -p functionality. |
|
Sort a list in natural order, eg. |
|
Key to order in natural order with the sort function |
|
Returns the number of channels of the specified spw in a caltable. |
|
Sort a list numerically, eg. |
|
Key to order in numeric order with the sort function. |
|
Return longitude and latitude values of the given observatory. |
|
Returns the mid time in a CASA measures dictionary. |
|
Open a file with an exclusive lock. |
|
Get the parallactic angle range across all measurement sets for field when observed with the specified intent. |
|
|
|
|
|
Place representative source first in a list of source names or tuples with source name as first tuple element. |
|
Iterate multiple plotms job requests |
|
Convert a list of plots to HTML snippets. |
|
Predict the required convolution kernel to each a target restoring beam. |
|
Expand a numeric range expressed in CASA syntax to the list of integer. |
|
Convert a CASA record to an Astropy quantity. |
|
Retun a relative path of a given file with respect a given origin. |
|
Remove a trailing string if it exists. |
|
A context manager to override the session-wise OMP threading setting on CASA MPI client. |
|
Reset CASA/Pipeline logfiles for the current CASA/Pipeline session. |
|
Provides the "round to given precision with ties going away from zero" behaviour that was the default Python2 rounding behavior. |
|
Round to given precision away from zero. |
|
Split a string containing field names into a list. |
|
Return the UV range that captures the inner half of the data. |
|
Set a hierarchy of dictionaries with given keys and value for the lowest level key. |
Shutdown the existing plotms process in the current CASA session. |
|
|
Splits an SPW string on '#' characters while retaining them, and inserts a <br/> before the 'ALMA' portion to improve readability. |
|
Convert a string to spectral window IDs and channels. |
|
This utility function takes a frequency range (as numbers with arbitrary but common units) and computes the intersection with a list of frequency ranges defining the regions of spectral lines. |
Convert a string to a Python data type. |
|
|
Convert a astropy.table.Table object to an HTML table snippet. |
Get the number of executing tasks currently on the stack. |
|
|
Convert pipeline intents back to the equivalent intents recorded in the measurement set. |
|
Convert CASA intents to pipeline intents. |
|
Return the total time on source for the given Scans. |
|
Return the nominal total time on target source for the given MeasurementSet excluding OFF-source integrations (REFERENCE). |
|
Update a beams dictionary. |
|
Update a sensitivity dictionary. |
|
Validates whether a given URL is properly formatted. |
|
Convert radial velocity to frequency using radio convention. |
|
A context manager to temporarily change the working directory. |
|
Classes¶
Type for CASA direction measure dictionary (from me tool). |
|
Type for CASA epoch measure dictionary (from me tool). |
|
|
Class to store, retrieve and process the information from the IERS geodetic tables |
Type for latitude/longitude pair. |
|
|
This class behaves as defaultdict from the collections module but maintaining the order of insertion. |
Type for CASA position measure dictionary (from me tool). |
|
Type for CASA quantity dictionary (from qa tool). |
Variables¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
|
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |