Observation#

class pyvisgen.simulation.observation.Observation(src_ra: float, src_dec: float, start_time: datetime, scan_duration: int | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], num_scans: int, scan_separation: int | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], integration_time: int | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], ref_frequency: float, frequency_offsets: list, bandwidths: list, fov: float, image_size: int, array_layout: str, corrupted: bool, device: str, dense: bool = False, sensitivity_cut: float = 1e-06, polarization: str = None, pol_kwargs: dict = {'amp_ratio': 0.5, 'delta': 0, 'random_state': 42}, field_kwargs: dict = {'order': [1, 1], 'random_state': 42, 'scale': [0, 1], 'threshold': None}, show_progress: bool = False)[source]#

Bases: object

Main observation simulation class. The Observation class simulates the baselines and time steps during the observation.

Parameters:
src_rafloat

Source right ascension coordinate.

src_decfloat

Source declination coordinate.

start_timedatetime

Observation start time.

scan_durationint

Scan duration.

num_scansint

Number of scans.

scan_separationint

Scan separation.

integration_timeint

Integration time.

ref_frequencyfloat

Reference frequency.

frequency_offsetslist

Frequency offsets.

bandwidthslist

Frequency bandwidth.

fovfloat

Field of view.

image_sizeint

Image size of the sky distribution.

array_layoutstr

Name of an existing array layout. See layouts.

corruptedbool

If True, apply corruption during the vis loop.

devicestr

Torch device to select for computation.

densebool, optional

If True, apply dense baseline calculation of a perfect interferometer. Default: False

sensitivity_cutfloat, optional

Sensitivity threshold, where only pixels above the value are kept. Default: 1e-6

polarizationstr, optional

Choose between 'linear' or 'circular' or None to simulate different types of polarizations or disable the simulation of polarization. Default: None

pol_kwargsdict, optional

Additional keyword arguments for the simulation of polarization. Default: {'delta': 0,'amp_ratio': 0.5,'random_state': 42}

field_kwargsdict, optional

Additional keyword arguments for the random polarization field that is applied when simulating polarization. Default: {'order': [1, 1],'scale': [0, 1],'threshold': None,'random_state': 42}

show_progressbool, optional

If True, show a progress bar during the iteration over the scans. Default: False

Notes

See polarization and rand_polarization_field for more information on the keyword arguments in pol_kwargs and field_kwargs, respectively.

Methods Summary

calc_baselines()

Initializes Baselines dataclass object and calls get_baselines() to compute the contents of the Baselines dataclass.

calc_dense_baselines()

Calculates the baselines of a densely-built antenna array, which would provide full coverage of the uv space.

calc_direction_cosines(ha, el_st, delta_x, ...)

Calculates direction cosines u, v, and w for given hour angles and relative antenna positions.

calc_feed_rotation(ha)

Calculates feed rotation for every antenna at every time step.

calc_ref_elev(time)

Calculates the station elevations for given time steps.

create_lm_grid()

Calculates sine projection for fov

create_rd_grid()

Calculates RA and Dec values for a given fov around a source position

create_scans()

Calculates individual scans of the observation based on the number of scans, their duration and the integration time.

get_baselines(times)

Calculates baselines from source coordinates and time of observation for every antenna station in array_layout.

Methods Documentation

calc_baselines()[source]#

Initializes Baselines dataclass object and calls get_baselines() to compute the contents of the Baselines dataclass.

calc_dense_baselines()[source]#

Calculates the baselines of a densely-built antenna array, which would provide full coverage of the uv space.

calc_direction_cosines(ha: tensor, el_st: tensor, delta_x: tensor, delta_y: tensor, delta_z: tensor)[source]#

Calculates direction cosines u, v, and w for given hour angles and relative antenna positions.

Parameters:
hatorch.tensor()

Tensor containing hour angles for each time step.

el_sttorch.tensor()

Tensor containing station elevations.

delta_xtorch.tensor()

Tensor containing relative antenna x-postions.

delta_ytorch.tensor()

Tensor containing relative antenna y-postions.

delta_ztorch.tensor()

Tensor containing relative antenna z-postions.

Returns:
utorch.tensor()

Tensor containing direction cosines in u-axis direction.

vtorch.tensor()

Tensor containing direction cosines in v-axis direction.

wtorch.tensor()

Tensor containing direction cosines in w-axis direction.

calc_feed_rotation(ha: Angle) Angle[source]#

Calculates feed rotation for every antenna at every time step.

Notes

The calculation is based on Equation (13.1) of Meeus’ Astronomical Algorithms:

\[q = \atan\left(\frac{\sin h}{\cos\delta \tan\varphi - \sin\delta \cos h\right),\]

where $h$ is the local hour angle, $varphi$ the geographical latitude of the observer, and $delta$ the declination of the source.

calc_ref_elev(time) tuple[source]#

Calculates the station elevations for given time steps.

Parameters:
timearray_like, optional

Array containing observation time steps.

Returns:
tuple

Tuple containing tensors of the Greenwich hour angle, antenna-local hour angles, and the elevations.

create_lm_grid()[source]#

Calculates sine projection for fov

Parameters:
rd_grid3d array

array containing a RA and Dec value in every pixel

src_crdastropy SkyCoord

source position

Returns:
lm_grid3d array

Returns a 3d array with every pixel containing an l and m value

create_rd_grid()[source]#

Calculates RA and Dec values for a given fov around a source position

Parameters:
fovfloat

FOV size

samplesint

number of pixels

src_ra

right ascensio of the source in deg

src_dec

dec of the source in deg

Returns:
rd_grid3d array

Returns a 3d array with every pixel containing a RA and Dec value

create_scans()[source]#

Calculates individual scans of the observation based on the number of scans, their duration and the integration time.

Returns:
list[Scan]:

List of scans with a specific start, stop and integration time

get_baselines(times)[source]#

Calculates baselines from source coordinates and time of observation for every antenna station in array_layout.

Parameters:
timestime object

time of observation

Returns:
dataclass object

baselines between telescopes with visibility flags