calamari.plot#

Matplotlib plotting helpers for calamari.

This package and calamari.style contain all direct matplotlib imports (PL-1, docs/ARCHITECTURE.md). Every helper takes the measurement (or family of measurements) first and an optional ax=, and leaves figure-level concerns – layout, colourbars, calling legend – to the caller, so the helpers compose into multi-panel figures.

The package has two layers with a public seam. Resolution (chi_series(), moment_series()) turns a Measurement plus a units/source request into PlotSeries objects – pure arrays and label strings, no drawing. All the physics and robustness lives there: unit conversion through Sample, AC-versus-DC source selection, housekeeping-row exclusion, NaN-row dropping, per-frequency splitting, error-bar propagation. Drawing (plot_chi_vs_t() and friends) resolves and then draws. Call the resolution layer yourself when the drawing layer’s choices do not fit.

Quickstart#

>>> import calamari
>>> m = calamari.load("run.dat")
>>> ax = calamari.plot.plot_chi_vs_t(m, component="both")
>>> calamari.plot.save(ax, "chi.pdf")

Every helper takes ax= to draw into an existing figure (multi-panel composition) and creates one via pyplot only when ax is omitted. **style kwargs are forwarded untouched to the underlying matplotlib call (ax.plot/ax.errorbar; ax.pcolormesh for plot_moment_map()), so anything matplotlib accepts there is accepted here.

Module attributes

MAP_OUTLIER_WINDOW

Neighbours on each side that a point is compared against by the map glitch check -- the shared calamari.quality.CONTINUITY_WINDOW.

MAP_OUTLIER_THRESHOLD

Glitch score above which a map point is reported (and, with outliers='drop', excluded) -- the shared calamari.quality.CONTINUITY_THRESHOLD, whose comment records the threshold rationale.

DEFAULT_SAVE_FORMAT

Format written when save() is given a bare stem and no formats.

MAP_ROBUST_PERCENTILES

Percentiles draw_map's clim='robust' sets the colour limits at.

DETECTION_REPRESENTATIONS

The smoothed representations a detection records per sweep and signal (calamari.transitions.TransitionResult.curve()) that can be drawn against the swept axis, in derivative order.

Functions

axis_labels

Return the axis-label text for a (quantity, units) pair.

chi_map_grid

Build a chi(T, H) PlotGrid from a family of sweeps.

chi_series

Resolve a susceptibility-vs-T (or vs-H) request into PlotSeries.

draw_map

Render a PlotGrid as a colour map on the T-H plane.

fisher_series

Resolve Fisher's d(chi T)/dT against temperature, in physical units.

interpolate_family

Interpolate a map's family axis: filled colour between the sweeps.

moment_map_grid

Build an M(T, H) PlotGrid from a family of sweeps.

moment_series

Resolve a moment-vs-H (or vs-T) request into PlotSeries.

overlay_transitions

Draw transition candidates onto existing axes.

plot_boundary

Draw a fit_boundary() model over the points it was fitted to.

plot_chi_map

Resolve and draw a chi(T, H) map in one call.

plot_chi_vs_h

Plot susceptibility (or 1/chi) against applied field.

plot_chi_vs_h_family

A family of chi(H) sweeps on one axes, each curve labelled by its temperature.

plot_chi_vs_t

Plot susceptibility (or 1/chi) against temperature.

plot_chi_vs_t_family

A family of chi(T) sweeps on one axes, each curve labelled by its field.

plot_detection_curve

Draw one smoothed curve a detection searched, with that sweep's candidates on it.

plot_family

Overlay one curve per measurement, labelled by each sweep's fixed parameter.

plot_fisher

Plot Fisher's d(chi T)/dT against temperature.

plot_fit

Overlay a fitted model curve.

plot_fit_windows

Plot one fitted parameter against the fitting window's edge.

plot_mh

Plot moment against applied field, M(H).

plot_mh_family

A family of M(H) sweeps on one axes, each curve labelled by its temperature.

plot_moment_map

Resolve and draw an M(T, H) map in one call; see plot_chi_map().

plot_mt

Plot moment against temperature, M(T).

plot_mt_family

A family of M(T) sweeps on one axes, each curve labelled by its field.

plot_scale_tracks

Draw each tracked feature's location against the smoothing window.

plot_smoothing_scan

Draw one smoothed representation of a sweep at every window of a scan.

plot_transitions

Draw candidate coordinates without manufacturing a background map.

save

Write a figure to one or more files, from the axes a helper returned.

Classes

MapOutlier

One point the map glitch check flagged, with what was done to it.

PlotGrid

A resolved 2-D map on the T-H plane, in fixed orientation.

PlotSeries

One drawable series: data arrays plus the labels that describe them.