astrohack.extract_holog

Module Contents

Classes

HologObsDict

ddi –> map –> ant, scan

Functions

extract_holog(ms_name: str, point_name: str, holog_name: str = None, holog_obs_dict: HologObsDict = None, ddi: Union[int, List[int], str] = 'all', baseline_average_distance: Union[float, str] = 'all', baseline_average_nearest: Union[float, str] = 'all', data_column: str = 'CORRECTED_DATA', time_smoothing_interval: float = None, parallel: bool = False, overwrite: bool = False) → Union[astrohack.mds.AstrohackHologFile, None]

Extract holography and optionally pointing data, from measurement set. Creates holography output file.

generate_holog_obs_dict(ms_name: str, point_name: str, baseline_average_distance: str = 'all', baseline_average_nearest: str = 'all', parallel: bool = False) → HologObsDict

Generate holography observation dictionary, from measurement set..

model_memory_usage(ms_name: str, holog_obs_dict: HologObsDict = None) → int

Determine the approximate memory usage per core of a given measurement file.

class HologObsDict(obj: JSON)[source]

ddi –> map –> ant, scan | o–> map: [reference, …]

extract_holog(ms_name: str, point_name: str, holog_name: str = None, holog_obs_dict: HologObsDict = None, ddi: Union[int, List[int], str] = 'all', baseline_average_distance: Union[float, str] = 'all', baseline_average_nearest: Union[float, str] = 'all', data_column: str = 'CORRECTED_DATA', time_smoothing_interval: float = None, parallel: bool = False, overwrite: bool = False)Union[astrohack.mds.AstrohackHologFile, None][source]

Extract holography and optionally pointing data, from measurement set. Creates holography output file.

Parameters
  • ms_name (str) – Name of input measurement file name.

  • point_name – Name of <point_name>.point.zarr file to use. This is must be provided.

  • holog_name (str) – Name of <holog_name>.holog.zarr file to create. Defaults to measurement set name with

holog.zarr extension. :type holog_name: str, optional

Parameters
  • holog_obs_dict (dict, optional) – The holog_obs_dict describes which scan and antenna data to extract from the measurement set. As detailed below, this compound dictionary also includes important metadata needed for preprocessing and extraction of the holography data from the measurement set. If not specified holog_obs_dict will be generated. For auto generation of the holog_obs_dict the assumption is made that the same antenna beam is not mapped twice in a row (alternating sets of antennas is fine). If the holog_obs_dict is specified, the ddi input is ignored. The user can self generate this dictionary using generate_holog_obs_dict.

  • ddi (int numpy.ndarray | int list, optional) – DDI(s) that should be extracted from the measurement set. Defaults to all DDI’s in the ms.

  • baseline_average_distance (float, optional) – To increase the signal-to-noise for a mapping antenna multiple reference antennas can be used. The baseline_average_distance is the acceptable distance (in meters) between a mapping antenna and a reference antenna. The baseline_average_distance is only used if the holog_obs_dict is not specified. If no distance is specified all reference antennas will be used. baseline_average_distance and baseline_average_nearest can not be used together.

  • baseline_average_nearest (int, optional) – To increase the signal-to-noise for a mapping antenna multiple reference antennas can be used. The baseline_average_nearest is the number of nearest reference antennas to use. The baseline_average_nearest is only used if the holog_obs_dict is not specified. baseline_average_distance and baseline_average_nearest can not be used together.

  • data_column (str, optional, ex. DATA, CORRECTED_DATA) – Determines the data column to pull from the measurement set. Defaults to “CORRECTED_DATA”.

  • time_smoothing_interval (float, optional) – Determines the time smoothing interval, set to the integration time when None.

  • parallel (bool, optional) – Boolean for whether to process in parallel, defaults to False.

  • overwrite (bool, optional) – Boolean for whether to overwrite current holog.zarr and point.zarr files, defaults to False.

Returns

Holography holog object.

Return type

AstrohackHologFile

AstrohackHologFile

Holog object allows the user to access holog data via compound dictionary keys with values, in order of depth, ddi -> map -> ant. The holog object also provides a summary() helper function to list available keys for each file. An outline of the holog object structure is show below:

holog_mds =
{
    ddi_0:{
        map_0:{
         ant_0: holog_ds,
                  ⋮
         ant_n: holog_ds
        },
        ⋮
        map_p: …
    },
    ⋮
    ddi_m: …
}

Example Usage In this case the pointing file has already been created. In addition, the appropriate data_column value nees to be set for the type of measurement set data you are extracting.

from astrohack.extract_holog import extract_holog

holog_mds = extract_holog(
    ms_name="astrohack_observation.ms",
    point_name="astrohack_observation.point.ms",
    holog_name="astrohack_observation.holog.ms",
    data_column='CORRECTED_DATA',
    parallel=True,
    overwrite=True
)

Additional Information

This function extracts the holography related information from the given measurement file. The data is restructured into an astrohack file format and saved into a file in the form of <holog_name>.holog.zarr. The extension .holog.zarr is used for all holography files. In addition, the pointing information is recorded into a holography file of format <pointing_name>.point.zarr. The extension .point.zarr is used for all holography pointing files.

