ska_ost_senscalc.mid.service

The service layer is responsible for turning validated inputs into the relevant calculation inputs, calling any calculation functions and collating the results.

class ska_ost_senscalc.mid.service.BeamArguments(frequency: float | int | None, zoom_frequencies: list[float | int] | None, dec: Angle, weighting: Weighting, robustness: int | None, calculator_mode: CalculatorMode, array_configuration: MIDArrayConfiguration, taper: float | Quantity | None, telescope: Telescope)[source]

BeamArguments is a dataclass holding arguments for a synthesised beam calculation.

This class is essentially a proxy for a typed Beam constructor signature. It was introduced as a temporary measure to make the code easier to read and reason about. It should be removed when Beam is refactored to:

  1. have a properly typed constructor signature

  2. make mandatory arguments mandatory in the constructor signature, not optional

  3. remove the runtime checking for mandatory arguments

  4. use the proper Exception types (ValueError, etc.), not RuntimeError.

Refactoring would make this class redundant. However, this is too large a refactoring to attempt ahead of the imminent first release so we use this intermediate adapter.

static from_params(params) BeamArguments[source]

Construct a WeightingParameters from a dictionary of parameters.

class ska_ost_senscalc.mid.service.BeamSizeResponse[source]

BeamSizeResponse is a typed dictionary constrained to match the schema of the JSON object outlining the synthesized beam size, as contained in the parent JSON result of a weighting endpoint query.

class ska_ost_senscalc.mid.service.ConfusionNoiseResponse[source]

ConfusionNoiseResponse is a typed dictionary constrained to match the schema of a confusion noise JSON object, as contained in the parent JSON result of a weighting endpoint query.

class ska_ost_senscalc.mid.service.SingleWeightingResponse[source]

SingleWeightingResponse is a typed dictionary constrained to match the schema of a single weighting calculation, as performed for the main continuum or zoom weighting calculation and for each chunk frequency. Child SingleWeightingResponse JSON object for each of these calculations are contained in the parent JSON result

class ska_ost_senscalc.mid.service.WeightingResponse[source]

WeightingResponse is a typed dictionary constrained to match the schema of the main result of a weighting endpoint query.

ska_ost_senscalc.mid.service.get_calculate_response(params)[source]

Using the parameters of the query return the appropriate values for the calculation.

ska_ost_senscalc.mid.service.get_chunks(n_chunks, obs_freq, bandwidth)[source]

Function to get the centres (and common width) of the N chunks of bandwidth

Parameters:
  • n_chunks (int) – Number of chunks

  • obs_freq (float) – Frequency

  • bandwidth (float) – Bandwidth

Returns:

A list of frequency centres for the chunks and the chunk width

Return type:

Tuple(List, float)

ska_ost_senscalc.mid.service.get_chunks_weighting_response(params: dict) list[ska_ost_senscalc.mid.service.SingleWeightingResponse][source]

Calculate the beam weighting response for every chunk frequency in the given parameters dict.

Input arguments and external state are not modified by this function.

Raises:

- None

ska_ost_senscalc.mid.service.get_single_weighting_response(beam_args: BeamArguments) SingleWeightingResponse[source]

Calculate the beam weighting from the given beam parameters.

Input arguments and external state are not modified by this function.

Raises:

- None

ska_ost_senscalc.mid.service.get_subarray_response()[source]

return the appropriate subarray objects

ska_ost_senscalc.mid.service.get_weighting_response(params: dict) WeightingResponse[source]

Using the parameters of the query return the appropriate values for weighting correction factor, synthesized-beam-sensitivity factor and beam shape.

Input arguments and external state are not modified by this function.

Raises:

- None