ska_sdp_wflow_pointing_offset.array_data_func module

Functions for manipulation of data. Currently, contains functions for:

  1. Applying static RFI mask

  2. Aligning pointing and visibility timestamps via interpolation

  3. Performing time-frequency-polarisation averaging of the visibility amplitudes or time only averaging or time and polarisation averaging of the gain amplitudes

  4. Extracting visibility or gain amplitudes for all discrete offset pointing scans

  5. Computing the weighted-average of the valid fitted pointing offsets

  6. Creating a PointingTable containing the pointing offsets

class ska_sdp_wflow_pointing_offset.array_data_func.ExtractPerScan(vis_list, on_sky_offsets_list, ants, fit_to_sep_pol=False)[source]

Bases: object

Extracts the visibility or gain amplitude and the antenna pointings for each scan required by the beam fitting routine.

Parameters:
  • vis_list – List of Visibility object

  • on_sky_offsets_list – A list of on-sky offsets in cross-elevation and elevation

  • ants – List of katpoint Antenna objects [nants]

  • fit_to_sep_pol – Fit primary beams to the parallel-hands gain or visibility amplitudes

from_gains(use_modelvis=False)[source]

Extracts the gain amplitude for all discrete pointing scans required by the beam fitting routine

Parameters:

use_modelvis – Use a model visibility

Returns:

on-sky offsets for all discrete pointing scans, the weighted-average gain amplitudes and their standard deviation for all discrete pointing scans, and 1D array of the averaged-frequency in each chunk in Hz

from_vis()[source]

Extracts the cross-correlation amplitudes for all discrete pointing scans required by the beam fitting routine

Returns:

on-sky offsets for all discrete pointing scans, the weighted-average visibility amplitudes and their standard deviations for all discrete pointing scans, and the frequency at the higher end of the band in Hz

ska_sdp_wflow_pointing_offset.array_data_func.apply_rfi_mask(freqs, channels, start_freq=None, end_freq=None, num_chunks=16)[source]

Apply RFI mask in HDF5 format pulled from the SKA Telescope Model Data Repository

Parameters:
  • freqs – 1D array of frequencies in MHz [nchan] if num_chunks=1 and 2D array of frequencies in MHz if num_chunks>1

  • channels – 1D array of channel numbers if num_chunks=1 and 2D array of channel numbers if num_chunks>1

  • num_chunks – Number of frequency chunks

Returns:

Filtered frequency and channel numbers array

ska_sdp_wflow_pointing_offset.array_data_func.create_offset_pointing_table(output_offsets, frequency_per_chunk, reference_mjd, reference_commanded_azel, vis_list, x_per_scan, track_duration)[source]

Writes the computed pointing offsets and other fitted parameters into a PointingTable.

The pointing offsets in cross-elevation and elevation in radians are stored as the pointing variable. The expected width in the H and V directions in radians are stored as the expected_width variable. The fitted width in the H and V directions in radians are stored as the fitted_width variable. The fitted height in arbitrary units is stored as the fitted_height variable. The uncertainties on the fitted width and height are stored as the fitted_width_std and fitted_height_std variables respectively. The uncertainties on the pointing offsets in the pointing variable are converted to weights as the inverse square of the uncertainties and stored as the weight variable.

Parameters:
  • output_offsets – A list of dictionary of the weighted-average pointing offsets output by array_data_func.weighted_average() when fitting to the parallel-hands amplitudes and a dictioanry of these pointing offsets when fitting to the Stokes I amplitudes.

  • frequency_per_chunk – 1D array of the averaged-frequency in each chunk in Hz [num_chunks]

  • reference_mjd – Reference timestamp (s) in MJD

  • reference_commanded_azel – Commanded AzEl at the reference_mjd in radians with dimension (nants, 2) when fitting to the gain amplitudes. When fitting to the visibility amplitudes, the dimension is (ntimes, nants, 2) where ntimes is the number of the reference_mjd which is expected to be 2

  • vis_list – List of Visibility

  • x_per_scan – The commanded pointings relative to the target in the reference pointing observation in xEl-El coordinates for one antenna with dimensions (nscans, 2)

  • track_duration – A list of how long each scan was tracked for in seconds

  • num_chunks – Number of frequency chunks (integer)

Returns:

PointingTable of the computed pointing offsets and other fitted parameters for each antenna

ska_sdp_wflow_pointing_offset.array_data_func.fitted_offsets_weighted_average(ants, fitted_beams, fit_to_vis=False)[source]

Compute the weighted average of the fitted pointing offsets.

Parameters:
  • ants – A list of katpoint Antenna objects [nants].

  • fitted_beams – A dictionary of the fitted beams obtained from beam_fitting.py.SolveForOffsets.fit_to_gains() or beam_fitting.py.SolveForOffsets.fit_to_vis().

  • fit_to_vis – Fit primary beam to cross-correlation visibility amplitudes instead of the antenna gain amplitudes.

Returns:

The weighted average of the valid fitted cross-elevation and elevation offsets and their standard deviations in radians, the theoretical and fitted beamwidths (and uncertainty) in radians, and the fitted height and its uncertainty for each dish.

ska_sdp_wflow_pointing_offset.array_data_func.interp_timestamps(origin_data, origin_times, new_times)[source]

Interpolate the on-sky offsets at the visibility timestamps.

Parameters:
  • origin_data – on-sky offsets in degrees with dimensions (nants, ntimes_origin, 2)

  • origin_times – Original times in MJD [ntimes_origin]

  • new_times – New times (from Visibility) [ntimes_new]

Returns:

Interpolated on-sky offsets in degrees with dimensions (nants, ntimes_new, 2)