Spectral filtering (ps_eor.filtering)#

High-pass spectral filtering for visibility cubes.

The filters remove frequency-smooth structure by subtracting a finite impulse response (FIR) low-pass model. Use high_pass_cube() for one common spectral scale, or high_pass_horizon() to set the scale from each baseline’s projected horizon delay. Both return a new cube and preserve the input geometry and weights:

filtered = high_pass_cube(cube, scale_channels=20)
filtered = high_pass_horizon(cube, geometry_factor=.7)
ps_eor.filtering.high_pass_fir(data, scale_channels=20, axis=0, numtaps=None, window=('kaiser', 8.0))[source]#

Subtract a low-pass FIR model along one array axis.

Real and imaginary parts are convolved independently, using reflected boundaries. scale_channels is the approximate smoothing scale in samples; values in (0, 1] return an unchanged copy.

Parameters:
  • data – input array, real or complex.

  • scale_channels – approximate low-pass smoothing scale in samples.

  • axis (int) – axis to filter.

  • numtaps (int) – FIR length. By default, use an odd length of at least 21 and approximately eight times scale_channels.

  • window – window specification accepted by scipy.signal.firwin().

Returns:

The high-pass residual with the same shape as data.

Return type:

ndarray

ps_eor.filtering.high_pass_cube(cube, scale_channels=20, numtaps=None, window=('kaiser', 8.0))[source]#

A copy of cube high-pass filtered along its frequency axis.

Parameters:
  • cube – a data cube whose first data axis is frequency.

  • scale_channels – approximate smoothing scale in channels.

  • numtaps – FIR settings passed to high_pass_fir().

  • window – FIR settings passed to high_pass_fir().

Returns:

the filtered cube, with the original coordinates, metadata, and copied weights.

Return type:

DataCube

ps_eor.filtering.high_pass_horizon(cube, geometry_factor, baseline_unit='wavelength', scale_factor=1.0, min_scale_channels=1.0, max_scale_channels=None, quantize_channels=0.5, numtaps=None, window=('kaiser', 8.0))[source]#

High-pass a cube using a horizon delay for each baseline.

For baseline length b, the projected delay is geometry_factor * b / c. It is converted to an FIR scale as scale_factor / (2 pi delay channel_width). Baselines with the same quantized scale are filtered together. Calculating the telescope- and time-dependent geometry_factor is deliberately left to the caller.

Parameters:
  • cube – Cartesian cube with data shaped (n_freqs, n_baselines).

  • geometry_factor – positive projected-delay factor for the observation.

  • baseline_unit – unit of cube.ru: 'wavelength' (converted at the mean observing frequency) or 'm'.

  • scale_factor – dimensionless multiplier in the delay-to-scale relation.

  • min_scale_channels – lower bound on the FIR scale.

  • max_scale_channels – optional upper bound on the FIR scale.

  • quantize_channels – round scales to this channel interval so baselines can share a filtering operation.

  • numtaps – FIR settings passed to high_pass_fir().

  • window – FIR settings passed to high_pass_fir().

Returns:

the filtered cube, with the original coordinates, metadata, and copied weights.

Return type:

DataCube