sourcefinder.accessors.dataaccessor#

Attributes#

Classes#

DataAccessor

Base class for accessors used with

Module Contents#

class sourcefinder.accessors.dataaccessor.DataAccessor[source]#

Base class for accessors used with sourcefinder.image.ImageData.

Data accessors provide a uniform way for the ImageData class (i.e., generic image representation) to access the various ways in which images may be stored (FITS files, arrays in memory, potentially HDF5, etc.).

This class cannot be instantiated directly, but should be subclassed and the abstract properties provided. Note that all abstract properties are required to provide a valid accessor.

Additional properties may also be provided by subclasses. However, TraP components are required to degrade gracefully in the absence of these optional properties.

Attributes:
beamtuple

Restoring beam. Tuple of three floats: semi-major axis (in pixels), semi-minor axis (pixels), and position angle (radians).

centre_rafloat

Right ascension at the central pixel of the image. Units of J2000 decimal degrees.

centre_declfloat

Declination at the central pixel of the image. Units of J2000 decimal degrees.

datanumpy.ndarray

Two-dimensional numpy.ndarray of floating point pixel values.

freq_bwfloat

The frequency bandwidth of this image in Hz.

freq_efffloat

Effective frequency of the image in Hz. That is, the mean frequency of all the visibility data which comprises this image.

pixelsizetuple

(x, y) tuple representing the size of a pixel along each axis in units of degrees.

tau_timefloat

Total time on sky in seconds.

taustart_tsfloat

Timestamp of the first integration which constitutes part of this image. MJD in seconds.

urlstr

A URL representing the location of the image at the time of processing.

wcssourcefinder.utility.coordinates.WCS

An instance of sourcefinder.utility.coordinates.WCS, describing the mapping from data pixels to sky-coordinates.

Notes

The class also provides some common functionality: static methods used for parsing data files, and an ‘extract_metadata’ function which provides key info in a simple dict format.

static degrees2pixels(bmaj, bmin, bpa, deltax, deltay) tuple[float, float, float][source]#

Convert beam in degrees to beam in pixels and radians. For example, FITS beam parameters are in degrees.

Parameters:
bmajfloat

Beam major axis in degrees.

bminfloat

Beam minor axis in degrees.

bpafloat

Beam position angle in degrees.

deltaxfloat

Pixel size along the x-axis in degrees.

deltayfloat

Pixel size along the y-axis in degrees.

Returns:
semimajfloat

Beam semi-major axis in pixels.

semiminfloat

Beam semi-minor axis in pixels.

thetafloat

Beam position angle in radians.

Return type:

tuple[float, float, float]

extract_metadata() dict[source]#

Massage the class attributes into a flat dictionary with database-friendly values.

While rather tedious, this is easy to serialize and store separately to the actual image data.

May be extended by subclasses to return additional data.

Returns:
dict

A dictionary containing key-value pairs of class attributes formatted for database storage.

Return type:

dict

parse_pixelsize() tuple[float, float][source]#

Parse pixel size.

Returns:
deltaxfloat

Pixel size along the x axis in degrees.

deltayfloat

Pixel size along the y axis in degrees.

Return type:

tuple[float, float]

beam: tuple[float, float, float] | None = None[source]#
centre_decl: float[source]#
centre_ra: float[source]#
conf: sourcefinder.config.ImgConf | None = None[source]#
data: numpy.ndarray[source]#
freq_bw: float[source]#
freq_eff: float[source]#
pixelsize: tuple[source]#
tau_time: float[source]#
taustart_ts: float[source]#
url: str[source]#
wcs: sourcefinder.utility.coordinates.WCS[source]#
sourcefinder.accessors.dataaccessor.logger[source]#