luv_finder.fit¶
Least-squares fit of catalogued lines in the visibilities, by Newton steps on per-channel moments.
The model in pointing p is a_p(nu) E(u, v) e^{+i phi}, a_p = PB_p F: an elliptical Gaussian
of sky covariance (s_ee, s_nn, s_en) whose spectrum F is a Gaussian line on a polynomial
continuum, its own in every spectral window that holds the line. Every derivative of E e^{+i phi}
in position and shape is itself times a polynomial
in (u, v), so one pass over the visibilities (point_moments()) gives
chi^2, its gradient and the Gauss-Newton matrix J^T W J in every parameter exactly. Errors are
2 (J^T W J)^-1, corrected for the channel correlation by a sandwich estimator over the channels.
Module Attributes
Quantities reported per line, each with an |
|
Lowest fitted line FWHM, km/s: a line a few channels wide would otherwise collapse below one channel, since the model samples a Gaussian at the channel centres (no Hanning or channel response). |
|
Channels a continuum fit averages: a bandwidth of this fraction of the frequency, whose smearing is that fraction of a source's offset from the phase centre (a few 0.1% of a beam at the PB's edge). |
|
Columns |
|
Columns |
|
Catalogue columns a fit starts from; the source shape defaults to a point. |
Functions
|
A copy of |
|
A copy of the continuum catalogue |
|
Fit one line, started from the matched filter's position, template shape (FWHM, arcsec) and width. |
|
A copy of |
|
The spw among |
|
The visibilities of fitted |
- luv_finder.fit.BIN_FRACTION = 0.001¶
Channels a continuum fit averages: a bandwidth of this fraction of the frequency, whose smearing is that fraction of a source’s offset from the phase centre (a few 0.1% of a beam at the PB’s edge).
- luv_finder.fit.COLUMNS = {'fit_bmaj': 'arcsec', 'fit_bmaj_error': 'arcsec', 'fit_bmin': 'arcsec', 'fit_bmin_error': 'arcsec', 'fit_chi2_reduced': None, 'fit_continuum': 'Jy', 'fit_continuum_error': 'Jy', 'fit_converged': None, 'fit_ddec': 'arcsec', 'fit_ddec_error': 'arcsec', 'fit_dec': 'deg', 'fit_dra': 'arcsec', 'fit_dra_error': 'arcsec', 'fit_freq_ghz': 'GHz', 'fit_freq_ghz_error': 'GHz', 'fit_line_flux': 'Jy km/s', 'fit_line_flux_error': 'Jy km/s', 'fit_n_pointings': None, 'fit_pa': 'deg', 'fit_pa_error': 'deg', 'fit_peak': 'Jy', 'fit_peak_error': 'Jy', 'fit_ra': 'deg', 'fit_width': 'km/s', 'fit_width_error': 'km/s'}¶
Columns
fit_lines()adds, with their units.
- luv_finder.fit.CONTINUUM_COLUMNS = {'fit_bmaj': 'arcsec', 'fit_bmaj_error': 'arcsec', 'fit_bmin': 'arcsec', 'fit_bmin_error': 'arcsec', 'fit_chi2_reduced': None, 'fit_continuum': 'Jy', 'fit_continuum_error': 'Jy', 'fit_converged': None, 'fit_ddec': 'arcsec', 'fit_ddec_error': 'arcsec', 'fit_dec': 'deg', 'fit_dra': 'arcsec', 'fit_dra_error': 'arcsec', 'fit_n_pointings': None, 'fit_pa': 'deg', 'fit_pa_error': 'deg', 'fit_ra': 'deg'}¶
Columns
fit_continuum()adds: those of a line but its frequency, width, peak and line flux.
- luv_finder.fit.MIN_WIDTH = 45.0¶
Lowest fitted line FWHM, km/s: a line a few channels wide would otherwise collapse below one channel, since the model samples a Gaussian at the channel centres (no Hanning or channel response).
- luv_finder.fit.REPORTED = {'bmaj': 'arcsec', 'bmin': 'arcsec', 'continuum': 'Jy', 'ddec': 'arcsec', 'dra': 'arcsec', 'freq_ghz': 'GHz', 'line_flux': 'Jy km/s', 'pa': 'deg', 'peak': 'Jy', 'width': 'km/s'}¶
Quantities reported per line, each with an
_error, and their units.
- luv_finder.fit.START = ('dra', 'ddec', 'freq_ghz', 'width', 'bmaj', 'bmin', 'pa')¶
Catalogue columns a fit starts from; the source shape defaults to a point.
- luv_finder.fit.empty_fit(cat: Table, columns: dict = {'fit_bmaj': 'arcsec', 'fit_bmaj_error': 'arcsec', 'fit_bmin': 'arcsec', 'fit_bmin_error': 'arcsec', 'fit_chi2_reduced': None, 'fit_continuum': 'Jy', 'fit_continuum_error': 'Jy', 'fit_converged': None, 'fit_ddec': 'arcsec', 'fit_ddec_error': 'arcsec', 'fit_dec': 'deg', 'fit_dra': 'arcsec', 'fit_dra_error': 'arcsec', 'fit_freq_ghz': 'GHz', 'fit_freq_ghz_error': 'GHz', 'fit_line_flux': 'Jy km/s', 'fit_line_flux_error': 'Jy km/s', 'fit_n_pointings': None, 'fit_pa': 'deg', 'fit_pa_error': 'deg', 'fit_peak': 'Jy', 'fit_peak_error': 'Jy', 'fit_ra': 'deg', 'fit_width': 'km/s', 'fit_width_error': 'km/s'}) Table[source]¶
A copy of
catwith thecolumns, not yet fitted (NaN, 0, False).
- luv_finder.fit.fit_continuum(data: DataHandler, cat: Table, lines: Table, rows=None, widen: float = 0.0, cores: int | None = None, **kwargs) Table[source]¶
A copy of the continuum catalogue
catwith theCONTINUUM_COLUMNSof everyrowssource: position, shape and the flux density of every window (meta["spectra"]), combined infit_continuum.The channels of the
lines(a line catalogue) at S/N >=MASK_SNRwithin a resolution element are left out, each overMASK_FWHMof its FWHM pluswidenkm/s (a channel ofdatabinned in frequency,binned()). Failures warn.
- luv_finder.fit.fit_line(data: DataHandler, dra: float, ddec: float, freq_ghz: float, width: float = 45.0, bmaj: float = 0.0, bmin: float = 0.0, pa: float = 0.0, continuum_order: int | None = 1, pb_limit: float = 0.2, channel_noise: str | dict | None = 'measure', others=(), line: bool = True) dict[source]¶
Fit one line, started from the matched filter’s position, template shape (FWHM, arcsec) and width.
Every window within one FWHM of the line is fitted (
_window_chunks()): the line is shared, and each window has its own continuum.others: (GHz, km/s) of other lines at the position, left out of the fit (_without()). Without aline, a continuum source: every window, each with its own flux density (windows, the in-band spectrum), reported combined atfreq_ghz.
- luv_finder.fit.fit_lines(data: DataHandler | str, cat: Table, rows=None, cores: int | None = None, **kwargs) Table[source]¶
A copy of
catwith theCOLUMNSof everyrowsline (default the detected); failures warn.meta["spectra"]holds each fitted line’s PB-corrected spectrum at its fitted position and the best-fit model. The other rows ofcatwith S/N >=MASK_SNRwithin a resolution element are left out of each fit (their channels get no weight), as the filter leaves them out of the continuum.
- luv_finder.fit.home_window(chunks: list[Chunk], nu: float) int[source]¶
The spw among
chunksthat holdsnuHz farthest from its edges (the nearest, if none holds it).
- luv_finder.fit.source_model(chunks: list[Chunk], sources: Table, dish: float) list[Chunk][source]¶
The visibilities of fitted
sourcesatchunks’ rows, weighted (X = w V): each a Gaussian at its fitted position and shape times the pointing’s primary beam, and its spectrum: a line’s Gaussian line alone (fit_lines(); its continuum is the continuum catalogue’s), a continuum source’s flux density in each window (fit_continuum(),meta["spectra"]).