tkp.accessors
API reference¶
tkp.accessors
– Base data accessor utilities¶
Data accessors.
These can be used to populate ImageData objects based on some data source (FITS file, array in memory... etc).
-
tkp.accessors.
dbimage_from_accessor
(dataset, dataccessor, extraction_radius)[source]¶ Create an entry in the database image table from an image ‘accessor’
Parameters: - dataset (-) – DataSet for the image. Also provides the database connection.
- image (-) – FITS/AIPS/HDF5 image available through an accessor
Returns: a dataset.Image instance.
Return type: (dataset.Image)
-
tkp.accessors.
open
(path, *args, **kwargs)[source]¶ Returns an accessor object (if available) for the file or directory ‘path’.
We try all the possible accessors in order from most specific to least specific. That is, if possible, we prefer an accessor providing LofarAccessor to one providing DataAccessor, but we accept the latter if that’s the only possible match.
Will raise an exception if something went wrong or no matching accessor class is found.
tkp.accessors.common
– Common accessor parsing functions¶
Parsing functions used by multiple DataAccessor sub-classes
-
tkp.accessors.common.
arcsec2degrees
(bmaj, bmin, bpa)[source]¶ Converts beam parameters from arcsec to degrees. For example CASAtable beam parameters are in arcsec.
Parameters: - bmaj (-) – Beam semi-major axis in arcsec
- bmin (-) – Beam semi-minor axis in arcsec
- bpa (-) – Beam position angle in arbitrary units
Returns: - tuple of (semi-major in degrees, semi-minor in degrees, bpa as above)
-
tkp.accessors.common.
degrees2pixels
(bmaj, bmin, bpa, deltax, deltay)[source]¶ Convert beam in degrees to beam in pixels and radians. For example Fits beam parameters are in degrees.
Parameters: - bmaj (-) – Beam semi-major axis in degrees
- bmin (-) – Beam semi-minor axis in degrees
- bpa (-) – Beam position angle in degrees
- deltax (-) – Pixel size along the x axis in degrees
- deltay (-) – Pixel size along the y axis in degrees
Returns: Beam semi-major axis in pixels - semimin: Beam semi-minor axis in pixels - theta: Beam position angle in radians
Return type: - semimaj
tkp.accessors.detection
– File type detection¶
-
class
tkp.accessors.detection.
FitsTest
(accessor, test)¶ -
__getnewargs__
()¶ Return self as a plain tuple. Used by copy and pickle.
-
__getstate__
()¶ Exclude the OrderedDict from pickling
-
__repr__
()¶ Return a nicely formatted representation string
-
accessor
¶ Alias for field number 0
-
test
¶ Alias for field number 1
-
-
tkp.accessors.detection.
casa_detect
(filename)[source]¶ Detect which telescope produced CASA data, return corresponding accessor.
Checks for known CASA table types where we expect additional metadata. If the telescope is unknown we return nothing.
-
tkp.accessors.detection.
detect
(filename)[source]¶ returns the accessor class that should be used to process filename
-
tkp.accessors.detection.
fits_detect
(filename)[source]¶ Detect which telescope produced FITS data, return corresponding accessor.
Checks for known FITS image types where we expect additional metadata. If the telescope is unknown we default to a regular FitsImage.