luv_finder.plotting¶
Diagnostic figures shared by the CLI, the run products and the test suite.
Every function returns its Figure and writes <plots_dir>/<name>.png only
when plots_dir is given, so a notebook shows the figure and a script or pytest --plots saves the
same plot. Figures are built without pyplot (nothing to close, never shown twice in a notebook) and
inside style(), the package’s matplotlib style, which leaves the caller’s rcParams alone.
Module Attributes
The package's matplotlib style file. |
|
Gallery frame of a line that passes only the likelihood ratio, or only the fidelity; both: the plain frame. |
Functions
|
Amplitude and phase of the vector-averaged visibility against frequency. |
|
Each continuum source's flux density per window with |
|
Moment-8 (S/N), continuum (mJy/beam), and the moment-8 with continuum contours. |
|
|
|
The matched-filter response of every group: S/N against frequency for each template, one panel each. |
|
Moment-0 map of every fitted line ( |
|
Each fitted line's spectrum and best fit within |
|
Pointing centres and half-power primary beams in the dataset's sky frame. |
|
Response statistics of the data against its jackknife and a unit Gaussian. |
|
Which reliability test each row passes: |
|
Peak S/N on the sky from saved maps |
|
One position seen through several pointings of a mosaic, and the combination. |
|
Counts, likelihood ratio and fidelity of a catalogue against its noise model. |
|
Matched-filter response of the best grid point, with the jackknife overlaid. |
|
The null correlation rho of the response against what bright lines actually look like. |
|
Several S/N spectra on one axis, e.g. the phase centre against the source positions. |
|
Peak S/N over channels, widths and sizes at every (dra, ddec) of the grid. |
|
Real and imaginary visibility spectra: data, jackknife and model. |
|
The Luv_finder figure style as a context manager: |
|
Do the weights predict the scatter? Re V at the phase centre per channel, its spread and |
- luv_finder.plotting.FRAMES = {'fidelity': '0.8', 'likelihood': 'k'}¶
Gallery frame of a line that passes only the likelihood ratio, or only the fidelity; both: the plain frame.
- luv_finder.plotting.STYLE = PosixPath('/home/runner/work/Luv_finder/Luv_finder/luv_finder/luv.mplstyle')¶
The package’s matplotlib style file.
- luv_finder.plotting.amp_phase_check(data, positions, plots_dir=None, name='amp_phase', line_ghz=None)[source]¶
Amplitude and phase of the vector-averaged visibility against frequency.
positionsmaps a label to a (dra, ddec) the visibilities are phase-shifted onto first. On a source the phase stays near zero across its line and the amplitude rises; elsewhere the phase wanders and the amplitude is the noise floor.
- luv_finder.plotting.continuum_spectra_check(cat, plots_dir=None, name='continuum_spectra')[source]¶
Each continuum source’s flux density per window with
flux (nu / freq_ghz)^alphaover it.
- luv_finder.plotting.dirty_maps_check(dra, ddec, moment8, continuum, sigma, plots_dir=None, name='dirty_maps', marks=None)[source]¶
Moment-8 (S/N), continuum (mJy/beam), and the moment-8 with continuum contours.
Takes the output of
luv_finder.imaging.dirty_maps()on thedra x ddecgrid. Contours are at -3 (dashed) and 3, 5, 10, 20, 50 times the continuum noisesigma, a scalar or a per-pixel map shaped likecontinuum(a mosaic’s noise varies across the field). NaN pixels, outside every primary beam, are left blank. The colour scales are robust to a few extreme pixels: continuum 1st to 99th percentile of the well-covered area (noise within twice its minimum), moment-8 0 to 99.9th percentile.
- luv_finder.plotting.erf_curve(snr, fidelity) tuple[float, float][source]¶
(centre, width)ofF = (1 + erf((S/N - centre) / sqrt(2) width)) / 2fitted to fidelity points.For display only: it smooths the tail model’s binned fidelity; the thresholds come from the bins. NaN when fewer than three points are finite or the fit fails.
- luv_finder.plotting.filter_responses(freqs, snr, widths, labels, jk=None, at=None, passed=None, span=3000.0, plots_dir=None, name='filter_responses')[source]¶
The matched-filter response of every group: S/N against frequency for each template, one panel each.
freqs[g](Hz),widths[g](km/s) andsnr[g],jk[g](templates x frequencies) per group, as saved by a run (groups of different units have different frequencies); one shared array is accepted for each too.at[g](Hz) is the group’s own frequency, marked: another line at the same position can be brighter (default: the peak). The best template there is drawn thick, the jackknife’s response to it in grey, the group’s S/N dotted; each panel spansspankm/s around it (None: everything).passed[g](seepasses()) frames a group that passes only one reliability test.
- luv_finder.plotting.line_maps_check(maps, cat, plots_dir=None, name='line_maps')[source]¶
Moment-0 map of every fitted line (
luv_finder.imaging.line_maps()), the fitted position marked.
- luv_finder.plotting.line_spectra_check(cat, span=3.0, plots_dir=None, name='line_spectra')[source]¶
Each fitted line’s spectrum and best fit within
spanFWHM of its centre, both over the fitted peak.
- luv_finder.plotting.mosaic_layout(offsets, primary_beam, plots_dir=None, name='mosaic', marks=None)[source]¶
Pointing centres and half-power primary beams in the dataset’s sky frame.
offsetsmaps a field id to its phase centre (dra, ddec) in arcsec;primary_beamis the beam FWHM in arcsec.
- luv_finder.plotting.noise_check(mf, plots_dir=None, name='noise')[source]¶
Response statistics of the data against its jackknife and a unit Gaussian.
Left: the distribution of the response over all grid points and channels. Right: how many of them exceed a threshold, which is what a detection threshold has to be calibrated on. Neighbouring grid points and channels are correlated, so the counts are not independent. NaN entries (positions outside every primary beam of a mosaic) are dropped.
- luv_finder.plotting.passes(cat) ndarray[source]¶
Which reliability test each row passes:
both,likelihood,fidelityornone.
- luv_finder.plotting.peak_snr_map(maps, marks=None, plots_dir=None, name='peak_snr')[source]¶
Peak S/N on the sky from saved maps
(dra, ddec, peak)(one or several), their maximum.The units of one band are searched on lattices of different steps (half each one’s resolution), so every map is put onto the finest by nearest neighbour; positions no map covers stay blank. Drawn interpolated between the lattice points (Gouraud shading; display only).
marksmaps a label to a (dra, ddec), or is a catalogue whose rows are marked#idatdra,ddec.
- luv_finder.plotting.pointings_check(freqs_ghz, pointings, combined, beam, plots_dir=None, name='pointings', line_ghz=None)[source]¶
One position seen through several pointings of a mosaic, and the combination.
pointingsmaps a label to a dict withdistance(arcsec from that pointing’s centre),pb(primary beam at the line) andflux[Jy, primary-beam corrected],error[Jy] andsnroverfreqs_ghz(NaN where the pointing does not cover the position);combinedhasflux,errorandsnr;beamis (offsets, response) of the primary beam at the line. Left: where each pointing sits on the beam, hollow if it never covers the position. Middle: flux density with the combined+-1 sigma band. Right: S/N, which the beam correction leaves unchanged. Pointings that never cover are left out of both.
- luv_finder.plotting.reliability_check(cat, plots_dir=None, name='reliability')[source]¶
Counts, likelihood ratio and fidelity of a catalogue against its noise model.
catis the output ofluv_finder.catalogue.catalogue()(itsmetaholds what is plotted, so a subset of its rows works too). Left: cumulative group counts N(>= S/N) of the data, the jackknife and the negated data (a diagnostic only) from the noise floor, with the detected rows on the data curve, and the noise model: the peak counts of every kernel summed. Middle: the likelihood ratio of every row against its kernel’s model, against the thresholdkand the lowest S/N above it. Right: the binned fidelity1 - N_jackknife / N_data, the model’s fidelity with an erf through it (erf_curve(), display only) and the lowest S/N reachingfidelity_min, and the binned fidelity against the negated data (as ASPECS measures it) for comparison. The model and the thresholds are left out where they are NaN.
- luv_finder.plotting.response_check(mf, plots_dir=None, name='filter_response', line_ghz=None)[source]¶
Matched-filter response of the best grid point, with the jackknife overlaid.
The y axis is signal-to-noise, so the peak height is the line’s S/N.
- luv_finder.plotting.response_shape_check(nc, result, peaks=(), plots_dir=None, name='response_shape')[source]¶
The null correlation rho of the response against what bright lines actually look like.
ncis aResponseCorrelationmeasured onresult,peaksa sequence of(i, j, t, k)indices intoresult.snr. Top row: rho over position lags for the first template with its half-power ellipse and rho = 0 contour; rho over channel lags per template (solid) against the white-channel analyticexp(-k^2 / 4 s^2)of a Gaussian template (dashed); rho between templates with, for templates differing only in width, the analyticsqrt(2 W1 W2 / (W1^2 + W2^2))in parentheses. Bottom row (ifpeaks): cuts ofsnr / snr_peakthrough each peak along dra, ddec and channels, against the expectationE[snr(p)] = (S/N)_peak rho(p - p_peak)(thick, per template), within the lags ofnc.
- luv_finder.plotting.responses_check(freqs, curves, title, plots_dir=None, name='responses', line_ghz=None)[source]¶
Several S/N spectra on one axis, e.g. the phase centre against the source positions.
curvesmaps a legend label to a response with one value per frequency infreqs(GHz).
- luv_finder.plotting.snr_map(mf, plots_dir=None, name='snr_map', marks=None)[source]¶
Peak S/N over channels, widths and sizes at every (dra, ddec) of the grid.
The data and, when it was run, the jackknife are shown side by side on one colour scale.
marksmaps a label to a (dra, ddec) position to circle, e.g. an injected source. Positions where the response is NaN (outside every primary beam of a mosaic) are left blank.
- luv_finder.plotting.spectrum_check(data, dra, ddec, model=None, plots_dir=None, name='spectrum', line_ghz=None)[source]¶
Real and imaginary visibility spectra: data, jackknife and model.
The data are shown at the reference direction and phase-shifted onto (
dra,ddec); the jackknife and the model (a source component) only shifted. A real source is flat at the reference and peaks once shifted; the jackknife should stay consistent with zero.
- luv_finder.plotting.style()[source]¶
The Luv_finder figure style as a context manager:
with style(): ....
- luv_finder.plotting.weights_check(chunks, labels, plots_dir=None, name='weights', n_points=200000, seed=0, pooled=())[source]¶
Do the weights predict the scatter? Re V at the phase centre per channel, its spread and
<1/w>^1/2.One panel per chunk (one field and window, e.g. with the measurement set’s weights and reweighted), each with a random
n_pointsof the visibilities, the measured spread (median and robust sigma per channel) and the spread the weights predict; below, the measured over the predicted spread per channel, fromRe V sqrt(w), which is 1 where the weights hold. The sky is in V too, which is fine for a faint field. The ratio scatters by1.166 / sqrt(N)per channel (shaded), so one field ripples;pooled, the window’s chunks of every field, tests the reweighting, which is fitted per scan over them all.