luv_finder.matchedfilter¶
Grid-search matched filter for spectral lines in the UV plane, in JAX (float64).
Per window and trial source shape, luv_finder.kernel collapses the visibilities, weighted
by the source’s own visibility amplitude, onto every trial position: the dirty spectrum
d = sig / W with variance 1 / W. At every position and channel the model is
d = A g + P c, the Gaussian line template g on a polynomial continuum P c in the
channel index. With c free, A is the fit of the template projected off the polynomials,
h = g - P (P^T W P)^-1 P^T W g: A = h^T W d / h^T W h. A polynomial cannot mimic a narrow
Gaussian, so no line-free channels are needed; the line loses only the polynomial-like part of
g. The error of A includes the channel correlation measured on the jackknife, so the S/N
has unit variance under the null.
Module Attributes
The value of a search axis a grid leaves out: the phase centre, a point source, a 100 km/s line. |
|
A line whose response peaks at |
|
A line whose response peaks at |
|
Template FWHM a line masks from the continuum of its position ( |
|
The brightest peaks per position that may mask (a position rarely holds more lines at |
|
Arrays of a block's positions x templates x centres that |
|
FWHM of a grid's default source shape, a point to the filter, in units of the resolution (a sigma of 1/10). |
|
Template FWHMs (km/s) a grid searches unless it names its own. |
Functions
|
Grid ranges from YAML, positions in the dataset's sky frame (arcsec from the reference). |
|
Combine the PB-corrected searches of a mosaic's pointings on the union of their grids, one at a time. |
|
A continuum per window ( |
|
The continuum per window of in-memory |
|
One search axis of a grid YAML: a value, a list, or |
|
The search of one pointing corrected for its primary beam (a copy; |
|
Search every field (or |
|
Windows ( |
Classes
|
S/N of one field over the |
|
Matched-filter search of one pointing or of a mosaic. |
- luv_finder.matchedfilter.CONTINUUM_MASK_FWHM = 2.0¶
Template FWHM a line masks from the continuum of its position (
_continuum()): a Gaussian line keeps 1.8% of its flux beyond 1 FWHM, 0.9 sigma of a S/N 100 line’s continuum, and 1e-6 beyond 2.
- luv_finder.matchedfilter.GRID_DEFAULTS = {'bmaj': 0.0, 'bmin': 0.0, 'ddec': 0.0, 'dra': 0.0, 'pa': 0.0, 'width': 100.0}¶
The value of a search axis a grid leaves out: the phase centre, a point source, a 100 km/s line.
- luv_finder.matchedfilter.MASK_FWHM = 1.0¶
A line whose response peaks at
MASK_SNRor more at a position is left out of the continuum fit there, withinMASK_FWHMtemplate FWHM of its peak, so it does not bend the continuum of the others.
- luv_finder.matchedfilter.MASK_PEAKS = 4¶
The brightest peaks per position that may mask (a position rarely holds more lines at
MASK_SNR).
- luv_finder.matchedfilter.MASK_SNR = 5.0¶
A line whose response peaks at
MASK_SNRor more at a position is left out of the continuum fit there, withinMASK_FWHMtemplate FWHM of its peak, so it does not bend the continuum of the others.
- class luv_finder.matchedfilter.MatchedFilter(data: DataHandler, grid: dict, continuum_order: int | None = 1, channel_noise: str | dict | None = 'measure', band: tuple[float, float] | None = None, core: tuple[float, float] | None = None, lines: bool = True)[source]¶
S/N of one field over the
gridaxes (GRID_KEYS: a value or a list each, elseGRID_DEFAULTS, e.g. frombuild_grid());channel_noise: “measure”, None or{spw: ChannelNoise}.band(Hz, low and high) keeps the trial centres there, a chunk of a long spectrum: every window is still fitted over all its centres, so its continuum and its masks are those of the whole spectrum.core(Hz) the windows whose continuum this search gives, those centred in it (None: every window), so the chunks of a spectrum give each window’s continuum once. Withoutlinesonly the continuum is computed, over every channel (a model’s response, say).
- luv_finder.matchedfilter.POINT = 0.23550000000000001¶
FWHM of a grid’s default source shape, a point to the filter, in units of the resolution (a sigma of 1/10).
- luv_finder.matchedfilter.SPECTRAL_ARRAYS = 4¶
Arrays of a block’s positions x templates x centres that
_spectral()holds at once (measured on ASPECS 3 mm, 2026-10-22): it sizes the position blocks, so a window’s spectral fit stays withinBLOCK_BYTES.
- class luv_finder.matchedfilter.SearchResult(axes: dict, freqs: ndarray, snr: ndarray, error: ndarray, coverage: ndarray, jackknife: SearchResult | None = None, continuum: SearchResult | None = None)[source]¶
Matched-filter search of one pointing or of a mosaic.
- continuum: SearchResult | None = None¶
The flat-spectrum continuum per window, a search with one “channel” per window (
continuum()).
- luv_finder.matchedfilter.WIDTHS = (50.0, 100.0, 300.0, 500.0)¶
Template FWHMs (km/s) a grid searches unless it names its own.
- luv_finder.matchedfilter.build_grid(data: DataHandler, cfg: dict | None) dict[source]¶
Grid ranges from YAML, positions in the dataset’s sky frame (arcsec from the reference).
- luv_finder.matchedfilter.combine_pointings(results: Iterable[SearchResult], span: tuple | None = None, own: bool = False) SearchResult[source]¶
Combine the PB-corrected searches of a mosaic’s pointings on the union of their grids, one at a time.
span(dra,ddec), the union’s axes if known, is allocated with the first pointing, so the sums never grow (and are never copied) as the pointings come;ownresults are spent on their sums.
- luv_finder.matchedfilter.continuum(windows: SearchResult, freq: float | None = None) SearchResult[source]¶
A continuum per window (
SearchResult.continuum) as one: the windows combined by inverse variance, a single “channel” atfreqHz, by default their mean frequency weighted alike; its jackknife alike.
- luv_finder.matchedfilter.continuum_response(data: DataHandler, grid_cfg: dict | None, pb_limit: float = 0.2, cores: int | None = None) SearchResult[source]¶
The continuum per window of in-memory
data(a model’s visibilities, say) on the search’s grid: every field PB-corrected and combined assearch_pointings()does, over every channel.
- luv_finder.matchedfilter.grid_axis(cfg: dict | None, key: str, default) ndarray[source]¶
One search axis of a grid YAML: a value, a list, or
{start, stop, step};defaultif absent.
- luv_finder.matchedfilter.pb_corrected(result: SearchResult, data: DataHandler, pb_limit: float = 0.2) SearchResult[source]¶
The search of one pointing corrected for its primary beam (a copy;
resultis left as it is).
- luv_finder.matchedfilter.search_pointings(path: str, grid_cfg: dict | None = None, jackknife: bool = True, cores: int | None = None, pb_limit: float = 0.2, fields: list[int] | None = None, subtract: Callable[[DataHandler], DataHandler] | None = None, **filter_kwargs) SearchResult[source]¶
Search every field (or
fields) of a measurement set or NPZ, PB-corrected, and combine them on one sky grid as they come;subtracttakes each field’s data to what is searched (a model’s residual).
- luv_finder.matchedfilter.window_groups(freqs: dict, widest: float = 500.0) list[list][source]¶
Windows (
{key: freq}) joined where they overlap or their gap is narrower thanwidestkm/s.A line no wider than the widest template is then searched and fitted in every window that holds it. The groups, each a sorted list of keys, come in frequency order.