Repository navigation
Plotting and fitting: normalizations, selection, labels, Scatter connect, yerr - #532
Merged
Merged
Conversation
…yerr_max Target tests for renaming weights, wmin and wmax, marked xfail(strict=True) until the rename lands: yerr is stored as observations.raw.yerr, the two limits select inclusively, the old keywords raise TypeError, and TrendFit refuses yerr in trend_kwargs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FitFunction took the 1-sigma uncertainty of y as weights, with wmin and wmax limiting it. Elsewhere weights usually means 1/sigma (lmfit, astropy, numpy.polyfit w), so the name invited passing the inverse. It is now yerr, with yerr_min and yerr_max, matching TrendFit's yerr; set_fit_obs, the observations namedtuple field (w -> yerr), FFPlot, TrendFit's pass-through and its trend_kwargs guard, docstrings, CONTRIBUTING, tests and the quickstart follow. No alias: the old keywords raise TypeError. BREAKING CHANGE: weights=, wmin= and wmax= are yerr=, yerr_min= and yerr_max=; observations.used.w and .raw.w are .yerr. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Target tests, marked xfail(strict=True) until the repr lands: class, labels, kept rows, log flags, bins per axis or mesh cells, axnorm, clim and alim once set, and path, on Hist1D, Hist2D, SpiralPlot2D and Scatter built before any plotting; str equals repr. A guard pins the one-line Hist1D z-label error, which reads str(self) today. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
print(plot) and Jupyter showed only the class name. Base.__repr__ now lists the class, the x, y and z labels, the rows kept, the log flags and the path; a cooperative _repr_fields hook adds the binning, axnorm and clim (BinnedPlot) and alim (ColorPlot), and each Binning describes its own cells (bins per axis on a FixedGrid, mesh cells on an AdaptiveMesh). __str__ is removed so print shows the summary. Its only reader was the Hist1D z-label error, which now names the class directly. Path building and loggers already used __class__.__name__. The label flattening shared with BinnedPlot.agg and the z-label test shared with path are extracted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Target tests, marked xfail(strict=True) until info() lands: the example plasma reports PSP, HCI, its first and last times, three observations, species a, e, p1, p2 and no auxiliary data; without a spacecraft both spacecraft fields read "none"; set_aux turns auxiliary data to "yes". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
info() returns a DataFrame with one value column and one row per field:
spacecraft and frame ("none" without one), first and last observation
times, the number of observations, the species, and whether auxiliary
data are attached. It renders as a table in Jupyter and prints in a
terminal; the Plasma repr is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plasma.lnlambda wrote \ln_\lambda_{i,i}, a double subscript MathJax
rejects, so its API page showed "Double subscripts: use braces to
clarify" instead of the equation; it is \ln \lambda_{0,1}, matching the
equation's 0 and 1. Its Parameters named a species argument the method
does not take; they now document s0 and s1.
tests/test_docstring_math.py reads every docstring under src with ast
and rejects double subscripts, double superscripts and unbalanced braces
in :math: roles and .. math:: blocks. lnlambda was the only offender.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Target tests, marked xfail(strict=True) until the method lands, checked against numpy.histogram2d and numpy.histogram counts: clim, alim with the default and a given fcn, a log axis returning the caller's signed values on its labels, Hist1D, and a spiral whose rows number its shown cells' counts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hist2D.plot_edges raised "polyorder must be less than window_length" below 50 x-bins: the default Savitzky-Golay window, 10% of the edge's points made odd, fell to 3 or less, not above the default polyorder 3. The default window now rises to the smallest odd length above polyorder and is capped at the edge's length; an edge too short for any such window is drawn unsmoothed. A window the caller passes is used as given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Strict xfail until make_plot(edges=True) exists: segment count, colours as the mean endpoint z through the points' cmap and norm, NaN, mask and alim breaking the chain, row-position order, single colour without z, zorder and edge_kwargs, and the (ax, points, edges, cbar) return. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BinnedPlot.get_plotted_data(fcn=None) returns the caller's x, y and z on the rows whose cell agg(fcn) leaves non-NaN, after clim, axnorm, any cell filter and alim. A lookup table indexed by the rows' cell codes replaces np.isin, and the codes are computed once per plot (cached on the binning and data, read-only) and shared with agg. Hist1D.construct_cdf and Hist2D.project_1d use the same mask. The old selection methods stay for now; on the evaluation datasets (NaN, log axes, values on edges, empty bins with clim, clip; Hist1D, Hist2D, SpiralPlot2D; 1e5 and 1e6 rows) the new rows equal theirs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With gaussian_filter_std and the default nan_aware_filter=False, the plain scipy Gaussian filter spread each empty (NaN) bin over its kernel, blanking the bins around every gap; on a small or sparse grid no contour was left. One helper now smooths the grid for plot_contours and plot_hist_with_contours: the NaN-aware normalized convolution when the grid has empty bins, scipy.ndimage.gaussian_filter otherwise, so a grid without gaps gives exactly the previous result in every filter mode. The nan_aware_filter keyword is removed: the filter chooses on its own, and the False setting only selected the defect. SpiralPlot2D already rejects the keyword. The usage guide drops it, and its plot_edges note follows the previous commit's default window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every SpiralPlot2D construction logged three WARNING records from calculate_bin_number (start time, elapsed time, largest bin and empty bins), and every make_plot four more (patch timing). They report normal operation, so they are DEBUG records now. The record that points fell outside the mesh and were dropped stays a warning: it reports lost data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…places get_plotted_data_boolean_series() equalled the mask of get_subset_above_threshold(-inf, fcn=None), and both went through _rows_in_cells; get_plotted_data(fcn) covers both. Tests that used them now use get_plotted_data with clim where they used a count threshold. BREAKING CHANGE: get_plotted_data_boolean_series and get_subset_above_threshold are removed; see the changelog for the migration, including the normalized Hist1D threshold that has none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scatter.make_plot(edges=True, edge_kwargs=None) adds a LineCollection of segments between rows adjacent by source position. Segment i takes (z[i] + z[i+1]) / 2 through the points' own cmap and norm, so one colorbar reads both; without a varying z it takes the points' colour. A row that is not drawn (NaN, mask, alim) breaks the chain. The edges sit below the markers and do not set the axis limits. BREAKING: make_plot now returns (ax, points, edges_or_None, cbar), the fixed-shape convention Hist1D's band slot already follows. Callers in the plotting tests unpack four values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With convert_pow_10, build_info turned "2.5e+00" into
"2.5 \times 10^{+0}". The module compiled a pattern for "e+00" but never
used it; the 10^{X} conversion now removes a zero exponent first, so the
annotation reads "2.5 \pm 1 \times 10^{-1}". The eX notation is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Target tests marked xfail(strict=True) until the merge: neither class keeps its own copy, and a Hist1D hands expected_logy=False to the y callback as a Hist2D hands its log flag. Guards, passing on both copies today: overlapping x ranges take a row once per range, each range keeps its own y window, and the first invalid range in the caller's order is named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scatter keeps its data linear, so a value <= 0 on a log axis is a row matplotlib does not draw; its segments ran to the axis edge. Such a row now breaks the chain like a NaN, masked or alim-hidden one, read from self.log at draw time so set_log after construction counts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rids Hist1D and Hist2D each kept a copy, and they had drifted: Hist1D no longer passed expected_logy to get_y_bounds, so callbacks written for Hist2D failed on it. One method on _OnFixedGrid now serves both, with _within moved to base. It lists x-bins from intervals["x"] instead of running agg(), validates every range in the caller's order as before, and finds each row's range with one searchsorted over the sorted left bounds when the ranges are disjoint, falling back to one pass per range when they overlap. On the evaluation datasets (1e5 and 1e6 rows; NaN, log axes, values on edges, empty bins, clip; disjoint, overlapping and partial ranges) the output equals the old methods'. BREAKING CHANGE: Hist1D calls get_y_bounds(row, expected_logy=False); a one-argument callback raises TypeError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TeXlabel rendered ("v", "x", "p1") as v_{X;p_1}: the registry mapped the
x, y and z components to upper case. Vector components subscript lower
case (v_x, B_z), so the registry maps them to x, y and z. A frame's
coordinate axes are upper case by convention (X_GSE), so the gse and hci
templates take the new $A placeholder, the component's code in upper
case, and still render X_GSE. The r component keeps its R (RTN).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Guards: agg(fcn="count") on Hist1D, Hist2D and SpiralPlot2D, with empty cells, clim and every axnorm the binning allows, equals a pandas groupby count on the plot's cell codes run through the same steps. Target, xfail(strict=True) until the fast path lands: a count does not call _grouped_by_cell, while a mean does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Strict xfail until make_plot(connect=True, connect_kwargs=None) replaces edges: segments follow a stable sort on z, independent of row order; ties keep row order; points not drawn (NaN, mask, alim, <= 0 on a log axis) are skipped, not gaps; without a varying z, row order in one colour. Return is (ax, points, segments, cbar). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author decisions: the keyword is connect (connect_kwargs), since edges means bin edges elsewhere, and the returned artist is segments: (ax, points, segments, cbar). Points are joined in a stable sort on z, so rows need not be sorted and ties keep row order; with z = time the segments trace the trajectory. Points not drawn (NaN, mask, alim, <= 0 on a log axis) are skipped, not gaps. Without a varying z, row order. Skipping drops the read of the private _PlotSource rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the aggregation is a count with no keywords, agg counts each cell's rows with np.bincount of the cached cell codes, keeps the occupied cells as a groupby count would (so empty cells stay NaN), and reuses the counts for clim. Every other aggregation still groups. The output equals the groupby path exactly (values, dtype, index, name) on Hist1D, Hist2D and SpiralPlot2D with empty cells, clim and each axnorm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TeXlabel(("T", "scalar", "p1")) read T_{\mathrm{scalar};p_1}: the registry
gave the scalar component a literal "scalar" subscript. The scalar of a
tensor quantity is its bare symbol, as a vector's magnitude is, so the
component now renders empty and the label reads T_{p_1}, the same as with
the component left empty. The save path still names the component.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Target tests, xfail(strict=True) until the change: densities of a mean integrate to the mean z (overall, per column, per row, on linear and log grids); w, wc and wr sum to those means; a median's density integrates to the count-weighted median; a sum's shares add to 1 and a negative z raises for them; count weights are count fractions; t divides signed values by the largest magnitude; Hist1D takes d with a mean; the new keys are allowed and labelled. Expected values come from numpy on the inputs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The registry's dimensionless unit was \mathrm{\#}, which beta and the
other dimensionless quantities stated, while ratio, axnorm, count and
composition labels each wrote a literal \#. The two render alike but are
two spellings of one unit, so labels compared by string disagreed. The
registry's UNIT_TEX["dimless"] is now \#, and every label reads it from
there. The temperature anisotropy R, a ratio of temperatures, stated
\perp/\parallel as its units; it is dimensionless and states the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CHANGELOG: master's [0.4.1] section kept intact; the connect entries move under [Unreleased]. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Individual points now covers the plain Scatter and its 4-tuple return, connect=True on shuffled rows (joined in increasing z, segments colored by the mean z of each pair, dropped points skipped, the z = time trajectory reading) and Scatter without z (one color, row order). Each figure is a standalone plot block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Count and TeXlabel each held their own axnorm names and their own set of accepted keys: TeXlabel asserted on "cd" and "rd", which Count and the 2-D binning accept. One table, labels.base.AXNORM, now names every key for both, and both validate against it with ValueError. A test checks that every key a binning's allowed_axnorm holds is in the table, so a new binning key needs only its table entry. The names say what each normalization does: "t" divides by the maximum and reads "Count / Max" (was "Total Norm Count"); "c" and "r" read "Count / Column Max" and "Count / Row Max"; "cd" and "rd", a density in each column or row, read "Column" and "Row Probability Density" (both were "1D Probability Density"). A density's units are 1 / (bin width or area in the axes' units), which no label knows, so a density label states no units instead of [#]; format_with_units writes no bracket for empty units, which ManualLabel previously stripped by string replace. Save paths are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orbar
After the connect example, a Scatter over 1994-2026 with z the time in
matplotlib's date units, the units SIDC.plot_on_colorbar plots in, a
"Year" colorbar, and SIDC("m13")'s sunspot number along it, titled SSN
with its tick labels removed. Readers download the series from SILSO;
the build reads the committed snapshot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In publication format a label is two lines: the quantity's name in words over its usual TeX symbol and units. The name is the registry's display name; TeXlabel(..., name=...) replaces it. A ratio reads "<Name> Ratio" for like quantities, otherwise "<Name0> / <Name1>"; Count reads "Count" or its normalization's name, which AXNORM now carries; a measurement the registry does not name keeps one line. The normalization stays on the symbol line, as species and component do. labels.base.set_publication_format sets the module default and labels.base.publication_format reads it; a label's own publication_format overrides it, and None follows it. The lines are added when a label is read, in Base._format_with_description, which every label class uses, so the default also reaches labels that plots already hold. TeXlabel therefore no longer caches its description in with_units. A description keeps its line above the name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Target tests, xfail(strict=True) until the change: each axis line shows its bin count and range (the mesh extent on a spiral) and the range of the data binned, in data units on a log axis, without NaN rows, to four significant figures; z shows its data range; a scatter shows data ranges only; an unbuilt plot still has a repr. Guard: a count axis shows no data range. Existing label checks read the label part of each line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each axis line of the repr now reads label, then the bin count and range (a spiral's mesh extent), then the range of the data on it, all in data units on a log axis and to four significant figures. The binning supplies its extent through axis_extent, read by one shared _axis_line in Base via the _axis_extent hook BinnedPlot overrides; a scatter shows data ranges only and a count axis none. An unbuilt plot reads "<Class> (not built)" instead of raising. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The AXNORM and publication-format references in labels.base resolved by short name only; under the docs' nitpicky build a short :func: or :data: target inside a class docstring can resolve to the class member of the same name. They now name the module, and two long docstring lines are rewrapped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Target tests, xfail(strict=True) until the change: a Hist2D of signed means under any axnorm, a spiral, a scatter and both contour methods default to a zero-centred norm with RdBu_r. Guards: non-negative values keep the bands, the LogNorm or matplotlib's default, and a caller's norm and cmap win. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Now that densities and peak norms of signed means are meaningful, the default LogNorm masked their negative cells and the [0, 1] bands clipped them. ColorPlot._color_scale is the one place a colour plot picks norm and cmap: when the plotted values hold both signs it defaults to a CenteredNorm about 0 with RdBu_r, else to _default_norm as before; a caller's norm or cmap (None included) wins. Hist2D make_plot, plot_hist_with_contours and plot_contours, SpiralPlot2D make_plot and plot_contours, and Scatter make_plot all go through it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In publication format a Count's second line repeated its first in other
words ("Normalized Count" over "Count / Max [#]"). The count now has a
symbol, as every quantity does: N for a plain count, N / N_max for "t",
N / N_{max,col} and N / N_{max,row} for "c" and "r", and p, p_col and
p_row for the densities. AXNORM carries the symbol beside the name. A
count divided by a maximum states [#] and a density states no units, as
in the one-line labels, which are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Target tests, xfail(strict=True) until alim moves to a shared home: alim masks Hist1D bins after axnorm, as values or quantiles, get_plotted_data honours it, the repr shows it, and Hist1D, Hist2D and Scatter share one set_alim, _apply_alim, alim and alim_kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A density Count label stated no units. binning.normalize divides a density by the measure of the bins it is taken over: "d" by each cell's width or area, "cd" by the y-widths within a column, "rd" by the x-widths within a row, measured in log10 on a log axis. One helper, labels.base.density_units, now builds the inverse of each such axis's units from its label, dex^-1 for a log axis, and omits an axis whose label states no units. AXNORM records the axes each density is per. BinnedPlot hands its binned axes' labels and log scales to its Count in _count_with_axnorm, and set_labels now updates the Count after storing the labels, so the units follow labels set after the plot is built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alim lived on ColorPlot, so a Hist1D had none and a threshold on a normalized or non-count Hist1D had no replacement for the removed get_subset_above_threshold. alim, alim_kind, set_alim, _apply_alim and the repr field move to _AggregateLimits, the base of both ColorPlot and BinnedPlot; BinnedPlot._limit_values applies alim after axnorm and clim, and Scatter still applies it to each point's z. Hist2D and SpiralPlot2D behave as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ColorPlot and BinnedPlot now derive from the private _AggregateLimits, which the strict build could not link. It joins _OnFixedGrid and _ComponentFrame in nitpick_ignore, with the same reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A label had two optional lines above its symbol: description, printed in every format, and name, printed in publication format. They are one concept, the label's first line, so description is removed: the description= keyword of every label class, the description property, set_description and its rendering path. Every label class now takes name= and publication_format=, and Base._format_with_name prints the name above the label in publication format. BREAKING CHANGE: description= is removed from every plot label class. Migrate description="text" to name="text", publication_format=True. The name is not printed in the default one-line format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in the yerr rename, plot repr, Plasma.info, get_plotted_data(fcn), the shared take_data_in_yrange_across_x, the bincount count path, the aggregation-aware axnorm (new w/wc/wr), the centred diverging default colour scale, and alim on Hist1D. CHANGELOG: master released 0.4.1 since the branch point, so the branch's Unreleased entries that 0.4.1 now carries (quickstart, Make a Plot, BinnedData, pre-commit install, Read the Docs, GitHub Pages) are dropped from Unreleased; the branch's own entries are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in the plot_edges window fix, NaN-aware contour smoothing (the
nan_aware_filter keyword is removed), Spiral debug logging, the 10^{+0}
fix, the label quirks, the one AXNORM table, registry display names,
publication format, count symbols and density units, and the merge of
description into name.
Resolutions:
- labels/base.py, labels/special.py: the AXNORM table replaces
_trans_axnorm and Count's elif chain. AXNORM gains the w, wc and wr
keys the first merge added to the binnings. On a Count, which is a
count aggregation, they read "Count Fraction" (column, row). On a
TeXlabel, which is the value of another aggregation, they read
"Weight of" the quantity, as d reads "Density of": for a mean the
weight is v n / N, not a count fraction. A new `pure` field marks the
ratios to a maximum (t, c, r), the only normalizations whose quantity
label states [#]; a density or weight of a quantity states no units,
since they depend on the aggregation.
- usage.rst: the plot_edges text takes the new window rule and keeps
use_contourf; nan_aware_filter is dropped from both contour blocks.
The allowed_axnorm doctest lists the w key the first merge added.
- CHANGELOG: the branch predates 0.4.1, so only its own entries move
into Unreleased; the description removal joins the breaking changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BinnedPlot._validate_axnorm duplicated labels.base.validate_axnorm (same messages, a different key set). validate_axnorm takes the accepted keys, defaulting to AXNORM, and set_axnorm passes the binning's allowed_axnorm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in Scatter connect=True and its four-value return, the usage guide's Scatter section, and the sunspot-number colorbar example read from a committed SILSO snapshot. Resolutions: - CHANGELOG: the Scatter return change joins the other breaking changes in Unreleased and its additions join Added. - tests/plotting/test_color_scale.py, from the first merge, unpacked Scatter.make_plot's old three values; it unpacks four. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every hinge fixture built w = 1 / noise_std (or ones), which no test used; with the yerr rename it also read as an inverted uncertainty. The fixtures return (x, y, true_params[, derived]). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pandas deprecates inplace=True on sort_index and set_index (PDEP-8), and warned on every SIDC load and normalization. The loader rebinds the returned frames, and run_normalization replaces the loader's frame with the sorted one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The get_plotted_data work cached each plot's cell codes as an int64 per row, so a plot on a shared BinnedData kept 8 B per row after agg where it kept about 1: ten Hist2D over 1e6 rows kept 83 MB against 3 MB, and the Usage guide's BinnedData numbers no longer held. agg computes the codes once per call and hands them to the groupby; get_plotted_data computes them once for the aggregate and the row lookup. A budget test now covers plots that have aggregated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guards against an empty block and a block that names a script read a collector no test exercised on a bad page. They are now functions of the collected blocks, the empty-block guard is a test of its own, and a test feeds them a temporary page holding one of each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…itfall The shared-bins doctest pinned a slow-wind count of 6947; every point lies inside the edges, so it now states the relation: each plot counts the rows it keeps. A doctest shows the KeyError an unnamed Series raises. The time and memory figures come from scripts/benchmark_binned_data.py, which the guide links, rerun on this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scatter.make_plot's Returns names the segments as mpl.collections.LineCollection, as it names the points and colorbar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… yerr Usage guide: - Normalizations states what d, w and t compute for a count, a sum and any other aggregation, with the cell math, the column and row variants, doctests that the density integrates and the weights sum, and a figure contrasting a count PDF with the weight of a signed mean on the centred diverging colour scale. - A new "Select the data a figure shows" covers clim, alim (Hist1D included) and get_plotted_data(fcn), which replace the removed selection methods. - A new "Publication format" covers set_publication_format, the per-label override, name=, the count symbols and density units, with a figure. - Plot a Fit fits with yerr and draws the error bars. Quickstart: Plasma.info() on the example plasma, the printed summary of a Hist2D, and a Line fit with yerr. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ions - Quickstart: a uniform yerr moves the parameters, because the default Huber loss acts on residuals divided by yerr; the text said they stay the same, against its own doctest. - Plot a Fit: the plot shades the observations +/- yerr (a window, not error bars), and the annotation is the weighted fit's, not the quickstart table's. - Select the data: the clim, alim and get_plotted_data doctests state relations to the counts instead of pinned numbers. - The benchmark script checks that both builds aggregate the same grid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uantity name as breaking Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @blalterman's task in 24s —— View job Review of PR #532This is a partial review. The checkout has no merge base with Overall: The scope and rationale in the description are clear, and the breaking changes are listed with migrations. Removing the cell-code cache and adding a budget test is a sensible call. The Things to check
Tests and process
Performance and security
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Integrates three finished branches into one, by merge commits in this order:
feat/yerr-repr-info,fix/plot-label-defects,feat/scatter-edges. Then a few follow-ups and the documentation of what the branches left undocumented.CHANGELOG.md[Unreleased] holds every entry.By area
Fitting. A fit's uncertainty is
yerr(wasweights), withyerr_min/yerr_max(waswmin/wmax) andobservations.*.yerr(was.w). Plotting a fit withoutyerrno longer warns. ThePlasma.lnlambdadocstring math is fixed, and a test now checks docstring math.Plot selection.
get_plotted_data(fcn=None)replacesget_plotted_data_boolean_seriesandget_subset_above_threshold.Hist1Dgainsalimfrom a shared base.take_data_in_yrange_across_xnow has one implementation on_OnFixedGrid. Counts come fromnumpy.bincount.Normalizations.
axnormfollows the aggregation.d/cd/rdintegrate to 1 for a count, or to the count-weighted average for another aggregation. The neww/wc/wrweights sum the same way.t/c/rdivide by the largest magnitude. Signed values get a zero-centredCenteredNormwithRdBu_rby default.Labels.
AXNORMis one table, now holdingw/wc/wr. Each registryQuantityhas a displayname. Publication format comes fromset_publication_formator a per-labelpublication_format=, andname=overrides the name. Counts carry symbols, and a density's units follow the binned axes. Components print lower case,scalarprints as no component, and[#]is the one dimensionless unit.descriptionis merged intoname.Plots. Each plot has a summary
repr, andPlasma.info()summarises a plasma.plot_edgesworks with few bins. Contour smoothing is NaN-aware automatically. Spiral timing messages log at DEBUG.10^{+0}is no longer printed.Scatter(connect=True)draws z-ordered segments in the mean colours, and the guide has an SSN-on-colorbar example drawn from a committed SILSO snapshot.Docs. The Usage guide covers:
clim/alimandget_plotted_data;yerr;The quickstart shows
Plasma.info(),print(Hist2D)and aLinefit withyerr.scripts/benchmark_binned_data.pyreproduces the BinnedData numbers, and the guide links to it.Decisions made while integrating
wlabel wordings. On aCount(always a count aggregation),w/wc/wrread "Count Fraction" (Column, Row). On aTeXlabel(the value of another aggregation), they read "Weight of" the quantity, parallel to "Density of", because for a mean the weight is v n / N, not a count fraction.purefield inAXNORM. Onlyt/c/rstate[#]on a quantity label. A density or weight of a quantity states no units, since its units depend on the aggregation.axnormvalidator.labels.base.validate_axnorm(key, allowed=None)is the single check;BinnedPlot._validate_axnormis removed.Hist2Don one sharedBinnedDataat 1e6 rows keep 83 MB instead of 3 MB, which defeats the point of sharing. Codes are now computed once per call. A budget test covers plots that have aggregated.Breaking changes and migrations (from CHANGELOG)
weights=,wmin=,wmax=becomeyerr=,yerr_min=,yerr_max=, andobservations.*.wbecomes.yerr.TrendFitrefusesyerrintrend_kwargs.get_plotted_data_boolean_series()andget_subset_above_threshold(t)are removed. Useplot.set_clim(t, None)thenplot.get_plotted_data()for counts, orplot.set_alim(t, None)thenplot.get_plotted_data(fcn)otherwise.Hist1D.take_data_in_yrange_across_xcallback must acceptexpected_logy.axnormmeaning changes for non-count aggregations, and for negative values undert/c/r. A share of a sum needs z >= 0.description=on labels is removed. Usename=with publication format.nan_aware_filteris removed; smoothing is NaN-aware automatically.Quantityrequiresname=.Scatter.make_plotreturns(ax, points, segments, cbar).ValueError(wasAssertionError).str(plot)is now the summary.Verification
All on the branch tip, in the
solarwindpyenv:pytest --doctest-modules src/solarwindpy: 49 passed, 1 skipped.pytest --doctest-glob='*.rst' docs/source: 61 passed.tests/test_docs_plot_blocks.py: 19 passed. It now includes a test that its guards fire on a bad page.tests/test_changelog_unreleased.pypasses.lint-imports: 2 contracts kept.ruff checkandruff formatpass on all files, and so doesdoc8.SPHINXOPTS="-W --keep-going -n") succeeded with no warnings.Master has since gained one README badge commit (1664a65), which merges cleanly.
🤖 Generated with Claude Code