sourcefinder.accessors.lofarcasaimage#
This module implements the CASA LOFAR data container format, described in this document:
http://www.lofar.org/operations/lib/exe/fetch.php?media=:public:documents :casa_image_for_lofar_0.03.00.pdf
Attributes#
Classes#
Use casacore to pull image data out of a CASA table. |
Module Contents#
- class sourcefinder.accessors.lofarcasaimage.LofarCasaImage(url, plane=0, beam=None)[source]#
Bases:
sourcefinder.accessors.casaimage.CasaImage,sourcefinder.accessors.lofaraccessor.LofarAccessorUse casacore to pull image data out of a CASA table.
This accessor assumes the casatable contains the values described in the CASA Image description for LOFAR. 0.03.00.
- Parameters:
- urlstr
Location of the CASA table.
- planeint, default: 0
If the data is a datacube, specifies which plane to use.
- beamtuple, default: None
Beam parameters in degrees, in the form (bmaj, bmin, bpa). If not supplied, the method will attempt to read these from the header.
- static non_overlapping_time(series)[source]#
Calculate the sum of total time ranges without overlap.
- Parameters:
- serieslist of tuple
A list of 2-item tuples representing time ranges, where each tuple contains the start and end time of a range.
- Returns:
- float
The total length of all time ranges without overlap, most likely in seconds.
- static open_subtables(table)[source]#
Open all subtables defined in the LOFAR format.
- Parameters:
- tablecasacore.tables.table
A casacore table handler to a LOFAR CASA table.
- Returns:
- dict
A dictionary containing all LOFAR CASA subtables
- static parse_antennaset(subtables)[source]#
Extract the antenna set used in the observation.
This method retrieves the unique antenna set from the LOFAR_OBSERVATION subtable.
- Parameters:
- subtablesdict
A dictionary containing all LOFAR CASA subtables.
- Returns:
- numpy.ndarray
An array containing the unique antenna set used in the observation.
- Raises:
- Exception if multiple antenna sets are found.
Notes
The method uses the unique_column_values function from the CasaImage class to extract unique values from the “ANTENNA_SET” column.
- static parse_stations(subtables)[source]#
Extract the number of specific LOFAR stations used in the observation.
This method calculates the number of core, remote, and international LOFAR stations used based on the observation and antenna subtables.
- Parameters:
- subtablesdict
A dictionary containing all LOFAR CASA subtables.
- Returns:
- tuple
A tuple containing the number of core stations, remote stations, and international stations in the format (ncore, nremote, nintl).
Notes
The method uses the “NVIS_USED” column from the LOFAR_OBSERVATION subtable and the “NAME” column from the LOFAR_ANTENNA subtable to determine which stations were used. Stations are categorized based on their names:
Core stations start with “CS”.
Remote stations start with “RS”.
International stations have other prefixes.
- static parse_subbands(subtables)[source]#
Extract the number of subbands used in the observation.
This method retrieves the unique number of subbands from the LOFAR_ORIGIN subtable. If multiple values are found, an exception is raised.
- Parameters:
- subtablesdict
A dictionary containing all LOFAR CASA subtables.
- Returns:
- int
The number of subbands used in the observation.
- Raises:
- Exception
If varying numbers of channels are found in the subtable.
Notes
The method uses the unique_column_values function from the CasaImage class to extract unique values from the “NUM_CHAN” column.
- static parse_subbandwidth(subtables)[source]#
Calculate the subband width for the observation.
This method determines the subband width based on the clock frequency retrieved from the LOFAR_OBSERVATION subtable.
- Parameters:
- subtablesdict
A dictionary containing all LOFAR CASA subtables.
- Returns:
- float
The subband width in Hz.
- Raises:
- Exception
If multiple clock frequencies are found in the subtable.
Notes
The method uses the clock frequency and its unit to calculate the subband width. The clock frequency is divided by 1024 to determine the subband width. For more details, see: https://www.astron.nl/lofarwiki/doku.php?id=public:documents: raw_olap_data_formats&s[]=subband ‘base_subband_hz = clock_hz / 1024’
- static parse_taustartts(subtables)[source]#
Extract the image start time from the CASA table header.
- Parameters:
- subtablesdict
A dictionary containing all LOFAR CASA subtables.
- Returns:
- datetime.datetime
The earliest observation start time as a datetime object.
Notes
We sort the table in order of ascending start time then choose the first value to ensure we get the earliest possible starting time.