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.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.sourcefinder_image_from_accessor(image, **args)[source]

Create a source finder ImageData object from an image ‘accessor’

Parameters:image (-) – FITS/AIPS/HDF5 image available through an accessor.
Returns:a source finder image.
Return type:(tkp.sourcefinder.image.ImageData)
tkp.accessors.writefits(data, filename, header={})[source]

Dump a NumPy array to a FITS file.

Key/value pairs for the FITS header can be supplied in the optional header argument as a dictionary.

tkp.accessors.detection – File type detection

class tkp.accessors.detection.FitsTest(accessor, test)

Create new instance of FitsTest(accessor, test)

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.

tkp.accessors.detection.iscasa(filename)[source]

returns True if filename is a lofar casa directory

tkp.accessors.detection.isfits(filename)[source]

returns True if filename is a fits file

tkp.accessors.detection.islofarhdf5(filename)[source]

returns True if filename is a hdf5 container