sourcefinder.accessors.detection#

Attributes#

Classes#

Functions#

casa_detect(filename)

Detect which telescope produced CASA data, return corresponding accessor.

detect(filename)

Determine the accessor class to process the given file.

fits_detect(filename)

Detect which telescope produced FITS data, return corresponding accessor.

iscasa(filename)

Determine if the given filename corresponds to a LOFAR CASA directory.

isfits(filename)

Check if the given file is a FITS file.

islofarhdf5(filename)

Check if the given file is a LOFAR HDF5 container.

Module Contents#

class sourcefinder.accessors.detection.FitsTest[source]#

Bases: tuple

accessor[source]#
test[source]#
sourcefinder.accessors.detection.casa_detect(filename)[source]#

Detect which telescope produced CASA data, return corresponding accessor.

This function identifies the telescope that produced the CASA data by checking for known CASA table types with expected metadata. If the telescope cannot be determined, it returns None.

Parameters:
filenamestr

The path to the CASA table to be analyzed.

Returns:
subclass of FitsImage or None

The accessor class corresponding to the detected telescope, or None if the telescope is unknown.

sourcefinder.accessors.detection.detect(filename)[source]#

Determine the accessor class to process the given file.

This function checks the format of the provided file and returns the appropriate accessor class to handle it. It supports FITS files, CASA directories, and LOFAR HDF5 containers. If the format is unsupported, an OSError is raised.

Parameters:
filenamestr

The path to the file or directory to be processed.

Returns:
FitsImage or subclass

The accessor class corresponding to the detected file format.

Raises:
OSError

If the file format is unsupported.

sourcefinder.accessors.detection.fits_detect(filename)[source]#

Detect which telescope produced FITS data, return corresponding accessor.

This function identifies the telescope that produced the FITS data by checking for known FITS image types with expected metadata. If the telescope cannot be determined, it defaults to using a regular FitsImage accessor.

Parameters:
filenamestr

The path to the FITS file to be analyzed.

Returns:
FitsImage or subclass

The accessor class corresponding to the detected telescope.

sourcefinder.accessors.detection.iscasa(filename)[source]#

Determine if the given filename corresponds to a LOFAR CASA directory.

This function checks if the specified directory exists, contains the expected files for a CASA table and can be opened using the casacore.tables.table module.

Parameters:
filenamestr

The path to the directory to be checked.

Returns:
bool

True if the directory is a valid LOFAR CASA directory, False otherwise.

sourcefinder.accessors.detection.isfits(filename)[source]#

Check if the given file is a FITS file.

This function verifies whether the specified file exists, has a .fits extension, and can be opened using the astropy.io.fits module.

Parameters:
filenamestr

The path to the file to be checked.

Returns:
bool

True if the file is a valid FITS file, False otherwise.

sourcefinder.accessors.detection.islofarhdf5(filename)[source]#

Check if the given file is a LOFAR HDF5 container.

This function verifies whether the specified file exists, has a .h5 extension, and can be opened using the casacore.images.image module.

Parameters:
filenamestr

The path to the file to be checked.

Returns:
bool

True if the file is a valid LOFAR HDF5 container, False otherwise.

sourcefinder.accessors.detection.casa_telescope_keyword_mapping[source]#
sourcefinder.accessors.detection.casafiles = ('table.dat', 'table.f0', 'table.f0_TSM0', 'table.info', 'table.lock')[source]#
sourcefinder.accessors.detection.fits_type_mapping[source]#
sourcefinder.accessors.detection.logger[source]#