valska.beam_metrics

Functions

chromaticity_test(freq_array, test_param)

Test the variation of a parameter with frequency.

fit_beam_width_vs_frequency(freq, theta_deg, ...)

Fit beam shape vs frequency using lmfit.

lst_formatter(x, pos)

Format LST in hours, wrapped to [0, 24).

plot_2d_lst_deg(ax, data, extent, ...[, cmap])

Plot a 2D image with: - Left y-axis: LST (hours) - Right y-axis: angular separation (degrees)

plot_baseline_heatmap(ax, data, bl_counts, ...)

Baseline vs angle heatmap with axes: - Left: LST (hours) - Right: Angle (deg) - External colorbar

plot_beam_shape(ax, theta_deg, ydata, freq)

Plot the beam shape (normalized response) along with Gaussian and Airy fits.

plot_spectrum(ax, freq_array, parameter, ...)

Plot spectrum

plot_waterfall_matplotlib(ax, data, freqs, ...)

Create a waterfall plot (frequency vs LST).

Classes

BeamMetrics(filename)

Loader(stream)

Initialize the scanner.

SimulationConfig([latitude, sigma, ...])

class valska.beam_metrics.BeamMetrics(filename: str)
check_beam(save_path: str | Path | None = None, show: bool = True)

Check beam parameters from pyuvsim data and produce validation report and plots.

compute_beam_metrics()

Compute beam metrics

make_plots(gauss_result, airy_result, fit_vs_freq, save_path: str | Path | None = None, show: bool = True)

Create diagnostic plots

prepare_uv_data(uvd: pyuvdata.UVData)

Resize and prepare UV data

read_simulation_config(beam_parameters: str)

Read in the simulation config information

class valska.beam_metrics.Loader(stream)

Initialize the scanner.

class valska.beam_metrics.SimulationConfig(latitude: float | None = None, sigma: float | None = None, beam_shape: str | None = None, diameter: float | None = None)
valska.beam_metrics._airy(theta: ndarray[tuple[Any, ...], dtype[_ScalarT]], freq_hz: float, A: float, theta0: float, diam: float) ndarray[tuple[Any, ...], dtype[_ScalarT]]

Airy power beam for a circular aperture.

valska.beam_metrics.chromaticity_test(freq_array: ndarray[tuple[Any, ...], dtype[_ScalarT]], test_param: ndarray[tuple[Any, ...], dtype[_ScalarT]]) float

Test the variation of a parameter with frequency.

Parameters

freq_array :

Frequency array.

test_param :

The parameter to test against frequency.

valska.beam_metrics.fit_beam_width_vs_frequency(freq: ndarray[tuple[Any, ...], dtype[_ScalarT]], theta_deg: ndarray[tuple[Any, ...], dtype[_ScalarT]], v_auto: ndarray[tuple[Any, ...], dtype[_ScalarT]], shape: str) tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ModelResult | None, ModelResult | None]

Fit beam shape vs frequency using lmfit.

Parameters

freq :

Frequency in Hz

theta_deg :

Angular coordinate in degrees.

v_auto :

Visibility data with shape (angle, frequency).

shape :

Either “GaussianBeam” or “AiryBeam”.

Returns

fit_vs_freq :

Gaussian FWHM values at each frequency.

gauss_result :

Gaussian result at middle frequency.

airy_result :

Airy result at middle frequency.

valska.beam_metrics.lst_formatter(x: float, pos: int) str

Format LST in hours, wrapped to [0, 24).

valska.beam_metrics.plot_2d_lst_deg(ax: matplotlib.axes.Axes, data: ndarray[tuple[Any, ...], dtype[floating | complexfloating]], extent: tuple[float, float, float, float], lsts_hours: ndarray[tuple[Any, ...], dtype[floating]], theta_deg: ndarray[tuple[Any, ...], dtype[floating]], cmap: str = 'viridis') matplotlib.axes.Axes

Plot a 2D image with: - Left y-axis: LST (hours) - Right y-axis: angular separation (degrees)

valska.beam_metrics.plot_baseline_heatmap(ax: matplotlib.axes.Axes, data: ndarray[tuple[Any, ...], dtype[floating | complexfloating]], bl_counts: ndarray[tuple[Any, ...], dtype[integer]], lsts_hours: ndarray[tuple[Any, ...], dtype[floating]], theta_deg: ndarray[tuple[Any, ...], dtype[floating]], freq: float, cmap: str = 'viridis') matplotlib.axes.Axes

Baseline vs angle heatmap with axes: - Left: LST (hours) - Right: Angle (deg) - External colorbar

valska.beam_metrics.plot_beam_shape(ax: matplotlib.axes.Axes, theta_deg: ndarray[tuple[Any, ...], dtype[_ScalarT]], ydata: ndarray[tuple[Any, ...], dtype[_ScalarT]], freq: float, gauss_result: ModelResult | None = None, airy_result: ModelResult | None = None) list[matplotlib.lines.Line2D]

Plot the beam shape (normalized response) along with Gaussian and Airy fits.

Parameters

ax :

The axes on which to plot the data.

theta_deg :

The angle array.

ydata :

The data to plot.

gauss_result :

Result from the Gaussian fit.

airy_result :

Result from the Airy fit.

valska.beam_metrics.plot_spectrum(ax: matplotlib.axes.Axes, freq_array: ndarray[tuple[Any, ...], dtype[_ScalarT]], parameter: ndarray[tuple[Any, ...], dtype[_ScalarT]], ylabel: str, title: str) list[matplotlib.lines.Line2D]

Plot spectrum

valska.beam_metrics.plot_waterfall_matplotlib(ax: matplotlib.axes.Axes, data: ndarray[tuple[Any, ...], dtype[floating | complexfloating]], freqs: ndarray[tuple[Any, ...], dtype[floating]], lsts_hours: ndarray[tuple[Any, ...], dtype[floating]], theta_deg: ndarray[tuple[Any, ...], dtype[floating]], cmap: str = 'viridis') matplotlib.axes.Axes

Create a waterfall plot (frequency vs LST).