ska_sdp_spectral_line_imaging.data_procs.model module

ska_sdp_spectral_line_imaging.data_procs.model.report_peak_visibility(visibility, unit)[source]
ska_sdp_spectral_line_imaging.data_procs.model.apply_power_law_scaling(image, frequency_range, reference_frequency=None, spectral_index=0.75, freq_chunks=None)[source]

Apply power law scaling on a continuum image and return a scaled cube.

The "image" must be a xarray dataarray. If "frequency" dimension of size 1 is present in image, then that value is used as reference frequency for scaling. Else, user can pass any reference frequency as "reference_frequency" argument, which takes preference.

If "data" attribute of image is a dask array, then this will return a dataarray which wraps a new dask array containing operations for power law scaling. This means, the values in returned dataarray are not computed eagerly.

The formula for power law scaling is given as:

\[S2 = S1 * ( \nu2 / \nu1 ) ^ {-\alpha}\]
Parameters:
  • image (DataArray) -- Image data array. The "data" attribute of dataarray can either be a numpy array or a dask array. The shape can either be 2D (x, y) or 3D (x, y, polarisation)

  • frequency_range (ndarray) -- Frequency range in hertz over which to scale the data.

  • reference_frequency (float, default: None) -- Refernce frequency in hertz. If not passed, function expects that a frequency coordinate is present in the image. If passed, this takes priority over the frequency cordinates of image.

  • spectral_index (float, default: 0.75) -- Spectral index (alpha) used in power law scaling.

  • freq_chunks (Tuple[int], default: None) -- Chunks corresponding to frequency channel By default, frequency dimension will not be chunked

Return type:

DataArray

Returns:

A 3D or 4D scaled spectral cube

ska_sdp_spectral_line_imaging.data_procs.model.fit_polynomial_on_visibility(data)[source]

Perform polynomial fit across frequency axis.

Parameters:

data (DataArray) -- A DataArray with dimensions ["time", "baseline_id", "polarization", "frequencies"] in any sequence.

Return type:

Delayed

Returns:

A dask delayed call to numpy polynomial polyfit function On compute, it should return a numpy array containing the result of polynomial.polyfit