holog_obs_dict[holog_mapping_id] (dict): holog_mapping_id is a unique, arbitrary, user-defined integer assigned to the data that describes a single complete mapping of the beam.

This is needed for two reasons:

  • A complete mapping of the beam can be done over more than one scan (for example the VLA data).

  • A measurement set can contain more than one mapping of the beam (for example the ALMA data).

holog_obs_dict[holog_mapping_id][scans] (int | numpy.ndarray | list): All the scans in the measurement set the holog_mapping_id.

holog_obs_dict[holog_mapping_id][ant] (dict): The dictionary keys are the mapping antenna names and the values a list of the reference antennas. See example below.

The below example shows how the holog_obs_description dictionary should be laid out. For each holog_mapping_id the relevant scans and antennas must be provided. For the ant key, an entry is required for each mapping antenna and the accompanying reference antenna(s).

holog_obs_description = {
    'map_0' :{
        'scans':[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22],
        'ant':{
            'DA44':[
                'DV02', 'DV03', 'DV04',
                'DV11', 'DV12', 'DV13',
                'DV14', 'DV15', 'DV16',
                'DV17', 'DV18', 'DV19',
                'DV20', 'DV21', 'DV22',
                'DV23', 'DV24', 'DV25'
            ]
        }
    }
}
generate_holog_obs_dict(ms_name: str, point_name: str, baseline_average_distance: str = 'all', baseline_average_nearest: str = 'all', parallel: bool = False)HologObsDict[source]

Generate holography observation dictionary, from measurement set..

Parameters
  • ms_name (str) – Name of input measurement file name.

  • baseline_average_distance – To increase the signal-to-noise for a mapping antenna multiple reference

antennas can be used. The baseline_average_distance is the acceptable distance between a mapping antenna and a reference antenna. The baseline_average_distance is only used if the holog_obs_dict is not specified. If no distance is specified all reference antennas will be used. baseline_average_distance and baseline_average_nearest can not be used together. :type baseline_average_distance: float, optional

Parameters

baseline_average_nearest – To increase the signal-to-noise for a mapping antenna multiple reference antennas

can be used. The baseline_average_nearest is the number of nearest reference antennas to use. The baseline_average_nearest is only used if the holog_obs_dict is not specified. baseline_average_distance and baseline_average_nearest can not be used together. :type baseline_average_nearest: int, optional

Parameters
  • point_name (str, optional) – Name of <point_name>.point.zarr file to use.

  • parallel (bool, optional) – Boolean for whether to process in parallel. Defaults to False

Returns

holog observation dictionary

Return type

json

AstrohackHologFile

Holog object allows the user to access holog data via compound dictionary keys with values, in order of depth, ddi -> map -> ant. The holog object also provides a summary() helper function to list available keys for each file. An outline of the holog object structure is show below:

holog_mds =
{
    ddi_0:{
        map_0:{
         ant_0: holog_ds,
                  ⋮
         ant_n: holog_ds
        },
        ⋮
        map_p: …
    },
    ⋮
    ddi_m: …
}

Example Usage In this case the pointing file has already been created.

from astrohack.extract_holog import generate_holog_obs_dict

holog_obs_obj = generate_holog_obs_dict(
    ms_name="astrohack_observation.ms",
    point_name="astrohack_observation.point.zarr"
)

Additional Information

holog_obs_dict[holog_mapping_id] (dict): holog_mapping_id is a unique, arbitrary, user-defined integer assigned to the data that describes a single complete mapping of the beam.

This is needed for two reasons:

  • A complete mapping of the beam can be done over more than one scan (for example the VLA data).

  • A measurement set can contain more than one mapping of the beam (for example the ALMA data).

holog_obs_dict[holog_mapping_id][scans] (int | numpy.ndarray | list): All the scans in the measurement set the holog_mapping_id.

holog_obs_dict[holog_mapping_id][ant] (dict): The dictionary keys are the mapping antenna names and the values a list of the reference antennas. See example below.

The below example shows how the holog_obs_description dictionary should be laid out. For each holog_mapping_id the relevant scans and antennas must be provided. For the ant key, an entry is required for each mapping antenna and the accompanying reference antenna(s).

holog_obs_description = {
    'map_0' :{
        'scans':[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22],
        'ant':{
            'DA44':[
                'DV02', 'DV03', 'DV04',
                'DV11', 'DV12', 'DV13',
                'DV14', 'DV15', 'DV16',
                'DV17', 'DV18', 'DV19',
                'DV20', 'DV21', 'DV22',
                'DV23', 'DV24', 'DV25'
            ]
        }
    }
}
model_memory_usage(ms_name: str, holog_obs_dict: HologObsDict = None)int[source]

Determine the approximate memory usage per core of a given measurement file.

Parameters
  • ms_name (str) – Measurement file name

  • holog_obs_dict (HologObsDict, optional) – Holography observations dictionary.

Returns

Memory per core

Return type

int