Changelog#
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]#
[1.3.1] - 2026-11-23#
Changed#
Buttons look like buttons again. Every push button is now drawn raised: gradient face, bevelled edge, rounded corners, sunken when pressed, and flat grey when disabled. The colours mean the same thing in every tool: green for the main action (Fit), mint for “show on graph”, orange for revert/reset, red for cancel, and so on. A few buttons whose colour did not match the same button in other tools were brought into line. The main window keeps its per-tool launcher colours. Developers: colour a button with
theme.set_button_role(btn, "<function>"); the colours live in one table inpyirena/gui/theme.py(BUTTON_FUNCTIONS). The look comes frompyirena/gui/raised_buttons.py, which is shared with Jan’s other Qt packages.theme.accent_button_css,soft_button_css,chip_button_cssandCHIP_BUTTON_CSSare removed; useset_button_roleinstead.Data Merge: the Porod view is now log I·Q⁴ vs log Q. On linear axes it showed little; on log-log the Q⁴ factor stretches the y axis over the overlap region, which is what makes a mismatch visible. The saved mode key (
porod) is unchanged.
Fixed#
Data Merge: cursors read the wrong Q after switching an axis from the right-click menu (Plot options → Transforms). The cursor positions were decoded with the mode’s assumed axis scale rather than the plot’s actual one, so Optimize and Save ran on the wrong overlap range. The cursors now follow the axis scale and keep their Q.
Data Merge: recovery from invisible cursors. A state file written by the bug above could hold log10(Q) as the overlap range, which restored as NaN cursors (invisible, Q min / Q max reading
nan). Saved and loaded overlap ranges are now checked (finite, positive, ordered, inside the data’s Q span) and replaced by the default if not; cursors that cannot be decoded to a Q are replaced automatically and never reach the merge or the state file. A new Reset cursors button puts them back at the default overlap on demand. Also fixed: the Q min / Q max boxes stopped following the cursors after a mode switch.
[1.3.0] - 2026-11-18#
Added#
Monte-Carlo uncertainties over the API, MCP and ZMQ (#28, #38).
run_fit,run_sizes_fit,run_simple_fitandrun_modeling_fittaken_mc_runs(0 = off, the default, because Monte-Carlo can outrun a remote client’s timeout) and run the same estimate as the GUI andpyirena.batch, seeded byrandom_seed.get_parameter_uncertaintiesis no longer a Unified Fit placeholder: it returns the last fit’s uncertainties for every tool, saying whether they are Monte-Carlo (with how many refits succeeded) or covariance values.export_resultscarries the sameuncertaintyblock,analyze()takesn_mc_runs, andsave_fitstores Unified Fit’s Monte-Carlo uncertainties as the GUI does.Fits no longer freeze the window (#38). Unified Fit, Size Distribution, Simple Fits, the Carbon model and WAXS Peak Fit now run their fit — and Monte-Carlo uncertainties — on a background thread, as Modeling already did. While one runs, the other action buttons are disabled, so a second click can no longer start a second fit inside the first (possible before in Unified Fit and WAXS). The Monte-Carlo uncertainty buttons show progress and become Cancel MC while running; cancelling keeps the refits that finished. The Carbon model’s Stop button keeps working. A single fit cannot be interrupted (scipy’s optimisers have no cancel hook), but it no longer blocks the window.
Reproducible Modeling global fits.
run_modeling_fit(random_seed=…)(API/MCP/ZMQ) and the newbatch.fit_modeling(random_seed=…)now also seed the global (differential evolution) search, so afit_method="global"fit lands in the same basin on a re-run; before, the seed reached only the Monte-Carlo refits. The default stays unseeded, and local fits are unaffected (they were already deterministic).WAXS batch results say their uncertainties are covariance values (
uncertainty_method: "covariance");with_uncertainty=Trueis logged rather than silently ignored.Igor USAXS import writes slit-smeared data the way Matilda does. When a folder holds both desmeared (
DSM_*) and slit-smeared (SMR_*) waves, the file now also gets a<sample>_SMRentry withdQwand the slit lengthdQl, so the “Slit smeared data” selector can load either. Applies to.pxpand.h5xp.Nika’s
w_<folder>Q-resolution wave is imported as the sample’s per-point Q resolution (stored for other consumers; pyIrena fits do not use it yet).
Fixed#
Igor
.pxpimport reads folder and wave names longer than 31 characters. Igor Pro 8+ writes long folder names in a record typeigor2could read only from 0.5.15 (AFM-analysis/igor2#30), and long-named waves in the binary-wave v7 format it could read only from 0.5.16 (#33). With olderigor2, long-named samples were missing, or their waves were written out under the wrong sample or technique, and every long-named wave in a folder shared the placeholder name:wave name too long:and overwrote the others (so Nika QRS data in any SAXS/WAXS folder longer than 29 characters was skipped). The minimum is nowigor2>=0.5.16(pip and conda). pyIrena’s own v7 workaround (patch the wave version to 5 and recover the name from the record) is removed. If an olderigor2is still installed,.pxpimport stops with an upgrade message instead of silently losing samples;pyirena.batch.igor_to_nexusraises thatImportErrorrather than returning None, so the Data Selector shows the message. Tested on Igor experiments with long and liberal (quoted) folder and wave names in USAXS and SAXS.Nika “Use QRS Names” SAXS/WAXS data imports from
.pxpregardless of case. Nika writes lowercaseq_/r_/s_waves, but the importer only matched uppercase names, so those folders were skipped entirely. Wave names are now matched case-insensitively, as in Igor.Slit-smeared-only USAXS folders import from
.pxp. Folders where desmearing was not run (onlySMR_*waves) were skipped. They now import, and both.pxpand.h5xpimports write the slit length (SlitLengthfrom the wave note) asdQl, so fits smear the model. Previously the.h5xppath wrote SMR data withoutdQl, which made fits treat it as pinhole data. SMR data with noSlitLengthis now refused, not written.No more false “long names” warning on Igor 8 experiments. The importer counted record types 26 and 33 as long-name markers, but they appear in every Igor 8 experiment, so it warned about missing samples even when nothing was missing. That check is removed; the
igor2>=0.5.16minimum makes it unnecessary.Unified Fit stored a stale RgCutoff for linked levels. With Link RgCutoff on, the fit used RgCutoff = the fitted Rg of the level below, but the panel synced the field only before the fit. So Results to graphs showed the pre-fit value, and Store in File saved it. The field is now synced after a fit and after a local Guinier fit. The fitted parameters were never affected.
The Unified Fit “Level feasible / not feasible” banner was recalculated only when a value was typed in. After a fit, a local fit, Revert back or a level copy, it kept describing the previous values, and could say “not feasible” for a good fit. It now follows every change.
Fits saved through
pyirena.api.control.save_fit(scripts, MCP, AI agents) wrote the cutoff radius asRgCO. The saved-results name, used by the GUI andpyirena.batch, isRgCutoff. Every results reader therefore lost the cutoff for those files: Fractals target detection, Data Selector tabulation, Igor export, and MCP tabulation and reading.save_fitnow writesRgCutoff, and the readers acceptRgCOtoo, so files already saved that way read correctly.Reading HDF5 files from a network drive (SSHFS-Win) could return another file’s values with no error. Collect Values / Multi-Collect in the Data Explorer showed, for every selected file, the value from the file being displayed in the browser. HDF5 recognises an open file by the ID the filesystem reports, not by its name, and SSHFS-Win reports the same ID (0) for every file. So whenever one HDF5 file was open, opening any other file silently gave back the open one. Saving results while another file was open had the same exposure. pyIrena now opens every HDF5 file through one helper (
pyirena.io.h5open.open_h5) that detects this and opens such a file independently. Local disks are unaffected and keep the normal, equally fast path. Files written are unchanged.The Data Explorer’s browser no longer keeps the displayed file open between actions, so it no longer blocks other programs from replacing that file on Windows.
Collect Values and Multi-Collect open each file once instead of once for the X value and again for the Y value(s), which halves the opens over a slow network drive.
SAXS Morph reported an Euler-Poincaré characteristic of 0 for every structure unless scikit-image happened to be installed (#38). scikit-image is in no pyIrena extra, so on a standard install the missing package was reported as χ = 0, which is a real topology (a torus) rather than an error. χ is now computed directly with numpy (6-connected, the same convention as before); it agrees exactly with scikit-image on 300 random test volumes. Morphology results saved by earlier versions without scikit-image carry χ = 0 regardless of the structure.
Unified Fit “Analyze Results” (Monte-Carlo uncertainties) refitted slit-smeared data with a pinhole model, and without the links the fit used (#38). The error bars therefore described a different model from the one whose parameters they were quoted against. The Monte-Carlo refits now use exactly the model Fit uses: same fit flags and limits, links on, and the data’s slit smearing. Uncertainties change for slit-smeared data and for setups with linked B / RgCO.
Size Distribution “Calculate uncertainty” results were lost on Store in File. The per-bin σ of the distribution was shown as error bars but not written, so a reloaded file had none. It is now stored as
distribution_std, asbatch.fit_sizes(with_uncertainty=True)already did. The σ of Rg, volume fraction and peak r are now stored too — new scalar datasetsrg_std,volume_fraction_std,peak_r_stdinentry/sizes_results, plusmc_n_runs/mc_n_ok/mc_sigma_sourceattributes — by the GUI,batch.fit_sizes(with_uncertainty=True)and the API’ssave_sizes_fit(which also now stores the Monte-Carlodistribution_stdrather than the inversion’s own). Tabulate Results gainsSD_volume_fraction_std,SD_rg_std,SD_peak_r_stdcolumns, andread_size_distributionreturns them. Additive: older files load unchanged and read these as None.run_sizes_fit(random_seed=…)(api/MCP/ZMQ) did not make the Monte Carlo inversion reproducible: it seeded NumPy’s global generator, which that method does not use. The seed now reaches the inversion.Scattering Contrast: an isotope override that could not be honoured was silently replaced by the natural element (#38). For a deuterated compound that used H’s molecular weight and b_c (−3.74 fm instead of +6.67 fm), so the neutron contrast came out with the wrong sign and no warning. An unknown isotope, or one with no tabulated b_c, is now an error. Elements with no neutron b_c or no Chantler X-ray data are still left out of those sums, but now with a warning in the log; the absorption sum used to skip them silently, overestimating the transmission.
get_element_info()raises a clearValueErrorfor an unknown symbol instead of crashing on an unbound variable.
Changed#
Documentation moved to Read the Docs, and the Help buttons open it. The pages in
docs/are now a Sphinx site at https://jilavsky-docs.readthedocs.io/projects/pyirena/, regrouped into getting started, one page per tool window, guides, methods, reference and developer sections. The thirteen Help buttons open the matching page there: thestableversion for releases,latestfor development and pre-release installs. The old GitHub paths that released copies link to stay as one-line “Moved to” pages.Monte-Carlo uncertainties for Unified Fit, Size Distribution and Simple Fits are computed by one implementation per tool in core (#38), used by the GUI and by
pyirena.batch. The GUI and batch copies had drifted apart; where they disagreed, this is what they now share, and the numbers that move:Size Distribution perturbs the data with the error the fit weights by: fractional error and error scaling are honoured, as the GUI already did.
batch.fit_sizes(with_uncertainty=True)used the raw file error, so its error bars change for configs with fractional error orerror_scale ≠ 1.No σ is invented; the user’s is used. For data without measured uncertainties, Monte-Carlo perturbs with I × the Data Selector’s “Generated uncertainty fraction” (Configure → Text File Options) — the σ the user chose for such data — instead of a hard-coded 5 % of I. The refits keep the main fit’s weighting, so fitted values do not move; the MC error bars scale with the chosen fraction, and every result says whether σ was measured or generated. Unified Fit GUI, which refused MC on such data, now runs it. Over the API/MCP/ZMQ, where there is no such setting, MC is refused for data sent without uncertainties.
At least two refits must succeed; Size Distribution previously quoted a zero uncertainty from a single successful refit.
Every result reports how many refits succeeded, and the core functions take a
seedfor reproducible uncertainties (MC values are therefore not bit-identical with earlier runs, only statistically equivalent).
The Data Selector’s “Generated uncertainty fraction” is honoured everywhere (#38). It is the user’s chosen σ for data without uncertainties.
pyirena.batch, the API, plotting, Data Merge and Data Manipulation converted text files with a fixed 5 % regardless of the setting; they now use it. Modeling (GUI and batch) used a fixed 5 % for an NXcanSAS file with no uncertainty dataset; it now uses the setting too, for the fit weights and for Monte-Carlo, so Modeling MC error bars on such data scale with the chosen fraction (fitted values are unchanged, since a constant fraction only rescales the weights). Converted text files now record the fraction they were made with; a later change of the setting is logged rather than silently ignored (the cached file is not rewritten, because results are stored in it). The conversion note also now counts generated uncertainties correctly for two-column files (it said 0). Data Manipulation (scale, trim, rebin, average, subtract, divide and their previews) and SAXS Morph (GUI and batch) used a fixed 5 % for data without uncertainties; they now use the setting too, and the σ is |I| × fraction (negative intensities used to get a negative or floored σ). SAXS Morph also gives σ ≤ 0 points that σ instead of a 1e-30 floor, which let one point dominate its χ² (the shared rule ofcore/fit_data.py). Output uncertainties and χ² on such data shift whenever the setting is not 5 %.pyirena.api.control: the session lifecycle, fit-Q-range, local Guinier / power-law and feature-detection tools moved fromunified_fit.pytodata_session.py(#38). Every name is still importable frompyirena.api.controland fromunified_fit, and MCP/ZMQ list the same tools under the same categories. The per-module copies of the JSON-float and array-thinning helpers became one each inpyirena.api._json; arrays the control tools thin “to at most N points” now really stay at or below N (lengths between N and 2N came back unthinned before).Errors that were swallowed silently in the api, batch and core layers are now logged (#38): an unreadable data file in
read_reduced_data/inspect_file, unreadable result parameters, skipped fit-quality metrics in batch Sizes/Modeling saves, and the Modeling fallback from the analytic to the finite-difference Jacobian. Return values are unchanged.Re-converting a text file no longer wipes the results stored in its
.h5(#38). A converted file is rebuilt when the Q-unit setting changed or the text file is newer; the rebuild used to overwrite it, silently discarding every result saved into it. Now, when it holds results, the GUI asks — Recreate (old file kept as….h5.bak), Keep existing, or Cancel — and batch, API and plotting back it up and recreate, with a warning.One fit runner per tool, shared by
pyirena.batchand the API (pyirena/core/fit_runner.py, #38; design and decisions inplanning/fit-runner/README.md). An audit of all six fitting tools found ~35 places where the GUI, batch, API andanalyze()copies of the fit orchestration disagreed. All six tools now run through it:Points and σ, one rule everywhere (
core/fit_data.py): I ≤ 0 points are kept (array sessions /analyze()used to drop them); σ ≤ 0 is repaired to |I| × the generated-uncertainty fraction instead of being clamped to 1e-30, which gave one point a dominant weight.Unified Fit batch walks limits like the GUI and the API, uses the shared slit-smearing rule and reads the config through the one envelope reader (so
export_resultsreplies and the envelope’sfit_q_rangework in batch too). Fits that reached a bound in batch now walk past it.Size Distribution: API sessions now slit-smear slit-smeared data (they never did) and run one Monte Carlo inversion repetition like the GUI (the core default of 10 made the session result a 10-run average). An empty power-law Q window in a replayed config falls back to the cursor range like the GUI, not the whole curve. Configs’
montecarlo_convergence/montecarlo_max_iterand the oldmcsasmethod name are read again; missing MaxEnt/TNNLS iteration limits default to 1000 like the GUI (was 300). Batch saves its fit-quality metrics with the smeared background when smearing is on.Simple Fits: batch honours
no_limits(it was ignored, so a config exported with “No limits?” was fitted bounded), reads the config through the envelope reader, and keeps σ ≤ 0 points (repaired) instead of dropping them. The Invariant’s background pre-fit is replayed on every path, including API sessions.Modeling: batch builds its configuration with the one shared translator (it had its own copy) and reads the envelope; slit settings follow the shared rule. A config without a Q range is fitted over the data’s own range everywhere (the API replay cropped to 0.001–1 Å⁻¹, and batch failed on a
nullrange).batch.fit_modeling(n_mc_runs=None)now takes the config’sn_mc_runs— the argument’s 10 used to win.WAXS Peak Fit: every path removes peaks whose Q0 lies outside the fitted range before fitting (only the GUI did; reported), and the API session fit can run the Q0 pre-search (
run_waxs_fit(presearch=…)) — it never did. Batch no longer crashes on files without uncertainties and reads the envelope’s Q range.Carbon model: batch honours
no_limits(ignored before) and runs Monte-Carlo only when asked for (a config’s storedn_mc_runsused to switch it on); API sessions keep the model’s weighting unless told otherwise (it was overwritten withauto), and report MC results as Monte-Carlo rather than covariance; a one-sided Q range in a bare model dict (q_max = 0meaning “none”) is no longer lost.A config file that has the pyIrena header but no section for the tool being run is refused with an error; batch used to fit an all-defaults model from it.
GUI: the six fitting panels apply the same point rule (σ ≤ 0 repaired, I ≤ 0 kept — Simple Fits used to drop them); Unified Fit’s residual plot no longer fails on a zero-σ point. Data handed to Modeling by the Data Selector without uncertainties get the generated fraction (it was a fixed 5 %). Saved and exported setups record
load_slit_smearedwhen the file’s slit-smeared copy is loaded, so a batch replay fits the same data instead of smearing the model against the desmeared copy; Simple Fits and Modeling setups carry the slit settings at all for the first time.
Carbon model: the
logweighting is removed. It was accepted (run_carbon_fit(weighting="log"), configs) but never implemented — it ran asrelative, which near a good fit gives the same answer, since ln(I/M) ≈ (I − M)/I. Configs and saved results that saylogload asrelative(logged), so their numbers do not change; the API now refuseslogwith a pointer torelative. Modes:auto,sigma,relative.Dependency floors corrected (#38):
scipy>=1.13(the first SciPy built for NumPy 2, which pyIrena already required) andPySide6>=6.6. Thesixdependency is removed; it wrapped two strings in a no-op. Saved files are unchanged.The broken
pyirena/examples/basic_demo.py(it imported modules that no longer exist) is replaced bypyirena/examples/unified_fit_demo.py, which is the demo formerly at the bottom ofcore/unified.py.README: the entry-point table lists all ten console scripts, and the Simple Fits (15) and form-factor (10) counts match the code.
[1.2.1] - 2026-11-01#
A maintenance release on top of 1.2.0. Graphs in the fitting tools now keep a zoomed view across recalculations, Unified Fit “Store in File” works again after an uncertainty evaluation, and file browsers gain an “Order + frame” sort for multi-frame series (#37). Modeling residuals and Carbon model results are now readable over the API/MCP. Saved-file compatibility is unchanged; files written by 1.1.x and 1.2.0 load as before.
Added#
“Order + frame” sort mode in every file browser (Data Selector, Data Explorer, Data Manipulation, Data Merge) for files named
SampleName_Order_Frame.ext, where several detector frames are written per measurement. Sorts by the order number, then by frame within it, so a series no longer comes up as every frame 0, then every frame 1, … (#37). Frames stay in acquisition order in both directions. Existing sort selections saved instate.jsonare unaffected.pyirena_read_carbon_fitMCP tool. Carbon model result files could be fitted and saved over MCP but not read back:pyirena.api.read_carbon_fitexisted with no MCP wrapper, unlike every other tool’s reader. The server now registers 28 tools (19 read tools).
Fixed#
Graphs no longer throw away a zoomed view on recalculation. Zooming into a Q region to check the fit there was undone by every Graph model, autoupdate and fit, because each redraw reset the axes to the full data range. A view the user pans or zooms with the mouse is now kept across redraws of the same data in Modeling, Sizes, Simple Fits (including the linearization panel), WAXS Peak Fit (residuals), Carbon model (WAXS panel), Fractals, SAXS Morph and Data Manipulation previews; Unified Fit and Data Merge already behaved this way. Loading new data, the “A” button or right-click “View All” returns to the full view. No new controls. The shared logic is in
pyirena/gui/sas_plot.py(track_user_view,user_view_active,note_plotted_data,reset_user_view).Modeling: typing a Q range with autoupdate on raised an AttributeError (
_graph_modeldid not exist), so the model was not redrawn.Unified Fit “Store in File” failed after an uncertainty evaluation with “Unable to synchronously create dataset (name already exists)”, and nothing was saved. Since 1.1.0 the panel’s level parameters also carry the
<param>_errvalues, sosave_unified_fit_resultswroteG_err,Rg_err, … once from them and then tried again fromuncertainties. Theuncertaintiesvalues now replace the earlier ones. Fits saved without an uncertainty run were not affected.Modeling residuals did not reach agents. 1.2.0 started saving
modeling_results/residuals, butpyirena.api.read_modeling(and sopyirena_read_modeling) dropped them, andexport_resultsleft them out of a Modeling session’sarrays, unlike the other tools. Both now return them;read_modelinggivesNonefor files written before 1.2.0.MCP descriptions trailed 1.2.0. The server’s connect-time instructions said “five fitting models” and never mentioned the Carbon model or the
resultscategory (analyze,export_results); they now cover both, with a Carbon workflow like the other tools’. The Sizes and Modeling read tools now state their array units, including number distributions in 1/(cm³·Å) (the 1.2.0 Irena units), andpyirena_read_saxs_morphsays that SAXS Morph fitting was removed and the reader is for older files.AI docs caught up with 1.2.0.
docs/ai_tools_reference.md,docs/ai_integration.mdandpyirena/api/README.mdhad not changed since 1.1.1. They now cover the Carbon model category, theresultscategory (analyze,export_results),open_dataset_from_data, the Unified level-option and feasibility tools,no_limitson every fit, the Voigt peak shape, and array units. One statement was wrong, not just missing: the reference saidmerge_datasetsalways fits a background, butfit_background=falsehas been able to hold it fixed since 1.2.0b1. A new check intest_tool_registration.pyfails when a tool has an api reader but nopyirena_read_<tool>MCP wrapper.Data Explorer: Collect values with the X axis taken from a filename value (temperature, time, order number, pressure) failed with an
ImportErrorleft over from the sort-key consolidation.
[1.2.0] - 2026-10-15#
First stable release of the 1.2 line. This entry summarises what 1.2.0 brings
over 1.1.1; per-change detail lives in the 1.2.0b1 – 1.2.0b3 entries
below. The Added / Changed / Fixed sections that follow are the changes since
1.2.0b3.
Saved-file compatibility is preserved: result files, config files and
state.json written by 1.1.x load unchanged. Files whose number distributions
were written in the old units are rescaled on load (see Changed).
Highlights#
Carbon model (b1) — a new tool that fits the whole measured range of a disordered carbon (USAXS → SAXS → WAXS) as one model: grain Porod scattering, micropores and turbostratic peaks.
ZMQ service (b1, optional
[zmq]extra) and the API calls behind it:analyze()fits a curve with a saved configuration in one call,open_dataset_from_data()starts a session from arrays, andexport_results()writes one JSON report for every fitting tool.A saved setup replays faithfully (b2). Fit flags, links, shapes, slit settings and execution settings now survive
pyirena.batch,analyze()and every wrapper pyIrena writes; configs are written in one vocabulary.Data Merge (b3): a Porod view (I·Q⁴ vs Q) for judging whether two segments agree, hand tuning of scale, Q-shift and background, a right-hand axis, and merged files that keep their DS2 metadata (#21).
True Voigt peak shape in WAXS Peak Fit (b1).
Number distributions in Irena units, 1/(cm³·Å), and Modeling saves its residuals (this release).
Compatibility notes since 1.1.1#
SAXS Morph fitting was removed (#29);
batch.fit_saxs_morphno longer takeswith_uncertainty/n_mc_runs, and the GUI state schema went 2 → 3.The panel dialect of Unified Fit configs is read but no longer written; setups now carry
schema_version.Modeling and Sizes number distributions are 1e24 larger than in 1.1.x files (the unit changed, not the physics); pyIrena’s loaders rescale old files.
Added#
Modeling saves its residuals.
modeling_results/residualsholds (I_data − I_model)/σ onmodel_q(unitsdimensionless), as Unified, Sizes and Simple Fits already did.load_modeling_results()returns it underresiduals(Nonefor older files). Graph Model results carry them too.
Changed#
Modeling: a “Spheroid” population with aspect ratio 1 is no longer ~40x slower than “Sphere” for the same answer. The spheroid orientation average ran 50 Gauss-Legendre points regardless of aspect ratio. At AR = 1 all 50 carry the identical value, so picking Spheroid and pinning AR = 1 — which is easy to do, since the GUI offers both — cost 50 ms per model evaluation against 1.4 ms for Sphere. With a Global fit making ~10,000 evaluations that is the difference between a 4-second fit and a 100-second one. AR = 1 now returns the sphere result directly (identical to 6e-16), and the quadrature order elsewhere follows |AR − 1|, since a nearly-spherical particle cannot resolve 50 orientations: 4 points for |AR − 1| ≤ 0.02, 8 up to 0.1, 16 up to 0.2, and all 50 beyond that. Every reduced order matches the 50-point Igor reference to better than 1e-8 relative, and AR outside the last tier is bit-for-bit unchanged. The core-shell spheroid keeps all 50 points for AR ≠ 1 — it carries two length scales and oscillates faster, so the same tiers are not accurate enough for it.
The Modeling global fit says when it has fallen back to one core. When the differential-evolution worker pool cannot start, the fit still runs, just serially — several times slower for the same result. The warning now names
de_workersand the slowdown, and when the cause is a driver script with noif __name__ == "__main__":guard it says so instead of quoting multiprocessing’s 600-character traceback. That case is easy to miss: every spawned worker re-imports and re-runs the unguarded script before failing, so the machine looks fully loaded while no parallel search is happening.Number distributions are in Irena units, 1/(cm³·Å). Modeling
pop_NN/number_distand Sizesnumber_distwere particles per ų of sample per Å — 1e24 smaller — and either unlabelled (Modeling) or labelled1/angstrom(Sizes, wrong). Sizescumul_num_distis now 1/cm³ (was 1/ų, labelleddimensionless). Both datasets now carry a correctunitsattribute, and the loaders (and the Igor.h5xpexport) rescale files written before this change, recognised by the old/missingunits, so every reader sees one unit. Derived quantities (mean radii) are ratios and do not change. The Modeling size-distribution graph draws number distributions on a right-hand axis.Sizes
surface_distis labelled 1/Ų. S(r) = sv(r)·P(r) is Ų of surface per ų of sample per Å of radius; it was labelled1/angstrom. Values are unchanged (cumul_surf_distandspecific_surfacewere already correctly 1/Å).
Fixed#
Unified Fit: a linked RgCO was reported and saved at its starting value. With “Link RgCutoff” on, the model always computed the upper level with the lower level’s current Rg, but never wrote that value back to the level. The GUI hid this by syncing the field after each fit; batch scripting, the control API and MCP did not, so a config whose level 2 started at RgCutoff = 13.1 saved 13.1 for every dataset whatever level 1’s Rg fitted to. Fitted G, Rg, B, P were always right; the saved
RgCutoff, and the level’s Invariant and Sv computed from it, were not. The linked value is now stored on the level at every evaluation, aslink_Balready did for B. Files fitted before this fix can be corrected by replacing level 2’s RgCO with level 1’s Rg and recomputing Invariant/Sv.
[1.2.0b3] - 2026-10-01#
Added#
Data Merge: a Porod view, hand tuning, and a right-hand axis (#35). The complaint behind this was that a merge can look right on a log-log plot and still be wrong, and that when Optimize fails there is nothing to do about it — Igor lets you turn the knobs by hand and pyIrena did not.
Porod display mode (I·Q⁴ vs Q, both axes linear) alongside SAXS and WAXS. Multiplying by Q⁴ flattens a Q⁻⁴ tail, so a residual background or leftover beam-stop scattering shows as a slope or a step off that flat line — a few-percent error log-log scaling hides. The x axis is plain Q: plotting against Q⁴ crushes everything below the overlap against the left edge, and was tried and rejected. The mode is a display transform and nothing else: Optimize and merge always see the original Q and I, and the overlap cursors keep their physical Q across a switch.
The scale, Q-shift and background fields are now always editable, and editing one redraws the merged preview without running the optimiser. Mouse wheel, ↑/↓ and new ▲▼ buttons all step by 1% of the current value (Shift 10%, Ctrl/Cmd 0.1%), throttled to ~150 ms like the fit panels. The preview is computed exactly as the saved file is, including trimming per Split at left cursor, so what you see is what Save writes.
The three Fit checkboxes no longer lock their field read-only. They now mean one thing: whether Optimize may vary that parameter. Previously an optimised value could not be touched at all, which is the gap this issue is about.
A right-hand Y axis, mirroring the left by default. A new DS2 on right axis option gives DS2 its own scale for datasets decades apart in intensity; the docs say plainly that it is for finding a feature, not for judging a match, since two scales make any scale factor look aligned.
New
gui/nudge_field.py(NudgeField,make_nudge_buttons). Four panels already had their own wheel-editable line edit; none had arrow buttons or handled a value of exactly zero, where a percentage step does nothing and a background usually starts. Migrating those four is a behaviour change in the fitting panels and was left out of this issue.
Added#
⌘W / Ctrl+W closes any pyIrena window, and F1 opens its documentation (#16). Tool windows are independent top-level widgets with no common base class, so none of them answered the first shortcut a Mac user tries. All 26 windows now do, through one new helper,
gui/shortcuts.py.The binding comes from
QKeySequence.StandardKey, not from a literal: that is ⌘W on macOS and Ctrl+W (plus Ctrl+F4) on Windows and Linux, which is the point — hard-coding"Ctrl+W"would have given Mac users Control+W, a different key from the one they press.F1 presses the ? Help button a window already shows, so it opens exactly the page that button opens and there is no second code path to keep in step. Windows without a Help button do not get F1.
Each shortcut is scoped to its own window, so two open tools do not compete for ⌘W, and ⌘C in tables is untouched.
pyirena/tests/test_window_shortcuts.pykeeps this true: every Qt widget class undergui/must be declared either a window (and then it must install the shortcuts) or an embedded pane (with a written reason). A new window that forgets fails the build rather than silently not answering ⌘W.
⌘S was evaluated and deliberately left out. There is no single “save the result” action across the tools — the candidates are “Save Merged Data”, “Apply && Save”, “Save params to JSON”, “Save CSV…” and “Save JPEG”, which are different operations. One key that means a different thing in each window is worse than no key. The helper supports
on_savefor when a consistent action exists.
Removed#
SAXS Morph: the fitting that was planned and never arrived (#29). SAXS Morph is a visualisation tool. It takes the autocorrelation from the data, builds a Gaussian Random Field realisation of it, and measures structural parameters off the resulting voxelgram; the only true fits are the two background pre-fits. An early plan treated it as a Modeling-like fitting tool and left half of that plan in the tree, where it read as unfinished work rather than as a decision. It is now a decision, and the remnants are gone:
SaxsMorphEngine.fit()(deprecated in its own docstring, called by nothing butcalculate_uncertainty_mc),calculate_uncertainty_mc(), their_pack_params/_unpack_paramshelpers, and the_cancel_checkhook that existed so a GUI worker could interrupt a fit.MAX_FIT_VOXEL_SIZEandvoxel_size_fit. There is no fit loop, so there is no fit-resolution grid to size.compute_voxelgramnow falls back tovoxel_size_render. The knob was readable by the batch path and not settable from the GUI at all.The
fit_*,*_limits,no_limitsandn_mc_runsfields ofSaxsMorphConfig.link_phi_contraststays: it is written into saved HDF5 and older files read back through it._FitWorker,_MCWorkerand the never-instantiatedParamRowingui/saxs_morph_panel.py.The per-parameter
fit/limit_lo/limit_hiattributes and<param>_errMC scalars are no longer written into saved results. Files written before this still read — those entries are simply ignored, andresult_from_loaded_dict()supplies defaults as always.
batch.fit_saxs_morphno longer takeswith_uncertainty/n_mc_runs. It accepted both and silently ignored them. A signature that accepts a parameter and does nothing with it is worse than one that omits it, so they are gone, along with the comment ingui/data_selector/workers.pythat claimed SAXS Morph supported MC. This is a breaking change for any script passing those two arguments positionally or by keyword; passing them never had an effect. The function keeps its name for symmetry with the other fivefit_*functions and for thefit_pyirenadispatcher, and its docstring now says plainly that only steps 1 and 2 are fits.
Changed#
SAXS Morph GUI state schema 2 → 3:
voxel_size_fitis dropped from a loadedstate.jsonon migration. Every other saved value is preserved.("saxs_morph", "viewer")intest_tool_registration.pywas the one registration gap labelled “open gap rather than a decision”. It is now a written decision: SAXS Morph visualises one structure at a time and has no fit quality to trend across files.
Fixed#
Merging threw away everything recorded about DS2 (#21). A merged file is seeded by copying DS1, so DS1’s metadata came across for free and DS2’s was dropped entirely — merge USAXS with SAXS and the result remembered the USAXS measurement and nothing at all about the SAXS one. DS2’s
metadata,instrumentandsamplegroups are now carried into the output under a technique suffix, so a USAXS + SAXS + WAXS chain ends up withmetadata(USAXS, from DS1),metadata_saxsandmetadata_waxsside by side; the second merge carries the first’s suffixed groups along with the rest of DS1. Three things worth knowing:The technique is read out of the file, never out of its name, using the same marker Matilda uses to pick a detector geometry —
pin_ccd_tilt_xmeans SAXS,waxs_ccd_tilt_xmeans WAXS, aflyScangroup means USAXS. A file with none of these is carried under_ds2rather than guessed at.Beamline files disagree on capitalisation (
entry/metadatafrom a USAXS reduction,entry/Metadatafrom SAXS/WAXS), so the lookup is case-insensitive. The output is always lower case.Raw 2-D detector images are not carried. A SAXS/WAXS
instrumentgroup holds the detector frame — ~10 MB on a current Pilatus/Eiger — which has no business in a merged 1-D curve file. Datasets of 1 MB or more are skipped and listed in the destination group’spyirena_skippedattribute, so a pruned group never passes for a complete one. On a real USAXS + SAXS merge this is the difference between a 0.83 MB output and a 10.7 MB one.
Applies to every merge path — GUI single and batch,
pyirena.batch.merge_data, and themergedata op — since all four go throughsave_merged_data.Where DS1 is not NXcanSAS the output is built from scratch and so began with no metadata at all; DS1’s groups are now copied in explicitly there too.
Stale “Phase 1/2/3/4” wording in strings that ship to users (#31). The phase numbers were internal planning vocabulary and meant nothing to anyone reading them from the MCP/ZMQ surface or a module docstring. They now say what is true instead:
get_parameter_uncertainties(control function and its MCP schema) said uncertainties were “not available in Phase 1” and that “a future phase” would add them. It now says the tool does not compute them and points at the two places that do —pyirena.batch.fit_unified(with_uncertainty=True)and the Unified Fit GUI’s Monte-Carlo run.The SAXS Morph panel docstring described a Phase 2 state of the world: a “placeholder” below the I(Q) plot that is in fact the 2D slice and 3D voxel viewers, and Fit/Cancel/MC-uncertainty buttons “constructed but disabled” that are not constructed at all. It now describes the panel as it is — model evaluation only, with the morphology fit living in
pyirena.batch.saxs_morph.fit_saxs_morph— and points at #29 for the unwired_FitWorker/_MCWorkerclasses.The AI advisor docstring’s “Phase 1 supports:” is now “Supported providers:”.
Changed#
saveNXcanSASnow writes the NXcanSASQ_indicesattribute on both the desmeared and slit-smearedSASdatagroups, as[0]— the 0-based index of the dimension ofIthatQspans, which for 1-D data is 0. It had been commented out with a# TODO not sure what this means, and with the wrong value ([1]). Purely additive: readers that ignore the attribute, including pyIrena’s own, are unaffected; files written before this change still read.
[1.2.0b2] - 2026-10-01#
Config serialisation, and the replay path that depends on it. Everything a
saved setup carries now survives being replayed — through pyirena.batch,
through analyze(), and through every wrapper pyIrena writes.
Config serialisation: one vocabulary, not four#
A tool’s settings have been written in two vocabularies inside four different
wrappers, and only one wrapper could be read back. The consequence was not
errors — it was replayed fits that kept every number and lost the decisions
about them. See planning/config-dialects/ for the full inventory.
Nothing you already have stops working. Every config file, every
state.json and every saved .h5 still loads; they are simply rewritten in
the current dialect when next saved.
Fixed#
A Unified Fit config exported from the GUI replayed with every fit flag and bound lost. This is the documented ZMQ and
analyze()workflow — set the fit up once, replay it on each new measurement — and it silently freed the parameters the scientist had pinned and dropped the bounds that kept the fit physical. The values were all correct, so the result looked plausible. The reader handled a bare number as a value and skipped thefit_RgandRg_limitskeys sitting beside it.Modeling replayed every non-size-distribution population at its dataclass defaults, from any saved
.h5— five of the six population types. The panel nests those types’ settings underuf/peak/gp/mf/sf2so that switching a population’s type in the GUI does not lose the settings of the type you switched away from; nothing headless knew to look there. IntestData/Scripting/Modeling_PP15.h5the affected population is a pure power law (G = 0, Rg = 1e10, B = 7.45e-6, P = 3.707) and came back as G = 1, Rg = 10, P = 4 — a different curve entirely.⚠️ This changes results for existing Modeling setups, correctly. If you have been replaying a saved Modeling setup with a Unified-level, diffraction-peak, Guinier-Porod, mass-fractal or surface-fractal population, you were getting default parameters and will now get yours. Pipeline output will move.
Size Distribution replayed a spheroid as a sphere. The aspect ratio was read from the panel’s flat key and only fell back to
shape_paramswhen the shape was not a spheroid — the one case where it matters.Size Distribution lost the slit settings on a round trip. A slit-smeared setup, saved and reloaded, came back as a pinhole fit: a different, plausible answer.
use_slit_smearingandslit_lengthare now into_dict()and in the panel state.The config’s own
unc_n_runswas read by nothing on the replay path, sopyirena.batch.fit_sizesignored the uncertainty-run count the user set in the GUI. An explicitn_mc_runsargument still wins.build_setup()rejected two of the four envelopes pyIrena writes — and they were the two a remote caller actually holds: the_pyirena_configattribute inside a result file, and anexport_results()reply. Both failed withConfig has no '<tool>' section. A fourth branch, for{"tool": …, "model": …}, was unreachable and, when reached, built an all-defaults model without saying so. All four are now read, and theexport_results() → analyze()round trip works.An accepted wrapper still lost the execution settings.
build_setup()unwrapped all four envelopes, butanalyze()then re-read the config with a shallow lookup to decide what to pass the runner — so for three of them it handed the runner the wrapper and found nothing in it.no_limits, the Modeling fit method and the WAXS weight mode were invisible: a fit told to ignore its bounds stopped dead at one and reported success. The resolved section now travels onToolSetup, so there is only one reader.Simple Fits’ held parameters were lost in two directions.
export_results()reported onlymodel.to_dict(), which has no room for them, so the documented replay the reply on the next measurement loop freed on the second pass whatever the scientist had pinned on the first. Separately,save_simple_fit()wrote afixed_paramslist into the HDF5 setup while the reader understood only aparam_fixeddict, so a saved agent run lost them too. The report now statesfixed_params, and all three spellings read — including the files already on disk.A replayed config ignored the curve’s own slit smearing, for every tool but Size Distribution.
select_simple_model(),select_modeling()andselect_unified_model()all smear the model when the data say they are slit smeared;analyze()installed the model directly and skipped that, so a pinhole-exported config replayed on a USAXS curve fitted it unsmeared — about 10% low in I0, with nothing to show for it. Slit settings are now resolved once, in the shared setup builder, for all four tools that smear. Whichever source asks for the smearing names the length: a config that asks wins, a stale length beside an unticked box does not.The Invariant replayed without its background pre-fit.
pyirena.batchre-determined the complex background from the saved windows before integrating; theanalyze()path did not, and an integration never refines its background afterwards. On a curve with a flat background of 2 the invariant came back 232× too large, reporting success. Both paths now call the same pre-fit, and it obeys the held-parameter choices.Carbon’s saved weighting was overwritten with
auto. The panel keepsweightinginside its nestedmodelblock, where the runner mapping was not looking, so a config saved with relative weighting was refitted with the default — a different background on any curve where the two disagree.A one-sided Q range off the end of the curve raised
TypeError. The warning explaining the nonoverlap formatted both bounds, and a config may legitimately state only one; absent bounds are now rendered asopen.
Changed#
The panel dialect is now read-only. Unified Fit’s older shape — each parameter a
{"value", "fit", "low_limit", "high_limit"}block, withRgCutoff/correlated/estimate_BforRgCO/correlations/link_B— is still read everywhere and no longer written anywhere. What is written ismodel.to_dict(), the same shape the other five tools already used, which also carriesK,mass_fractalandRgCO’s own flag and bounds that the panel vocabulary had no room for. Setups now stateschema_version(3 for Unified Fit) so a reader is told the dialect instead of inferring it.The embedded setup in an HDF5 file says what it is. A
_notein the header — “pyIrena tool setup. Replay it with pyirena.batch, or with pyirena.api.control.analyze(data, config).” — for whoever opens the attribute in HDFView, Igor orh5dumpand has to guess otherwise.Modeling writes the active population’s fields flat as well, in the current dialect, while keeping the per-type blocks the GUI needs for type switching. A reader that knows nothing of the blocks now sees the population the file actually describes.
Export Parameters no longer writes view-only keys.
last_folderin particular was an absolute path from whichever machine exported the file, travelling into every shared config and result file. These stay in the state file, where a user’s view preferences belong.Fractals’
GrowthConfigandOptimizerConfigserialise themselves rather than having the panel enumerate the same fields a second time.
Added#
“No limits?” is reachable from the agent API, for every tool that has bounds. The check box has been in the GUI for four of the fitting tools and callable from the API for exactly one (Simple Fits), so a scientist could release a fit stuck against a bound and an agent driving the same session could not.
run_fit,run_modeling_fit,run_waxs_fitandrun_carbon_fitall takeno_limitsnow,analyzehonours it from a saved config, and the MCP schemas describe it.What it means differs by tool, and that is deliberate — Unified Fit and the Carbon model release the user’s bounds back to each parameter’s declared default (what those panels have always done, so no number changes), Simple Fits and WAXS solve genuinely unconstrained, Modeling switches to an unconstrained Nelder-Mead. The contract is the same everywhere: ignore the bounds I set, and put them back afterwards — they belong to the setup, not to one run of it. Size Distribution has none, being an inversion.
For Unified Fit, values landing outside the bounds that are still on the model are reported as exactly that, rather than as “pinned at a limit”: nothing was pinned, because the fit never used those limits, and where the parameter went is the answer that was asked for.
The Carbon model gains “No limits?”, in the panel and through the API, for parity with the other tools — a full-range fit with fifteen-plus free parameters is the one most easily trapped against a bound that was only ever a guess. The fractal-dimension safety clamp still applies: outside it the model has no gradient at all, so the fit would spend its whole budget without moving. “No limits” must not mean “no gradient”.
pyirena/tests/test_config_contract.py— a completeness contract over all six tools rather than one test per tool. Every scalar setting is either into_dict()or named in the class’s_NOT_SERIALISEDallowlist with a reason; a model rebuilt from its own dict has to run a fit, not merely compare equal; and a model with every fit flag inverted and every bound narrowed has to surviveto_dict() → build_setup() → to_dict()in all four envelopes. That last one is the test every bug above fails and a values-only comparison passes. It covers all five encodings of “a parameter with a fit flag and bounds”, including Simple Fits’param_fixed, whose boolean means the opposite of everyone else’s. The real exported configs and result files intestData/Scripting/are replayed too.pyirena/tests/test_unified_state_dialects.py— a live panel driven through both dialects: a pre-1.2 state file restores every control, comes back out in the current dialect, and the agent API’s embedded setup is a shape the GUI can open.$PYIRENA_STATE_DIR— overrides where pyIrena keepsstate.json,window_geometry.jsonand its logs. The test suite points it at a temporary directory, which it needed to: constructing a GUI panel in a test wrote the developer’s own saved settings.docs/batch_api.mdgains the two dialects, the four envelopes, the rule for where a fitted Q range lives, and the mapping tables for the four spellings of that Q range and the five encodings of a fit flag. The worked examples in it are now checked by the test suite.docs/HDF5_NxcanSAS_structure.md§ 5.1 records why the embedded setup stays hand-readable.
[1.2.0b1] - 2026-09-29#
First beta of the 1.2 line: the Carbon model tool and the ZMQ service.
Install with pip install --pre pyirena[gui].
Added#
ZMQ service (
pyirena-zmq, optional[zmq]extra) — serves pyIrena’s fitting tools to a caller on another machine as JSON in / JSON out over a plain REQ/REP socket, port 9865 by default. Built for an experiment orchestrator that drives instrument and analysis services and shares no filesystem with the analysis workstation, so the data travels inside the request and the results inside the reply. One UTF-8 JSON document per message, no multipart, sosend_string/recv_stringis a complete client. Seedocs/zmq_service.md.The service is synchronous, and it never goes quiet: each request gets a 55-second budget, and work that overruns returns a
TIMEOUTreply rather than leaving the caller’s REQ socket to die. The session it abandoned is marked stale, because a half-fitted model must not be read as a result.Server options are a designed surface rather than a pile of flags: a config file, CLI flags and per-request overrides, in that order of precedence, with a rule that a request may narrow what the operator allowed and never widen it.
server_inforeports the effective values so a caller discovers what a deployment permits instead of guessing.pyirena/zmq/client.pyis a reference client that handles the ZMQ detail that catches everyone: a REQ socket that has timed out is unusable and must be rebuilt, not reused.docs/zmq_service_testing.md— a tickable deployment and test procedure for the ZMQ service, andscripts/zmq_smoke_test.py, a standalone client-side checker that needs only pyzmq (no pyIrena, numpy or h5py) so it runs on a bare orchestrator machine.analyze()— fit a curve with a saved pyIrena configuration in one call. The coarse counterpart to the session tools, for the common case where the fit is already known: a scientist set it up in the GUI, exported the parameters, and every new measurement should be fitted the same way. One request instead of six, and it opens and closes its own session so it cannot leak one. The tool is inferred from the config, which holds exactly one tool section as the GUI writes it. Available over MCP and the ZMQ service alike.It applies the whole configuration, not just the model: the fitted Q range, the held parameters, and the per-tool preparatory steps (the Size Distribution’s power-law and flat-background pre-fits, the WAXS peak Q0 presearch). Those change the result, so omitting them would return a plausible wrong number rather than an error. Anything adjusted — a Q range clipped to the curve, a pre-fit that failed — is reported back in the reply rather than swallowed.
pyirena/core/tool_config.py— one implementation of “config section → configured model”, now shared bypyirena.batchandanalyzeinstead of living inline in eachbatch/<tool>.py. The test suite fits all six tools through both paths on real exported configs and requires identical numbers, so the two cannot drift the way the batch and GUI paths did before.open_dataset_from_data()— create a fitting session from q/I/dI arrays with no file involved, for callers that hold the data rather than a path the server can read. Cleaning reuses the text-import rules, so a curve behaves the same whichever way it arrived, and the counts are reported insummary.cleaningrather than applied silently. Available over MCP too.export_results()— one JSON report for all six fitting tools: identity, a quality block normalised across tools that spell chi-squared differently, the tool’s own results, and the model’sto_dict()config, so a fit set up once can be replayed on the next measurement. Optionally the data, model, residuals and per-component curves. The machine-readable counterpart tosave_*, and available over MCP as well.Dispatcher profiles. Every tool now carries
touches_files/returns_imageflags, and a transport can ask for only what it can honestly serve. A JSON-only transport never sees a tool that would hand it a path on the server’s disk. MCP is unaffected and keeps the full set.Carbon model — a new analysis tool that fits the whole measured range of a disordered carbonaceous material (USAXS → SAXS → WAXS, often five decades in Q) as one model: grain Porod scattering with optional surface roughness, micropore scattering, and turbostratic diffraction peaks. Following Saurel et al., Energy Storage Materials 21 (2019) 162–173 and its 2020 corrigendum.
All three contributions are refined together, because the contrast that scales them is computed from the fitted WAXS peak positions and the porosity — fitting the regions in sequence converges somewhere else.
Beyond the formulas, the tool wires the materials-science layer: a chemical formula and the fitted lattice spacings give the structural density, the porosity gives the sample density, and each density gives an SLD and a contrast — yielding about twenty derived quantities (BET-comparable specific surface areas, pore and wall widths, stack height, layers per stack, d-spacings) rather than just fit coefficients.
Micropores are described either as dilute pores with optional fractal aggregation or by the Teubner-Strey two-phase model (a mode toggle, never summed); diffraction peaks can optionally carry the crumpled-layer envelope of eq. (16)–(17), whose geometry can be linked to the SAXS region’s.
Wired into every surface: GUI panel, Data Browser launcher and results graph,
entry/carbon_fit_resultsin NXcanSAS,fit_carbonbatch path,pyirena.api.read_carbon_fit, thecarbonMCP control category (16 tools), HDF5 Data Explorer trend plots, Igor export, anddocs/carbon_fit_gui.md.Carbon model: “Revert back”. One level of undo, snapshotted at the start of every fit, matching the button Unified Fit has. A full-range model with fifteen-plus free parameters will sometimes run to a wrong solution, and rebuilding the starting point by hand is the expensive part. Restores the whole model — values, bounds, Fit? flags and the peak list — but not the Q range, which belongs to the user’s cursors rather than to the fit.
True Voigt peak shape in WAXS Peak Fit. The real Lorentzian⊗Gaussian convolution via the Faddeeva function, not the existing linear pseudo-Voigt mix. Added for the Carbon model, where crystallite size (Gaussian) and layer curvature (Lorentzian) broaden independently, but available to WAXS Peak Fit too: choose
Voigtand the Lorentzian component appears asFWHM_Lalongside the GaussianFWHM. Wired through the panel, the HDF5 schema, reporting and both export paths.Tool-registration contract test (
pyirena/tests/test_tool_registration.py). Adding an analysis tool means touching ~45 files, about a dozen of which are a key in a hand-maintained registry — and missing one fails silently. The test holds the canonical tool table (one row per tool, one column per surface, either the registering key or a written reason for its absence) and checks all of them. Adding a tool is now: add the row, run the test, work the failures. Documented indocs/developer_adding_features.md§ “Adding a whole new tool”.docs/module_map.md— one line per module across all ~120 modules, so a shared helper can be found without grepping 113,000 lines.AGENTS.md— the repository orientation file, previouslyCLAUDE.md, under the name every coding agent looks for.CLAUDE.mdnow points to it.
Changed#
The tool dispatcher moved from
pyirena/mcp/dispatch.pytopyirena/api/dispatch.pynow that two transports use it. The old path is a re-export shim, so existing imports keep working.Session.file_pathis now optional, and the six near-identical save-target blocks in thesave_*tools became oneapi/control/_save.py. Saving a session that came from arrays needs an explicitoutput_path(otherwiseNO_SOURCE_FILE), and writes a complete, re-openable NXcanSAS file built from the session’s own arrays.Unified Fit: the “Fit” button is now noticeably larger than “Fix limits?” so the primary action is easier to hit; “Fix limits?” is slightly shorter.
Data Selector: right-clicking a file in the file list now offers “Show file in Finder/Explorer…” to reveal it in the OS file browser.
Fixed#
save_to_nexus=Falsewas ignored byfit_simple_from_config(), which wrote fit results into the input file regardless. The parameter was in the signature and the docstring but never passed on, andfit_simple()had no such parameter at all — it always wrote when handed an HDF5 file. Both now honour it. Anything that ran a Simple Fits config over someone’s data while asking not to modify it was modifying it.pyirena.batch.fit_simple_from_config()failed for every real model.SimpleFitModel.from_dict()rebuilds its object withcls.__new__and assigns fields by hand, souse_analytic_jacobian— set in__init__, absent fromto_dict()— was missing entirely from any model loaded from a config file, andfit()raisedAttributeErroron it. The field is now serialised and restored. The regression went unnoticed because the only tests on that path use theInvariantmodel, which returns before reaching the Jacobian branch; the new tests rebuild a model from its dict and then run a real fit.get_session_summary()raisedAttributeErroron any Modeling or Carbon model session. It assumedlast_fit_resultwas a dict; those two tools store a result dataclass.Check boxes were invisible on Windows and Linux. Every “Fit?” check box in Unified Fit, and every other check box and radio button in the GUI, drew no box at all — at best a tick floating in empty space. The shipped theme set
background-color: transparentonQCheckBox/QRadioButton, which looks harmless, but Qt copies a stylesheet background into theQPaletteit hands the base style (bothWindowandBase), and Fusion derives the indicator’s outline frompalette.window()and its interior frompalette.base(). Both became fully transparent, so the box was painted in a transparent pen. macOS happened to still show something; Windows and Linux showed nothing.The indicator is now drawn explicitly by the theme — a 12 px box with a 4.5:1 outline (new
BORDER_STRONGtoken), filled with the accent blue and a white tick (or dot, for radio buttons) when checked. Fusion’s own outline waspalette.window().darker(140), a 1.6:1 hairline that a 125% or 150% display scale rounds away even when it is painted, so this also fixes the faintness the outline had wherever it did survive. The two glyphs ship as SVG inpyirena/gui/assets/and are rasterised at device resolution, so they stay crisp on Retina and on fractionally scaled displays.Also: a checkable
QPushButton/QToolButton(the graph window’s X/Y log toggles) now shows its checked state, which the theme’s button rules had overridden into looking identical to unchecked.Carbon model: a fitted fractal dimension could be silently unfittable.
teixeira_structure_factorclamps D into (1.001, 2.999) because Γ(D−1) diverges at one end and the formula degenerates at the other — and outside the clamp the function is flat, so the finite-difference gradient is exactly zero. A D parked there burns the whole evaluation budget without moving, which is indistinguishable from a parameter that was never wired up. Widening the bounds to the physical (1, 3), which is the natural thing to type, put D in exactly that dead zone. Fit bounds are now narrowed into the differentiable range automatically and the fit reports that it did so.Carbon model: the fit did not scale its parameters. They span five orders of magnitude (a specific surface area ~1e4 cm²/cm³ beside a fractal dimension ~2.5), so an unscaled trust region is sized by the largest and the small ones barely move. With
x_scale='jac'a far-from-solution fit drops from ~3000 evaluations to ~560, and a case with a large Σ/r ratio now recovers the fractal dimension it previously missed by 5 % (χ² better by 14×).Carbon model: a parameter pinned at a bound is now reported. It is the one failure that looks like success — the fit runs, a value is reported, and it came from the limit. The panel highlights the field, the status line and the report say so, and the agent API returns
pinned_parameters. A parameter resting on a zero floor is reported separately, because “widen the bound” is the wrong advice for it.Carbon model: the WAXS zoom panel went blank after a fit. The cached curves shared one Q array between the measured data (full range) and the model (the fit range only), so a fit over a restricted range paired a 284-point model with a 400-point data array; the redraw raised part-way through, leaving an empty panel — and the exception escaped the fit itself. Data and model are now cached on separate grids and the redraw can no longer propagate.
Carbon model: the WAXS zoom panel was almost unusable to frame. It took its Q window from the peak starting guesses (graphite positions, before a fit possibly nowhere near the sample) and left Y to autoscale over the whole curve, whose low-Q end is orders of magnitude above the diffraction peaks — so the peaks sat flat on the baseline and the only way to see them was typing limits into the axis dialog. It now opens on Q ≥ 1 Å⁻¹ out to the highest measured Q with the Y axis scaled to that window, re-frames after a fit, and has a ⟲ button to restore the view by hand.
Carbon model: the filename field read “(no file selected)” when the panel was opened from the Data Browser.
set_datadid not call the loader row’sset_filename, so the field only ever tracked this panel’s own Open… button.Cursors were fiddly to grab. pyqtgraph derives an
InfiniteLine’s hit area from its pen width, giving pyIrena’s 2-pixel cursors a band about four pixels wide — accurate, and hard to hit, especially where two cursors sit close together on a log axis._SafeInfiniteLinenow widens the bounding rectangle (which is what Qt hit-tests against) to an 18-pixel band without drawing a thicker line. Applies to every tool that uses the shared cursors.Carbon model: peak parameters scrubbed far too fast. The shared wheel-scrub step is 10 % of the value’s leading decade, which moves a peak centre at Q₀ ≈ 1.9 Å⁻¹ by 0.1 Å⁻¹ per notch — about a third of a carbon peak’s width, so it jumps straight past the target. Peak positions and both Voigt widths now scrub ten times finer (0.01 Å⁻¹ and 0.001 Å⁻¹ per notch). The amplitude keeps the coarse step, being the one peak parameter you want to move in large relative jumps.
Carbon model: the fit progress callback was repainting too often. It pumped the Qt event loop every tenth residual evaluation; on a badly-conditioned model that is thousands of repaints and made the fit several times slower than the arithmetic it was reporting on. Now throttled to ten updates a second. Fit tolerances also relaxed from 1e-10 to 1e-8 — precision no SAS measurement carries, and worth roughly 2× on a degenerate model for results that agree to four significant figures.
set_cursor_q_range()did not place the cursors where it was asked to. On the path where the cursors do not exist yet it created them withmake_cursors(), which insets them by 10 % of the log span, and then returned without moving them — so a restored Q range came back 10 % narrow at both ends. Harmless for a single-region fit; for the Carbon model, 10 % of five decades is half a decade, and the top half-decade holds the (100) reflection whose position the contrast calculation reads.fit_pyirenasilently skippedsaxs_morphconfig sections.batch.saxs_morph.fit_saxs_morph()existed with the right signature but was never registered in the pipeline’s tool registry, so asaxs_morphblock in apyirena_config.jsondid nothing. Found by the new registration test.test_window_state.pywas intermittently failing on developer machines. Its live-window tests went through the realrestore_window_state, which asksscreen_rects()where the monitors are and declines to place a window it cannot see — so the tests depended on the ambient display configuration. Whenscreen_rects()came back empty (macOS under load, display sleep, fast user switching) every restore became a no-op and a window asserted at (70, 55) arrived at (0, 0). The module now pins the screen layout with an autouse fixture; the placement policy itself is pure and was already tested with explicit screen rectangles, so no coverage is lost.SAXS Morph and Fractals results leaked into derived data files.
PYIRENA_RESULT_GROUPS— the list of result groups stripped when a tool seeds a new output file from a source file — was maintained by hand and had fallen two tools behind, so Data Merge, Data Manipulation and the control API’soutput_pathcarried stale SAXS Morph and Fractals results into the new file. The list is now derived fromio/schema.py::TOOL_REGISTRY.Running the test suite left every control panel opening at two-thirds of the window width. Two faults, one symptom. The tests wrote to the real
~/.pyirenarather than a temporary directory; and geometry was recorded for windows that had been constructed and thrown away without ever being shown, where a splitter reports size hints — the graph pane sitting at its minimum — instead of pane widths. Rescaling on the next launch then reproduced that ratio faithfully. Tests are now isolated via$PYIRENA_STATE_DIR, andsave_window_stateignores a window the user never saw. Unified Fit, Size Distribution, Modeling and Simple Fits were affected; Carbon and SAXS Morph were not, because no test opened them. Users were never affected — the GUI shows every panel as it creates it — but anyone who had run the suite was.Fixed a
QSplitter.setSizes()quirk that could make the Modeling and Unified Fit control panel balloon to a large, unusable fraction of the window width when the saved pane-width state was stale or corrupted (values much smaller than the window’s actual width). Saved splitter sizes are now rescaled to the panel’s current width before being applied.
[1.1.1] - 2026-09-12#
A maintenance release on top of 1.1.0. It completes the AI/scripting surface for the three tools that had stopped at the GUI (Scattering Contrast, Data Manipulation, Data Merge), keeps the MCP tool count inside provider-side caps, and fixes a data-corrupting misread of slit-smeared NXcanSAS files. Saved-file compatibility is unchanged; files written by 1.0.x and 1.1.0 load as before.
Added#
Data Manipulation and Data Merge are now reachable from scripts and AI agents. A new
pyirena.api.data_opsgroup addsaverage_data,subtract_data,divide_data,scale_data,trim_data,rebin_data,merge_datasetsand the read-onlymatch_merge_filespairing helper, exposed over MCP as the dispatcher’sdatacategory (again no new top-level MCP tools — the count stays at 26). Previously an agent asked to average or subtract data had no tool for it: only the two read-only provenance readers existed, and those return{"found": false}on a raw file, so the agent would retry and then sweep the whole tool list. Output naming is unchanged from the GUI and batch layers — a sibling_manip/_mergedfolder plus the per-operation filename suffix (_avg,_sub,_div,_scaled,_trimmed,_rebinned,_merged). These wrapcore+iodirectly rather thanpyirena.batch, which attaches a stdout log handler that would corrupt MCP’s stdio transport and returns a bareNoneon every failure. The api layer adds guards core does not have: mismatched slit smearing is refused for averaging (not only for subtract/divide), an empty trim window is an error rather than a silent zero-length result,auto_scalewithout both Q bounds is rejected instead of silently ignored, swapped merge inputs are caught, and every call reportsn_points_in/n_points_written/n_dropped_nonpositiveso an over-subtraction is visible.Scattering Contrast is now reachable from scripts and AI agents. A new stateless
pyirena.api.calculatorsgroup wrapspyirena/core/scattering_contrast.py:calc_contrast(X-ray and neutron contrast between two compounds from formulas + densities, optionally anomalous at a given energy),calc_compound(one material’s SLDs),calc_contrast_energy_scan(contrast vs energy, for anomalous SAXS planning),lookup_element, and read-only access to the saved compound library (list_compound_library,load_compound). Previously the tool stopped at the core/io/gui layers, sopyirena-mcp— a pure wrapper overpyirena.api— could not see it and agents derived contrasts by hand.calc_contrastreturns (Δρ)² in 10²⁰ cm⁻⁴, the same units the Sizes and Modelingcontrastparameter expects, so results feed straight into a fit.pyirena-mcpexposes these as a sixth dispatcher category,calculators, alongside the five fitting categories. The dispatcher (pyirena/mcp/dispatch.py) now serves several schema registries rather than onlypyirena.api.control, so the group adds no top-level MCP tools — the registered count stays at 26, and future calculators are free.New
contrastextra (periodictable,xraydb), referenced fromgui,mcpandall.pip install pyirena[mcp]now gets working calculators without pulling in Qt; previously these two packages were reachable only through theguiextra.pyirena-doctorreports them against the new extra.
Changed#
pyirena-mcpcollapsed ~90pyirena_ctrl_*control tools (Sizes, Simple Fits, Modeling, WAXS Peak Fit, and most of Unified Fit) into a fixed 4-tool dispatcher (pyirena_list_categories,pyirena_list_tools,pyirena_describe_tool,pyirena_call), reusing the existingpyirena.api.control.schemas.TOOL_SCHEMA_BY_NAMEregistry (pyirena/mcp/dispatch.py). The server’s registered tool count drops from ~110 to ~26. This was needed because a large combined MCP tool count from clients with several active servers can exceed provider-side caps on the number of tools in a single request (observed via a gateway proxy’s 128-tool limit). Session-lifecycle tools (pyirena_ctrl_ open_dataset,list_open_sessions,close_session,get_session_summary) are unchanged and still top-level. Seedocs/ai_tools_reference.mdfor the new calling convention.
Fixed#
Slit-smeared data with no per-point Q resolution was read incorrectly, crashing or corrupting every manipulation. NXcanSAS lets such data declare
Q@resolutions='dQl'— the scalar slit length as the only resolution contribution — andreadGenericNXcanSAStook the firstresolutionstoken as the per-point resolution dataset, sodQcame back as a 0-d scalar. Every consumer that indexesdQthen raisedIndexError: invalid index to scalar variable(trim, rebin, average, subtract, divide — in the GUI panels as well as batch), whilescalequietly copied the scalar through and the saver wrote the slit length out as a 0-dQdev, corrupting the file’s resolution metadata in a way that read back as a scalar again next time. The file was standards-correct; the reader was not. Fixed at three levels:readGenericNXcanSASnever selectsdQlas the per-point resolution and validates the shape of whatever it does select;DataManipulationandDataMergetreat adQthat is not parallel toQas absent; andcreate_nxcansas_fileignores a non-conformingdqwith a warning instead of writing a malformedQdev. Files already carrying a 0-dQdevnow read cleanly, and shed it the next time any pyirena operation rewrites them. No resolution information is lost — for slit-smeared data the resolution is the slit length, carried separately asslit_length/dQl.pyirena.batch.average_datadid not passslit_lengthto the saver, so averaging a slit-smeared series silently produced a pinhole file with nodQl— corrupting any later desmearing or smeared fit.manipulate_dataalready did this correctly.Windows: pyqtgraph could fail with
DLL load failed while importing QtCorein an environment that carries both PySide6 and PyQt6. pyqtgraph tries PyQt6 before PySide6, so a half-installed PyQt6 broke it even though PySide6 loaded fine.pyirena/gui/_qt.pynow pinsPYQTGRAPH_QT_LIBto the binding pyIrena actually imported.pyirena-doctorreported a broken PyQt6 asok (version unknown)— it only imported the (nearly empty) top-level package. It now imports<binding>.QtCore, warns when both bindings are installed, and no longer blames the Visual C++ redistributable for what is a mixed-bindings collision.Declared
sixas a core runtime dependency. PyIrena’s public HDF5 reader uses it for metadata handling, so clean installations can now import the scattering-data API without an undeclared dependency.
[1.1.0] - 2026-09-08#
First stable release of the 1.1 line. The code is identical to 1.1.0b12;
this entry summarises what 1.1.0 brings over 1.0.1. Per-change detail,
including every fix, lives in the 1.1.0b1 – 1.1.0b12 entries below.
Saved-file compatibility is preserved: NXcanSAS result files written by 1.0.x
load unchanged, and from_dict() supplies a default for every field added
during the 1.1 cycle.
Highlights#
Slit smearing across all fitting tools (b1). Unified Fit, Sizes, Modeling, Simple Fits and WAXS Peak Fit can fit slit-smeared USAXS/Matilda data directly, with the smearing geometry carried through result files and merge provenance.
Fits are substantially faster, with the same numbers. Analytic Jacobians replaced finite differences in the four gradient-based tools — 1.7–2.1× on Unified Fit, 1.4–2.2× on Modeling, up to 2× on Simple Fits, ~1.8× on large WAXS fits (b11) — on top of a ~3× vectorisation of the Modeling hot path (b9) and parallel Monte-Carlo uncertainty (b4). An exact gradient also fixes fits finite differences could not do at all, such as a Debye chain over a USAXS Q range.
pyIrena is agent-drivable.
pyirena/api/control/exposes interactive fitting sessions for all five fitting tools, wrapped by an MCP server (b5–b7), with the control/MCP write surface confined toPYIRENA_DATA_ROOT(b2).A validation suite with exactly known answers (
validationData/, b10): synthetic data generated from known parameters, refitted end-to-end intoVALIDATION_RESULTS.md, with Igor Pro Irena results tabulated alongside for 98 of the quantities. Current status: 195 of 195 scored comparisons within tolerance; median deviation from truth 0.185 % for pyIrena versus 0.308 % for Igor Irena, and 0.040 % between the two packages.A uniform UX contract across every panel (b7): clipboard copy, column sorting and CSV export on every table; graph copy/PNG/SVG/CSV export everywhere; “Copy results” and “Save report…” on the fit panels; regex file filters; shared filename sorting; drag-and-drop file opening; windows that reopen where you left them.
Readable on every desktop (b10): pyIrena ships its own light theme, so controls no longer become unreadable under a dark OS appearance.
Core model objects serialise themselves (b7).
to_dict/from_dicton Unified Fit, Sizes, Modeling, Simple Fits and WAXS Peak Fit make panel state, batch configs and HDF5 contents one shape rather than three.A stable, Qt-independent scattering I/O boundary for companion tools (b12):
discover_scattering()/load_scattering()plus the minimalpyirena[qtplot]extra.Tested on Linux, macOS and Windows (b10), with Windows-specific encoding, path-separator and BOM bugs fixed.
Installation troubleshooting:
pyirena-doctordiagnoses wrong-environment and missing-extra installs instead of reporting “GUI dependencies not installed” (b4).
Changed (compatibility notes since 1.0.1)#
Minimum Python is now 3.10 (was 3.9); tested on 3.10, 3.11 and 3.13.
NumPy floor raised to ≥ 2.0, matching the
numpy.trapezoidcalls the core already made.pyirena[mcp]pinsmcp<2— pyIrena has not been migrated to the mcp 2.x API.The Simple Fits model formerly misspelled “Treubner-Strey” is now “Teubner-Strey”; old result files still load.
[1.1.0b12] - 2026-09-04#
Added#
Added a stable, Qt-independent scattering I/O boundary for companion tools:
ScatteringLocation,ScatteringRecord,discover_scattering(), andload_scattering(). Discovery includes all NXcanSAS entries, slit-smeared variants, conventional simple-HDF5 Q/I groups, and read-only text imports.Exposed
create_h5xp()andwrite_iq_data()throughpyirena.iofor supported Igor data export without importing an implementation module.Added the minimal
pyirena[qtplot]extra containing only PySide6 and PyQtGraph for plotting companion applications such as Bernardyn.
Fixed#
Copied HDF5 dataset attributes before closing their source file, so units and metadata returned from
readGenericNXcanSAS()remain usable by callers.
[1.1.0b11] - 2026-09-04#
Changed#
The four gradient-based fitting tools now use analytic Jacobians. Unified Fit, WAXS Peak Fit, Simple Fits and Modeling hand
scipy.optimize.least_squares/curve_fita closed-form Jacobian instead of letting it approximate one by finite differences. The finite-difference path spentN_params + 1model evaluations per iteration purely probing gradients; on a two-level Unified fit that is 418 of 478 model evaluations (87 %), which the analytic path removes outright — 60 evaluations for the same χ² = 3.80967e4. Wall-clock gain is smaller than the evaluation-count gain, because scipy’s own trust-region linear algebra is unchanged: measured 1.7–2.1× on Unified Fit, 1.4–2.2× on Modeling with unified-level or diffraction-peak populations, 1.0–2.0× on Simple Fits depending on model, and ~1.8× on large many-peak WAXS Peak Fit (see the tolerance note below).Each tool keeps the analytic path on by default and falls back to finite differences automatically — both for sub-models where a closed form is impractical (LogNormal WAXS peaks; the size-distribution shape parameters in Modeling, whose radius grid comes from a numerical CDF inversion) and for any unexpected failure, so a fit can never fail because of the Jacobian. Modeling is a hybrid: closed-form columns for unified-level, diffraction-peak and background parameters, finite differences for the rest, assembled into one matrix. The toggle is an implementation detail and is not serialised. Size Distribution is unaffected — it solves a regularised linear inverse problem and already uses exact gradients.
Every derivative is verified against high-accuracy central differences, and the full
validationData/suite refits identically: 195/195 checks still PASS with no status change. Two caveats on “results are unchanged”: Debye-Bueche’sPrefactorandEtashift by a few percent because only their productPrefactor·Eta²is determined by the data (that product is conserved to 7 significant figures, andCorrLengthis unchanged); and a Modeling fit containing a size-distribution population can land in a different local minimum, because an exact gradient traverses a multimodal landscape by a different route — neither path is reliably better.An exact gradient also fixes fits that finite differences could not do at all. A Debye polymer chain fitted over a USAXS range (q from 1e-4 Å⁻¹) previously stalled at its starting Rg — the forward model’s small-
q²Rg²cancellation noise swamps scipy’s defaultsqrt(eps)difference step, so the gradient was pure noise. It now converges: Rg = 10.05 against a true 10.0, reduced χ² = 1.01 instead of 205.WAXS Peak Fit convergence tolerances stay at 1e-5 — a deliberate decision. The analytic-Jacobian work initially tightened
ftol/xtol/gtolto 1e-8 on the grounds that exact gradients had made iterations cheap. That is reverted. WAXS data with real counting statistics does not support convergence criteria far below its own uncertainties — 1e-8 is well past the point where the fit is describing noise rather than structure — and Igor Irena has always fitted these peaks with comparably loose settings without trouble. Keeping 1e-5 is the scientifically honest setting, not a performance compromise.Tightening also turned out to be actively unsafe at scale, because tolerance and iteration budget are coupled and only one was changed. With
maxfev = 10_000unchanged, a large many-peak fit at 1e-8 exhausts its evaluation budget before meeting the criterion;curve_fitthen raises and the handler returns the user’s starting parameters withsuccess = False. Measured on 15 Gaussians / 4000 points / 47 free parameters: 1e-5 converges in 27 s, while 1e-8 spent 268 s and then failed outright. The comment infit()records this so the tolerances are not tightened again without also raisingmaxfev.With tolerances equal on both paths, the analytic Jacobian’s benefit in WAXS is a clean speed-up on the same answer: the 15-peak fit above takes 28.7 s against 52.7 s on finite differences, and a 20-Gaussian / 8000-point fit takes 23.4 s against 61.2 s — both converging to the same reduced χ² as the finite-difference path (459.55 on the 20-peak fit, matching to five significant figures).
Fixed#
ruff check pyirenafailed CI. Five lint errors had accumulated in the GUI layer as fallout from the b10 theme work: four unsorted import blocks (data_selector/panel.py,modeling_panel.py,saxs_morph_panel.py,unified_fit.py, all frompyirena.gui.themeimports being appended rather than merged in order) and one unused import (READONLY_FIELD_CSSinsimple_fits_panel.py). All are import-ordering only, with no change in behaviour. Verified clean under both ruff 0.15 and 0.16 — the workflow installs ruff unpinned, so it picks up whatever is current.
[1.1.0b10] - 2026-09-04#
Usability and correctness release, driven by what users hit in practice.
The largest fix is that pyIrena was unreadable for anyone whose operating system is set to a dark colour scheme: it now ships its own theme instead of inheriting the desktop’s. The fit Q range can be typed again, as in Irena, with one identical control in Simple Fits, Modeling and Unified Fit. Two parameter controls that invited meaningless fits — Modeling’s Contrast and Scale both fittable, Simple Fits’ bounds on a Contrast the Invariant never fits — are gone.
Underneath, CI now runs the test suite on macOS (arm64) and Windows as well as
Linux, which immediately turned up four platform-specific defects (three in the
tests, one real and shipping), and a new validationData/ set of 27 synthetic
datasets with exactly known parameters lets pyIrena’s mathematics be checked
independently — and compared, quantity by quantity, against Igor Pro Irena.
Added#
pyirena/gui/theme.py— pyIrena now ships its own light theme.apply_theme(app)installs the Fusion style, an explicitQPaletteand a baseline stylesheet on theQApplication, so every panel renders the same on every platform whatever the desktop’s light/dark setting (see Fixed below for what this cures). It also exports the semantic colour tokens and theaccent_button_css/chip_button_css/soft_button_css/readonly_field_css/status_csshelpers panels should use instead of hardcoding hex values — every helper emits a background and a text colour.PYIRENA_NATIVE_THEME=1falls back to the platform style.pyirena/gui/q_range_ui.py— one editable “Q range for fit” control, shared by every tool.QRangeFieldsrestores Irena’s behaviour of typing the fit limits as well as dragging the graph cursors, and is now embedded in Simple Fits, Modeling and Unified Fit so the three cannot drift apart. Typed values are validated (positive, distinct), swapped when entered the wrong way round, clamped to the loaded data’s Q range, and then pushed to the cursors, which remain the single source of truth.pyirena/tests/test_gui_theme_contract.py,test_gui_q_range_fields.pyandtest_gui_fit_flag_rules.py— regression tests for all of the above. The theme contract fails the build if any new inline stylesheet sets a background without a text colour.validationData/— synthetic data with exactly known parameters, for validating pyIrena and for comparing it with Igor Pro Irena. 27 datasets covering Size Distribution, Unified Fit (including slit smearing), Modeling (size distributions, Unified levels, diffraction peaks, hard-sphere structure factor, mass and surface fractals, Guinier-Porod), Simple Fits, WAXS Peak Fit, Data Merge and Data Manipulation. Each is written as a 3-column ASCII file with the ground truth in its header, a noise-free_ideal.datcompanion, and an NXcanSAS HDF5 file carrying the exact curve and a JSON of the generating parameters underentry/ground_truth/.The intensities are computed by
validationData/_models.py, which implements every model from the published literature and does not import pyIrena, so recovering the parameters tests pyIrena’s mathematics rather than its self-consistency.generate_validation_data.pyregenerates the files deterministically (per-dataset seed derived from the dataset name) and writes theREADME.mdmanifest andground_truth.json.run_validation_report.pyfits every file and writesVALIDATION_RESULTS.md/.csv, with empty Irena columns for a side-by-side comparison against the Igor package.pyirena/tests/test_validation_data.py— asserts that pyIrena’s forward models agree with the independent implementations to machine precision, that every generated file loads, and that a fast subset of the datasets recovers its generating parameters.pyirena/tests/test_modeling_structure_factor.py— regression tests for the structure-factor fitting bug below.Igor Pro Irena results are now part of the validation report.
validationData/irena_values.csvholds the values obtained with the Igor package, keyed by dataset and quantity, andrun_validation_report.pyreads it to fill theIrenaandIrena dev %columns, compute the agreement statistics, and append the commentary inirena_notes.md. Because those numbers are data in the repository rather than text inside a document, regenerating the report never loses them. Over the 98 quantities both packages currently report, the median deviation from the known truth is 0.19 % for pyIrena and 0.31 % for Irena, and the median difference between the two packages is 0.04 %.validationData/fill_irena_deviations.py --export-csvwrites a hand-edited table’s Irena column back intoirena_values.csv.validationData/md_to_docx.pyrenders a results table as a landscape Word document (real tables, built-in heading styles) for a manuscript draft.
Fixed#
Controls were unreadable when the operating system was set to a dark colour scheme. Reported from a beamline user’s machine: the Modeling panel’s “Fit B/P btwn cursors” and “Fit Flat btwn cursors” buttons appeared as blank whitish boxes the user never realised were buttons, and the Population type / Distribution pull-downs could not be read. The cause was structural rather than local — several hundred inline stylesheets set a
background-colorwritten for a light scheme without naming a text colour, so Qt took the text colour from the system palette and painted near-white on near-white; controls with no inline style at all were left entirely to the platform’s dark rendering. Rather than chase every OS × theme combination, pyIrena now applies its own palette at startup (pyirena.gui.theme.apply_theme, wired into all eight GUI entry points), which also matches the plots — they are drawn on a hard white background throughout. The stylesheets that set a background with no text colour have been converted to theme helpers, and a test now blocks new ones.Modeling → size-distribution populations let Contrast and Scale be fitted at the same time. The two enter the model only as their product, so freeing both leaves the least-squares problem with a flat direction: the solver wanders and the covariance matrix is singular, making the reported uncertainties meaningless. Checking either “Fit” box now clears the other (last one ticked wins); holding both fixed is still allowed, and a setup loaded with both flags set is normalised to fitting Scale.
Simple Fits → Invariant showed lo/hi limit fields for Contrast. The Invariant is a direct calculation with no least-squares step, so its Contrast is never fitted and the bounds did nothing but prompt users to ask what they were for. Bound fields (and the lo/hi column headers) now follow the “Fit?” box: they are shown only for parameters that can actually be fitted, so the background
B,Pand flat terms keep theirs.pyirena-mcpgave the wrong advice when mcp 2.x was installed. The import guard inpyirena/mcp/server.pycaught everyImportErrorand answered with “install with: pip install pyirena[mcp]”. mcp 2.0 replacedmcp.server.fastmcpwith a stub that raisesModuleNotFoundError— anImportErrorsubclass — so users who already had mcp installed, just the wrong major version, were told to install a package they already had, and the SDK’s own migration hint was swallowed. The guard now reports the installed mcp version and the actual fix (pip install 'mcp>=1.0.0,<2.0', or upgrade pyirena, which has pinnedmcp<2since 1.1.0b7). Reached only by installs that predate that pin or that upgrademcpby hand — the extra itself is unchanged.Modeling: structure-factor parameters were never actually fitted. The hard-sphere radius and volume fraction (and the Interferences
eta/pack) were packed into the fit vector under the key group'sf', which the surface fractal population already used for its own attributes._unpack_paramsmatched the surface-fractal branch first, so each optimiser step wrote those values onto the population as stray attributes instead of intopop.sf_params. The model never saw them change: they contributed nothing to chi-squared andfit()returned them at exactly their starting values, with no warning. Structure-factor parameters now use their own key group'sfp'. Found while buildingvalidationData/; on the hard-sphere validation dataset the fit went from reduced chi-squared 397 (all four structure-factor and distribution parameters wrong by 8-40 %) to 1.15 with every parameter within 0.2 % of truth.A UTF-8 BOM silently dropped the first data point of a text file. This is not Windows-specific — it affected every platform.
readTextFileopened the file with the platform default encoding, so a byte-order mark from a Windows editor arrived as a\ufeffglued onto the first Q value. That failed thefloat()probe used to find where the header ends, so the line was classified as another header row and skipped: a four-point file loaded as three points, with no warning. The file is now read asutf-8-sig, which consumes the BOM.Text data files whose header was not UTF-8 failed to load on Windows. Same root cause from the other direction: an older instrument header carrying a cp1252/ISO-8859-1
Åor degree sign is not valid UTF-8, and the platform default on Windows is cp1252, so the same file loaded on Linux and raisedUnicodeDecodeErroron Windows.readTextFilenow tries UTF-8 and falls back to latin-1, which cannot fail — only header text is affected either way, since the numeric columns are ASCII in all of these encodings. The fix had to cover two reads, not one:np.loadtxtdefaults toencoding=None, meaning the platform default, so it would have raised on the second pass over a file the first pass had just recovered. Both now work from a single decoded read.Dropped files arrived with the wrong path separators on Windows.
paths_from_mimereturned whatever Qt handed it, andQUrl.toLocalFile()givesC:/Users/...with forward slashes. The plain-text branch was worse: it stripped seven characters offfile://unconditionally, turning Explorer’sfile:///C:/Users/xinto/C:/Users/x, which is not a path at all. A dropped file therefore compared unequal to the same file found by a folder scan. Real file URLs now go throughurllib.request.url2pathname(which knows/C:/xmeansC:\x, and un-escapes%20), the malformedfile://C:\xspelling that some applications send is taken literally, and every result is normalised to native separators.export_fit_resultscrashed on Windows. It writesÅandcm⁻¹into a plain text file without specifying an encoding, so it raisedUnicodeEncodeErrorunder cp1252. It has no test, which is why CI did not flag it; found by inspection while fixing the above.
Changed#
Tests run on three operating systems.
testbecame a deliberately sparse matrix rather than the full cartesian product: Linux sweeps Python 3.10/3.11/3.13, and macOS-arm64 and Windows each get 3.12. Version bugs need the Python sweep; platform bugs need the platform, and the extra six combinations of a full matrix buy almost nothing.test-guiruns on all three underQT_QPA_PLATFORM=offscreen, with theapt-getstep gated to Linux. Both jobs carry a 45-minute timeout.Three test-only Windows failures fixed. Six
Path.read_text()calls reading UTF-8 content — a source file, and.itxexports containingcm⁻¹— decoded as cp1252 and raised; the ITX writer was already correct. Four more intest_report_buttonswere oneχ²away from the same failure and got the same treatment. Separately,test_run_fit_walks_to_distant_optimum_by_defaultcalledadd_unified_level()on top of the levelselect_model()already creates, leaving a second, entirely default level free in the fit — a duplicate power law the data cannot distinguish from the first, whose G and B drift onto their1e-10/1e-20lower bounds. Whether they land on a bound or just above it is numerical noise that differs by platform, which is why only Windows reported them as pinned. The spurious level is gone and the one-level assumption is now asserted rather than assumed.
[1.1.0b9] - 2026-08-21#
Performance release: Modeling fits run about three times faster with unchanged results. Also fixes a class of silently wrong Modeling fit, in which a population that could not be evaluated was dropped from the model without failing the fit.
Fixed#
Modeling: a population that could not be evaluated was silently dropped, and the fit reported success without it.
total_intensitycaught every per-population exception, issued aRuntimeWarning, and left that population out of the sum. During a fit that happens identically at every trial, so the optimiser converged happily on the remaining terms and returned a result whose reduced chi-squared belonged to a different model than the one asked for — observed for real at reduced chi-squared 62 where the intact model gives 0.51. Fitting is now strict:fit()evaluates the model once at the starting parameters and raisesPopulationEvaluationErrorif it cannot, and a population that fails only at some trial point makes that trial maximally bad (so the optimiser walks away from it) and is counted in the fit warnings instead of vanishing. Display paths are unchanged — they still warn and skip, so a half-typed parameter cannot take a GUI panel down.Modeling: the core-shell G matrix lost precision in the Guinier regime. Introduced by the vectorisation below and caught before release. Factoring the r³ out of Δρ·V(r)·f_sph(qr) leaves
sin(x) − x·cos(x), which cancels catastrophically as x → 0: ~5 significant digits by qr = 1e-5 and 32 % error by qr = 1e-7, a regime small particles at USAXS Q genuinely reach. The vectorised builders now switch to the exact Taylor expansion below the same qr = 1e-3 threshold_sphere_amplitudeuses, restoring full precision (the branch is skipped entirely, at no cost, when no element is small).MCP: every image tool failed to return its picture.
pyirena_plot_iq,pyirena_plot_parameter_trendand all eightpyirena_ctrl_*_imagetools rendered and saved their PNG, then died on the way back to the client withUnable to serialize unknown type: ... fastmcp.utilities.types.Image. Cause: FastMCP ≥ 1.10 derives a structured output JSON schema from a tool’s return annotation and serialises the return value against it, and theImageobject is not JSON-serialisable — so the annotation-> list[Any]silently opted every image tool into a code path that could never succeed. Images belong in the unstructured content array; image tools are now registered through_image_tool(), which disables structured output (and falls back to the plain decorator on mcp < 1.10, where the feature does not exist). Claude Desktop / claude.ai reported this as “the plot tool has a serialization bug but it did save the PNG to disk”.
Added#
MCP: image tools now report the PNG’s path as well as the image. Each returns a text block (
"<label>\nPNG saved to: /abs/path.png") followed by the inlineimage/pngcontent block. Previously the control-API image tools returned base64 only, so a client that does not render inline images — AnythingLLM in some modes, plain agent loops — had no way to reach the plot and told users no file existed. The control API dicts gained a matchingimage_pathkey alongsideimage_base64.PYIRENA_PLOT_CACHEnow also directs control-API fit images. It previously only affectedplot_iq/plot_parameter_trend; fit images were hardwired to<tempdir>/pyirena-ctrl(still the default). Point it at a browsable folder when the user will want to open the PNGs themselves.
Changed#
Modeling fits are ~3x faster, with identical results. A user-supplied core-shell model (1406 Q-points, 199 radius bins, 10 free parameters) went from 50 s to 16 s for a global fit and 39 s to 12 s for 50 Monte-Carlo passes, on the same 18-core machine. Every fitted parameter and every MC uncertainty is unchanged; the full test suite is unchanged. Four independent causes, all in the per-iteration hot path:
schulz_zimm_cdfandgauss_cdfcalledscipy.stats.gamma.cdf/norm.cdf, whoserv_continuouswrapper costs ~14 µs per scalar call.generate_radius_gridmakes a few hundred of those per fit iteration while walking the CDF out to the distribution tails. They now callscipy.special.gammainc/ndtr— the functions scipy itself dispatches to — for bit-identical results at ~1/33 the cost.total_intensityrebuilt each population’s radius grid a second time aftercalculate_pop_intensityhad already built it. The grid is now returned by the same call, and memoised on the distribution parameters that define it, so a Jacobian step that leaves them alone reuses it.The core-shell sphere G matrix (all three of
cs_sphere_by_core,_by_shelland_by_total) was assembled with a Python loop over radius bins. It is now one vectorised expression; where the shell thickness is constant across bins, half the sin/cos work is recovered by angle addition.Each population’s I(Q) is memoised during a fit on the full set of parameters it depends on, so a step in the background or in another population skips it entirely.
The remaining two per-bin loops are vectorised too, on the same identity, through a shared
_shell_step_amplitudehelper: the core-shell-shell sphere over both axes at once, and the core-shell spheroid over its 50 Gauss-Legendre orientations rather than its (typically 200+) radius bins, so each iteration is one full Q x bin evaluation and there are far fewer of them. Both are ~1.8x faster and agree with the loops they replace to 4e-14 relative-to-peak. This is what a slow core-shell-shell or core-shell-spheroid fit was waiting on; the spheroid is still much the most expensive form factor because of the orientational average.The fit-time G-matrix cache now keys on the Q grid as well. It keyed only on the radius grid and form-factor parameters, which is why
total_intensity_idealhad to avoid it: with slit smearing on, a fit evaluates the model on both the data grid and the smearer’s extended grid. Mismatched lengths raised; two same-length grids would have silently reused the wrong matrix.Documented where parallel fitting stops paying off (
docs/modeling_gui.md). Both the global-fit and MC-uncertaintycoressettings flatten out around 8–10 workers — model evaluation is bound by memory bandwidth over the G matrix, not by CPU — so values above ~10 cost resources without saving time.PNG rendering for the control API lives in one place,
pyirena/api/control/_images.py(render_png,image_cache_dir), replacing five near-identical private copies inunified_fit.py,sizes.py,simple_fits.py,modeling.pyandwaxs_peakfit.py.
[1.1.0b8] - 2026-08-13#
Fixed#
Unified Fit: “press Fit repeatedly” caused by the moving limits window. The panel keeps each parameter’s fit limits centred on its current value (B: value×0.2 … ×5; see
fix_limits). When the optimum lies far outside that window — changing P by ~1 moves the matching B by orders of magnitude in the USAXS range — a single bounded fit converged correctly within its box but ended with B pinned at a limit, and each further Fit press only moved B another factor of 5 (this was never a tolerance, restart-loop, or step-size problem). The Fit button now usesUnifiedFitModel.fit_with_limit_walking(): while a fitted parameter ends pinned at a panel auto-limit, the limits are recentred on the fitted values and the fit rerun (up to 4 walks), so one press reaches the interior optimum. The auto-limits policy itself now lives once, inpanel_auto_limits()(core), used by both the panel and the walker. Batch fits with explicit config limits are unchanged — those limits are treated as deliberate constraints. The agent-controlrun_fituses the same walking by default (walk_limits=True, opt out with False) and now returnspinned_parametersandwarningsso a bound-stopped fit is visible instead of silently wrong.Modeling & Unified Fit: micro-stepping local fits (
diff_step=1e-3).least_squaresnow uses a finite-difference Jacobian step of 0.1 % of each parameter’s value — the scipy analogue of Igor’s per-parameter epsilon, which Igor Irena needed for the same reason. With scipy’s default step (√eps ≈ 1.5e-8 relative), the locally exact Jacobian made TRF advance in micro-steps on stiff, strongly correlated surfaces (a mean size of 5×10⁴ fitted alongside peak widths of 4×10⁻³; B and P in the USAXS power-law region), exhausting the ~2400-evaluation budget every round without meeting any tolerance. With the 0.1 % secant step the same fits converge in ~30–90 evaluations to an equal or better χ² (measured 20–35× fewer evaluations on two user datasets; a pathological 10-minute fit now finishes in ~10 s). The Unified Fit restart loop also gets the relative (1e-4·χ²) stop threshold described below.Modeling: runaway 10-minute fits on misspecified models. When a model structurally could not reach the data (e.g. a strong low-Q upturn with
scalepinned at its limit), every local-fit round exhausted its evaluation budget in a nearly flat χ² valley and the internal restart loop ran all five rounds — χ² improvements of a few counts on χ² ~ 10⁶ passed the old1e-8·χ²restart test. The threshold is now1e-4·χ²(relative), which stops such fits after two rounds while leaving genuine “press Fit again” improvements (orders of magnitude larger) unaffected. Reproduced withtestData/bad1.h5.
Added#
Modeling: post-fit diagnostics on
ModelingResult.fit_warnings, shown in the GUI status line, logged bybatch.fit_modeling, and returned aswarningsby the agent-controlmodeling_run_fit. Warns when a fitted parameter ends pinned at a fit limit, when the fit stopped at its evaluation budget without converging, when a lognormalsdeviationexceeds 3 (unphysically broad — usually mimicking a power law), and when reduced χ² is above 10³ (model cannot reach the data).
[1.1.0b7] - 2026-08-10#
A consolidation release, implementing the feature-parity review in issue #13.
The theme is that behaviour a user thinks of as belonging to “a table”, “a
graph” or “a file browser” is now implemented once and available everywhere,
rather than per panel: tables copy and sort, graphs export the same five ways,
browsers accept dropped files, windows reopen where you left them, and all five
fitting tools write Markdown reports and can be driven by an agent. Nine
duplicated implementations were removed along the way, three of which had
already drifted apart. See PLAN.md for the full disposition, including what
was deliberately not done.
Added#
File browsers share their remaining logic (feature parity review item U4, issue #13 — scoped down deliberately, see below).
The Data Selector was the last browser keeping its own extension lists and its own
os.listdirloop; it now usescore.file_types, so all four browsers answer the awkward questions the same way (skip sub-directories, match case-insensitively, treat an unreadable folder as empty rather than raising — the Data Selector used to show an error message instead). Newfiles_with_extensions()serves a browser whose dropdown is notFILE_TYPES;files_in_folder()now delegates to it, so there is one listing implementation.The post-drop “switch folder, select what was dropped” step, written three times during the drag-and-drop work, is now
select_dropped_in_list().test_gui_browser_contract.pygrew four checks: every browser accepts drops, none walks a folder by hand, none hard-codes extensions, and the list browsers share the drop-selection step.A shared
FileBrowserWidgetwas considered and deliberately not built. After U1–U3 and the drag-and-drop work, what remains duplicated across the four browsers is widget assembly with no logic in it — and they differ in ways a common widget would have to be configured around regardless: the Data Explorer is a tree with lazy sub-folder expansion, Data Merge shows two linked instances, Data Manipulation adds a context menu, and the Data Selector alone offers text files and the convert-on-load path. The reason is recorded indocs/developer_adding_features.mdso the question does not get re-opened from scratch.
Core model objects serialise themselves —
to_dict/from_dict(feature parity review item U6, issue #13). Added to Unified Fit, Modeling and WAXS Peak Fit, joining Sizes and Simple Fits; the callers that used to build those dicts by hand now go through the model.Unified Fit.
UnifiedLevel/UnifiedFitModelgained the pair, plusUnifiedLevel.from_panel_params()— the one place that translates the panel’s historical vocabulary (RgCutoff→RgCO,correlated→correlations,estimate_B→link_B,Rg_low/Rg_high→Rg_limits), which is baked into saved setups and batch configs and so cannot be renamed. It replaced eight hand-written conversions: six in the panel (graph, both fit branches, undo, both Monte-Carlo branches) and two inbatch/unified.py. The flagswith_limits/with_links/with_fit_flagskeep each call site’s exact behaviour — notably the graph and undo paths, which must not enablelink_B, since that recomputes B from G, Rg and P and would change the drawn curve.Modeling. A
_SerialisableDataclassmixin walksdataclasses.fields(), so all six population types share one implementation and a new parameter is serialised the moment it is declared.population_from_dict()dispatches through aPOPULATION_CLASSESregistry; an unrecognisedpop_type(a file from a newer pyIrena) loads as a size distribution with a warning instead of raising. This removed three near-identical six-branch deserialisers — inbatch/modeling.py, ingui/modeling_panel.py, and a fourth that was already dead — and the panel’s hand-written serialiser, which was verified field-by-field to produce exactly the same dict for all six types before being deleted.WAXS Peak Fit.
WAXSPeakFitModel.to_dict/from_dictcover background shape, background parameters and peaks; an unknown background shape falls back with a warning, andto_dictdeep-copies so a caller cannot edit the live peak list by accident.Two historical quirks were preserved on purpose rather than tidied away: a size-distribution population whose config or state omits
enabledstill loads disabled (batch and GUI both did this; every other population type defaults to enabled), and the panel’s size-dist restore still falls back to the log-normal defaults for a missingdist_params.
SAXS Morph result files now carry the panel setup (feature parity review item U10, issue #13).
save_saxs_morph_results(..., setup_state=...)embeds the_pyirena_configattribute the other five fitting tools already wrote, the panel gained a Load Setup from File… button, and batch runs embed their config section too — so a batch-produced result opens in the GUI with every control set. The physics scalars were already stored; what was missing was the input mode, the cursor Q range and the background pre-fit windows.The per-tool policy is now written down in
docs/HDF5_NxcanSAS_structure.md: six tools embed the setup, Data Merge and Data Manipulation record NXprocess provenance instead (they run inside reduction pipelines driven by their own JSON, where a GUI session never existed), and Fractals stores every growth parameter as explicit datasets thatload_fractal_aggregate()rebuilds. A test fails the build if a tool is missing from that table.
One Qt import point at last (feature parity review item U7, issue #13). The invariant said every Qt import goes through
pyirena/gui/_qt.py; in practice there were three shims —gui/_qt.py,gui/data_selector/_qt.pyand an inline one inslit_smearing_ui.py— plus 22 localtry: PySide6 / except: PyQt6blocks scattered through ten modules.gui/data_selector/_qt.pyis removed and its five importers now usepyirena.gui._qt; every local block is gone;QMimeDatawas the only name the shim was missing.Three of those blocks had a stale
PyQt5third branch (unified_fit,modeling_panel,ai_advisor), which on a PyQt6-only install would have raisedModuleNotFoundErrorfrom inside a paint or a message box rather than falling back.pyirena/tests/test_gui_qt_contract.pykeeps it fixed: it fails the build on a direct binding import anywhere in the package (tests included), on a second_qt.pyin a subpackage, on a name imported from the shim that it does not define, and on a name defined there but absent from__all__. It reads the source, so it runs on a machine with no Qt installed.No behaviour change intended; the one visible edit is that Unified Fit’s cursor paint code now uses the shared
Qtenum instead of a local alias that shadowed it asQtCore.
Drag a file onto pyIrena to open it (feature parity review item A6, issue #13). New
pyirena/gui/file_drop.py; wired into the Data Selector, every fitting panel (through the sharedDataFileLoaderRow, so Unified Fit, Sizes, Simple Fits, Modeling, WAXS and SAXS Morph all gained it at once), the Data Explorer file tree, and the Data Merge and Data Manipulation file lists.Dropping a folder offers the data files inside it, one level deep — a measurement directory can be dragged in whole.
The drag is refused while it is still over the window if nothing in it is openable, so the cursor answers before the user lets go. Files pyIrena cannot read are dropped from the list rather than failing later.
Both drop payloads are read: Finder/Explorer send file URLs, some applications send plain text paths.
Text files still go through the clean-and-convert path, so a dropped
.datbehaves exactly like one opened from the dialog.Installed through an event filter, so no existing widget had to be subclassed;
collect_dropped_paths()is pure and covered by 23 tests.
Windows reopen where you left them (feature parity review item A9, issue #13). New
pyirena/gui/window_state.pysaves size, position and splitter sizes for every pyIrena window — so the width you gave the left control panel survives a restart, not just the window frame.The failure mode this is really about is a changed display setup. A position saved on a monitor that is no longer attached would reopen the window somewhere it can be neither seen nor dragged back. Saved geometry is checked against the screens that exist now: a window that would be unreachable is moved onto the nearest real screen and shrunk only if it no longer fits, and if it cannot be placed sensibly the tool falls back to its default size. The whole policy is the pure function
resolve_geometry(), tested against removed monitors, negative screen origins, larger-than-screen windows and a grid of off-screen positions.Per-tool reset, the Irena gesture: hold Shift while clicking a tool’s button and that tool forgets its position and opens centred at its default size, control-panel width included. Because panels are built once and reused,
install_window_state()records each window’s coded default before applying anything saved, so the gesture works on the tenth launch as well as the first; a panel’s separate graph window is reset with it.pyirena/tests/test_window_state.pyreads the launcher source and fails the build if a new tool is wired up without it.Pane widths are recorded and applied at the first layout, not in the constructor: a panel sets its splitter while that splitter still has no width, so anything read or written before Qt’s first layout pass is a placeholder. They are stored as fractions, since a reset re-centres the window at a different size than the splitter currently has.
Geometry is only ever applied to real windows (
is_top_level). Unified Fit’s and WAXS’s…GraphWindowclasses are the right-hand pane of their panel, and setting a pane’s geometry fought the layout — which surfaced as the control panel coming back much too wide after a reset. Both are no longer registered, and the guard makes the same mistake harmless in future.Global escape hatch: hold Shift while launching
pyirena-gui, or setPYIRENA_RESET_WINDOWS=1, to discard every saved geometry and open all windows at their defaults.Minimised and full-screen windows are not saved.
Geometry is stored in its own
window_geometry.jsonnext to the pyIrena state file, deliberately: each panel holds its ownStateManagerandsave()rewrites the whole file from that copy, so geometry kept there was clobbered by whichever panel closed last.GEOMETRY_PERSISTENCE_ENABLED = Falseinwindow_state.pydisables the feature outright, and the placement tunables (minimum visible area, title-bar grab height, edge margin) are named constants at the top of the module for fine-tuning.
WAXS Peak Fit is now agent-drivable — U9 is complete (feature parity review item U9, issue #13).
pyirena/api/control/waxs_peakfit.pyadds 18 tools: background choice (adaptive SNIP and friends, or fitted polynomials), peak finding, add/remove/list peaks, per-peak shape and parameters with fit flags and bounds, the fit with its three weighting modes, results, an image and save to NXcanSAS — exposed over MCP aspyirena_ctrl_waxs_*.find_waxs_peaksis the entry point: it runs pyIrena’s peak detector over the fit Q range and creates peaks with position, amplitude and width already close, so an agent starts from the data rather than from guesses.prominence_fractrades spurious detections against missed shoulders.Every peak reports its integrated area (derived from the fitted shape, with a propagated uncertainty) — usually the quantity a WAXS question is actually about.
The fit image draws each peak separately over the background, which is how a peak that has drifted onto its neighbour becomes visible.
The MCP surface grows from 101 to 119 tools. All five fitting tools — Unified Fit, Sizes, Simple Fits, Modeling and WAXS Peak Fit — now have a control surface.
Modeling is now agent-drivable (feature parity review item U9, issue #13).
pyirena/api/control/modeling.pyadds 18 tools — population management (add, remove, enable, list), per-parameter value/fit/bounds, the non-numeric options (distribution, form factor, structure factor, peak type, correlations), the background, the Q range, the fit, results, a per-population fit image and save to NXcanSAS — exposed over MCP aspyirena_ctrl_modeling_*.One flat parameter namespace. A population’s parameters live in plain attributes and in three nested dicts; the surface flattens them to dotted names (
dist.mean_size,ff.sld_core,sf.eta,scale) and lists only the ones active for the current distribution, form factor and structure factor — the same set the fitter packs. Switching to a core-shell form factor adds its SLD and thickness parameters with sensible defaults and removescontrast, whose role the SLDs take over.The fit image draws each population separately alongside the total, so a population that has collapsed to nothing is visible at a glance.
The MCP surface grows from 83 to 101 tools.
Only WAXS Peak Fit remains without a control surface.
Simple Fits is now agent-drivable (feature parity review item U9, issue #13). Interactive control sessions existed for Unified Fit and Size Distribution only, so an AI agent could read Simple Fits results but never produce them.
pyirena/api/control/simple_fits.pyadds 15 tools — model listing and selection, per-parameter value/bounds/fix/free, the complex background, the fit, results, a fit image, a linearization image, and save to NXcanSAS — exposed over MCP aspyirena_ctrl_simple_*. The session and Q-range tools are shared with the existing surfaces, so a conversation can open a dataset once and try Unified Fit, Sizes and Simple Fits on it. Modeling and WAXS Peak Fit remain to be wired.The linearization tool returns the slope, intercept and R² alongside the image, which gives an agent a numeric handle on “is this model valid over this Q range?” rather than only a picture.
The MCP surface grows from 68 to 83 tools; the schema/callable/MCP parity tests and their locked counts are updated with it.
Data Merge gained the full sort dropdown the other three file browsers have (feature parity review item U3, issue #13). It sorted silently by order number with no way to reorder a temperature or time series. Both dataset columns now offer all ten modes — filename, temperature, time, order number, pressure, each ascending and descending — defaulting to order number ↑ so the view opens exactly as before, and each column remembers its own choice between sessions (
data_mergestate schema 2).“Copy results” and “Save report…” on the fit panels (feature parity review item A5, issue #13). Igor Irena wrote every fit to the notebook; in pyIrena a fit panel’s only exits were save-to-HDF5 (then tabulate in the Data Selector) or reading numbers off the widgets one at a time — while the api/control layer had
export_fit_reportfor AI agents and not for people. Unified Fit, Size Distribution, Simple Fits, Modeling and WAXS Peak Fit now each have two buttons that put the current results on the clipboard, or into a.mdfile, as Markdown: parameters with their Monte-Carlo uncertainties, fit quality (including the robust metrics), the data summary and the setup. WAXS reports the peak rows on screen, so it works before a fit as well as after one.Ctrl-click (⌘-click on macOS) “Save report…” saves the report and the graph: a PNG of the panel’s plots is written next to the
.mdwith the same name and embedded in it as a figure, replacing the save-report, save-graph, find-both, insert-the-image sequence. The link is relative, so moving the pair together keeps the figure working, and the result renders in GitHub, VS Code, Jupyter, Obsidian and pandoc —pandoc report.md -o report.docxyields a Word document with the graph in place. The figure is the plots alone (the graphics layout is captured, not the window), so no tab bar or status line appears in it. A plain click still writes text only, and a graph that cannot be captured costs the figure, not the report.pyirena.core.modeling.result_to_report_dict()flattens a liveModelingResultinto the saved-results dict shape, so the Modeling panel can report the fit it is holding without a save-and-reload round-trip. Populations are flattened withdataclasses.asdict, so a new population type or parameter reaches the report with no change to the converter.The text comes from one builder shared by every consumer (
pyirena/core/reporting.py), so a value cannot be formatted one way in the panel and another way in the report: the panel buttons, the Data Selector’s Create Report, and the MCPexport_fit_reportall render the same sections from the same dict shape (load_<tool>_results(), which is also whatpyirena.api.resultsreturns).Copy any graph to the clipboard, and save it as PNG, SVG or CSV (feature parity review items U2 / A3 / A4 / A8, issue #13). Every plot’s right-click menu now offers the same five actions, from one shared implementation in
pyirena/gui/plot_export.py:Copy graph to clipboard — the graph as an image, ready to paste into PowerPoint, Word, email or an electronic notebook. This is Igor’s Edit→Copy, which had no equivalent anywhere in pyIrena.
Save graph as image… — PNG (now the default), JPEG or SVG, selected by the file filter or the extension typed. JPEG compression visibly smears the thin lines and small text of a log-log SAS plot; it stays available for users who need it.
Save whole window as image… — every stacked panel (data + residuals + distribution) in one image, alongside the single-plot export.
Save curve data as CSV… — the plotted curves as text for Excel, Origin, Matlab or pandas: one
X/Ycolumn pair per curve, plusdYwhere uncertainties exist, padded when curves have different lengths. Previously the only text export was Igor.itx.Curves the panel never labelled are exported too, named from the Y axis. Residual panels, the Simple Fits linearization, the Contrast (Δρ)² plot and the collected-values scatter all plot without a legend name, and every export used to refuse with “No named data curves found to export” while the curve was plainly visible.
ScatterPlotItemand barePlotCurveItemcurves are collected as well — the linearization plot is built from those and could not be exported at all. Error-bar segments are still never mistaken for data.Uncertainties now reach the export from panels that draw their own data scatter (Unified Fit including the Porod tab, Sizes, WAXS). Only
plot_iq_datarecorded them before, so a CSV or ITX from those panels silently lacked thedYcolumn although error bars were on screen. Panels record them with the newtag_curve_uncertainty().Save as Igor Pro ITX… — now available on every plot rather than most of them, and the file reproduces how the curve looks in pyIrena: scatter data imports as markers (
mode=3, marker=19), model curves as lines. Igor draws every imported wave as a line by default, so exported data points used to arrive as a zig-zag line indistinguishable from a model curve. Uncertainties import as Igor error bars rather than as an extra trace.
Export dialogs remember where you last saved, falling back to the panel’s data folder before anything has been exported, instead of defaulting to the home directory (five dialogs) or the process working directory (the HDF5 Viewer’s). Where the user last chose to save takes priority over the data folder — a panel that reset to its data folder every time looks like the memory is broken. The folder persists across restarts under a new
exportssection of the state file.pyirena/tests/test_gui_plot_contract.py— a source-level guard that fails the build if a module drives pyqtgraph’s exporters directly, adds its own JPEG/PNG menu entry, or points a save dialog atPath.home(). The plot half of the standard UX contract is now written down indocs/developer_adding_features.md.
Changed#
Panel state methods follow one naming convention (feature parity review item U5, issue #13). The same two operations had grown six names —
save_state/_save_state/load_state/_load_state/_restore_state/_get_current_state— so reading one panel taught you nothing about the next and no shared helper could call them. Every panel now exposes publicsave_state()/load_state()with private_collect_state()/_apply_state(state); embedded components driven by a parent (the Diffraction Lines tab inside WAXS) exposecollect_state()/apply_state(). Pure rename, no behaviour change.UnifiedFitPanelkeepsget_current_state()/apply_state()as public aliases because those names are documented as the_pyirena_configsetup-state shape and agent scripts call them. WAXS Peak Fit gained theload_state()it never had (it applied saved state inline in__init__).The form-factor parameter registry moved to
pyirena/core/form_factors.py(FORM_FACTOR_PARAMS,FORM_FACTOR_PARAM_DEFAULTS,CONTRAST_FREE_FORM_FACTORS) fromgui/modeling_panel.py. Which parameters a core-shell shape needs, and their defaults, sat next to the widgets that drew them, so the api/control layer — which may not importgui— could not tell an agent what to set. The GUI now reads the same registry, so a new form factor is declared once, beside its G-matrix builder.The data-file type table is shared in
pyirena/core/file_types.py(FILE_TYPES,FILE_TYPE_EXTS,files_in_folder()) instead of being copied verbatim into Data Manipulation and Data Merge along with their ownos.listdirloops. Qt-free, so a batch script enumerates a folder with the same extensions and exclusions the GUI shows. An unreadable folder or an unknown type now lists nothing rather than raising. This is the tractable part of the review’s “one file-browser widget” (U4); the widget itself needs the Data Selector’s browser extracted from its panel first and remains open.The filename sort keys are shared in
pyirena/core/file_sorting.pyinstead of existing as three verbatim copies (Data Selector, Data Explorer, Data Manipulation) plus a lone order-number copy in Data Merge. A new sort mode or a regex fix had to be applied in four places and would be missed in some — the failure mode that produced the filter incident. The module is Qt-free, so batch and api code can order input files exactly as the GUI displays them. All four dropdowns now share one label list (Data Selector’s double-spaced labels are gone) and one tooltip documenting the recognised patterns — two of the four had no tooltip at all.The Markdown report builder moved to
pyirena/core/reporting.pyfromgui/data_selector/report.py, which now re-exports it.api/andcore/may not import fromgui/, so the builder had to move for the panels and the control layer to share it; the generated text is byte-for-byte unchanged (verified against the pre-move output).gui/fmt_utils.pymoved tocore/fmt_utils.pyfor the same reason and also re-exports. The control layer’s own smaller Unified-Fit-only Markdown report is gone; its agent-specific fit-flag and bounds table is appended to the shared report instead.Eight parallel plot-export implementations collapsed into one.
sas_plot.py,data_selector/plot_utils.py,unified_fit.py(twice),waxs_peakfit_panel.py,sizes_panel.py,modeling_panel.py,contrast_panel.pyandsimple_fits_panel.pyeach had their own “add export to a plot” code, disagreeing on menu wording (“Save graph as JPEG…” vs “Save as JPEG…”), on what was captured (the plot vs the whole window), and on the default folder. They now all callattach_plot_export(). Curve collection is shared with the ITX exporter, so CSV and ITX always agree on what is on the plot.save_itx_from_plotand_itx_folder_cmdsmoved to the new module and are re-exported fromsas_plotfor existing callers.Plots that were missing exports gained them: Simple Fits had JPEG but no ITX and none on its linearization plot; Modeling and Contrast had JPEG but no ITX; the Unified Fit residual and Porod plots, the Sizes residuals plot and the Modeling residuals plot had no export menu at all. The HDF5 Viewer’s graph window keeps its specialised NXcanSAS-aware PNG/HDF5/ITX exporters and gains clipboard copy.
Clipboard copy, column sorting and CSV export on every table (feature parity review items U1 / A1 / A2 / A10, issue #13). Of the nine tables in the GUI, only two supported copying — with two different bespoke implementations — so collected values, similarity results and the isotope table were dead ends: a handful of numbers required a CSV file round-trip, and the similarity results could not be exported at all. All tables now share one implementation,
pyirena/gui/table_utils.py, modelled onfile_filter.py: one module, one behaviour, one tooltip, one test file.Ctrl+C copies the selection as tab-separated text (pastes cleanly into Excel, Igor Pro and Origin); Ctrl+Shift+C includes the column headers; right-click offers Copy / Copy with Column Headers / Copy Whole Table and, where the panel supports it, Save as CSV…. With nothing selected, copy falls back to the whole table instead of silently doing nothing. Non-contiguous ctrl-click selections copy as a compact block of just the selected rows and columns.
Click-a-header sorting on the Data Selector Tabulate Results table, the HDF5 Viewer Collect and Multi-Collect windows, and the Data Manipulation similarity results. Numeric columns sort numerically — 9 < 10 < 100, not “10” < “9” — with blanks and placeholders (”—”, “(ref)”) always last. Turning sorting on does not reorder anything by itself: rows stay in the order the panel supplied until a header is clicked, and (on Qt ≥ 6.1) a third click returns to that natural order. Sorting is deliberately not enabled on the Contrast results table (rows are grouped under section headers) or the Multi-Collect item list (its row order defines the output columns).
Save CSV… for the Data Manipulation similarity results, which previously had no export of any kind — filename, p-value, longest run, number of points and accepted/rejected at full precision.
The Contrast isotope table and the Multi-Collect item list gained copy support; a whole-table copy of the isotope table includes the isotope picked in each drop-down.
pyirena/tests/test_gui_table_contract.py— a source-level guard that fails if a new module constructs aQTableWidgetwithout callingattach_table_copy(), or hand-rolls clipboard code again. The standard UX contract it enforces is now written down indocs/developer_adding_features.md.
Fixed#
pip install pyirena[mcp]broke against the newly released mcp 2.0. The 2.x SDK removedmcp.server.fastmcp, whichpyirena/mcp/server.pyis built on, so a fresh install picked up 2.x and failed at import with a misleading “install with pyirena[mcp]” message. The extra is pinned tomcp>=1.0.0,<2.0until the server is migrated to the 2.x API.The GUI test modules errored instead of skipping without Qt. The new table, plot-export and report tests used
pytest.importorskip, which pytest ≥ 8.2 treats as a broken module when the import raises a plain ImportError — andpyirena.gui._qtraises one carrying an installation hint. The plain (no-GUI) CI job reported collection errors rather than skips; they now skip cleanly, like the older GUI tests.Descending sorts put files without the pattern first. Sorting a folder by Temperature ↓ opened with every unmatched file — logs, notes, a stray average — above the hottest measurement, because reversing the list also reversed the “no pattern” sentinel. Unmatched files now sort last in both directions, as the tooltip has always claimed, and keep their relative order among themselves. Affects all four file browsers.
An unknown WAXS peak shape aborted the whole report. The area of a peak is recomputed for files written before areas were stored; a shape this build does not recognise raised out of
peak_area()and no report was produced at all. It now costs one table cell (“N/A”). A peak area with no uncertainty shows “—” rather than “± 0”, which read as a measured zero.Igor wave names could collide. Names were truncated to Igor’s 31-character limit after the
_01/_02index was appended, so two curves with long, similar labels produced the same wave name and Igor silently overwrote the first. The label is now truncated to leave room for the index.The Simple Fits linearization exported no uncertainties.
linearize()propagates dY into linearized space, but the panel discarded it; the CSV and ITX now carry it (as an Igor error wave), and the grey out-of-range points are labelled Data outside fit range so they are not mistaken for one.CSV export from the Collect and Multi-Collect windows corrupted rows whose labels contained a comma. Both windows built their CSV with
",".join(...), so an item label such asRg, Asilently split into two columns. All CSV writing now goes throughrows_to_csv_text(), which uses the stdlibcsvwriter (proper quoting) and formats floats with%.10g— the same precision the ITX exporters use.Contrast results table: Ctrl+C did not work. The shortcut was declared on a
QActioncreated inside the context-menu handler, so it never fired while the menu was closed. It is now a real shortcut on the table.
[1.1.0b6] - 2026-08-07#
Added#
Cell/row/column selection and clipboard copy in Data Selector’s Tabulate Results table. The table only supported selecting whole rows, and had no clipboard support at all — copying a selection silently did nothing, so pasting elsewhere produced whatever had been on the clipboard before. Selection is now cell-based, so individual cells, whole rows or columns (via header click), and non-contiguous multi-selections (ctrl-click) are all supported. Ctrl+C copies the selection as tab-separated text; Ctrl+Shift+C, or right-click → Copy with Column Headers, includes the header row for the selected columns. Non-contiguous selections copy as a dense grid over just the selected rows and columns, so picking two non-adjacent columns pastes as a clean two-column block rather than everything in between.
Changed#
Minimum Python raised to 3.10.
requires-pythonsaid>=3.9whileenvironment.ymlalready required>=3.10,<3.14, so the package advertised a floor no shipped or tested environment used — andCLAUDE.mdtold contributors to write 3.9-compatible code because of it. The floor is now>=3.10consistently acrosspyproject.toml,conda/meta.yaml, the CI matrix (now 3.10/3.11/3.13) and the README badge; the 3.9 classifier is dropped.matchand PEP 604X | Noneare allowed in new code, though existing modules keepOptional[X]— follow the file you are editing. No runtime behaviour changes; this only stops advertising support for a version that was never tested.Ruff now selects
E,F,W,I(was theE/Fdefaults), withE501added to the existing ignore list — line length stays a formatting target, not a lint error. This sorts imports repo-wide and strips trailing whitespace across 131 files; the change is import order and whitespace only, no logic touched, and the full suite passes unchanged. TheUPandBrule sets from the house standard are deliberately still off — enabling them rewrites ~1050 type annotations and surfaces ~100 findings that need hand review, which belongs in its own pass.Ruff
target-versionbumpedpy39→py310; the vestigial[tool.black]section is removed (black was never a dev dependency here, andruff formatsupersedes it).requirements.txtdeclarednumpy>=1.22.0whilepyproject.tomlrequiresnumpy>=2.0fornumpy.trapezoid; installing from the former produced an environment wherepyirena.corefails on import. Floors now agree.IMPROVEMENT_PLAN.mdrenamed toPLAN.mdto match the naming used across the other packages.
[1.1.0b5] - 2026-08-07#
Fixed#
Invariant: “Refit background from saved ranges” ignored the parameter “Fit?” checkboxes. With complex background enabled and prefit Q windows saved, the replay refit
BG_B,BG_PandBG_flatunconditionally — onlyBG_P’s checkbox was consulted, and only to choose between fitting P or holding it. A user who unchecked B/P (for example settingBG_B= 0 to drop the low-Q power-law term for part of a sequence) while still needing the flat background refit had their held values silently overwritten on every Calculate. The checkboxes now gate the replay: a background parameter with “Fit?” unchecked is left alone,BG_Bheld skips the power-law refit entirely, andBG_flatheld skips the flat refit.SimpleFitModel. prefit_background()takes afixed_paramsargument for this, andbatch.fit_simple()passes the user’s fixed parameters through, so scripted and batch runs behave the same as the GUI.
[1.1.0b4] - 2026-08-06#
Added#
Parallel Monte-Carlo uncertainty in the Modeling tool. Each MC pass is an independent refit of noise-perturbed data, so passes now run across worker processes instead of one after another. This was impractical before for the models that need it most: a complex form factor (core-shell, core-shell-shell) or several populations can take minutes per pass, making a 20-pass estimate a coffee break. A new cores spin box next to Modeling → Passes: controls it — auto (the default: all cores but two), 1 for the previous serial behaviour, or an explicit count. The same setting is available to scripts as
fit_modeling(..., mc_workers=N)and as the"mc_workers"key in the exported JSON config. See MC Uncertainty.Uncertainties are unchanged by the worker count: all the noise is drawn in the parent process before any pass starts, so a given run produces the same numbers serially and in parallel.
Short runs stay serial automatically. The first pass is timed and the pool is only started when the remaining passes are projected to take more than a few seconds, so simple models never pay for worker startup.
If the host cannot start worker processes the passes fall back to serial with a warning rather than failing.
Cancel for Modeling MC runs. The Calc. Uncertainty (MC) button becomes Cancel MC while a run is in progress. Cancelling does not interrupt passes already in flight, so it takes effect within roughly one pass, and the uncertainties from the passes that did finish are still reported along with how many were used.
Regular expressions in every file Filter box. The documentation promised grep-like filtering, but only the HDF5 Viewer actually interpreted the Filter text as a regex — Data Selector, Data Manipulation and Data Merge did a plain case-insensitive substring test, so patterns like
60C|100C,0[12]min,^sample,\.h5$or^(?!.*bkg)silently matched nothing. All four browsers now share one implementation (pyirena.gui.file_filter) using full Python regular expressions matched anywhere in the name, case-insensitively. A plain fragment such asRg50behaves exactly as before, and an incomplete or invalid pattern (common while typing) falls back to a substring match rather than emptying the list.pyirena-doctor— installation troubleshooter. A new console command that reports the running interpreter, every required and optional dependency, and whether thepyirena-guilauncher uses the same Python as yourpip. Each dependency is classified as installed, missing, or installed but failing to load — the three states that the previous error messages collapsed into one. Users can paste its output into a bug report. See Installation → Troubleshooting.
Fixed#
“GUI dependencies not installed” when they demonstrably were.
ImportErrorcovers both a genuinely absent package and one that is present but whose binaries will not load (wrong CPU architecture, missing system libraries, shiboken6/PySide6 version skew). pyIrena reported the second as the first, telling users to reinstall something they already had. Qt import failures are now diagnosed: the message says which of the two happened, where the package lives, the original loader error, the interpreter that failed, and — for recognised errors such asincompatible architectureorlibGL.so.1— the likely cause and fix.Wrong-environment installs are now detected. When the
pyirena-guilauncher script points at a different Python than the one running, both paths are printed along with thepython -m pip/python -m pyirena.gui.launchform that keeps them in sync. This is the most common cause of the report above.GUI startup errors are no longer flattened into a dependency message. An
ImportErrorfrom an internal module is now identified as a probable bug (with an issue-tracker pointer) rather than blamed on missing packages, and the full traceback is always written to~/.pyirena/logs/gui.log.PYIRENA_DEBUG=1also prints it to the terminal.pyirena-viewerimported Qt directly instead of going throughpyirena.gui._qt, so it produced a bareModuleNotFoundErrorinstead of the diagnosed message.A Modeling test (
test_export_includes_selected_fit_method) failed instead of skipping in environments without Qt, becausepytest.importorskiptreats a re-raised plainImportErroras a broken module rather than a missing one.
Changed#
The Filter placeholder and tooltip in Data Selector, Data Manipulation, Data Merge and the HDF5 Viewer now come from one shared string and document the regex syntax inline, replacing the previous “text filter…” / “Enter text to filter files…” hints.
[1.1.0b3] - 2026-08-03#
Added#
Q-unit selector for text-file import. Text files (
.dat/.txt/.csv) carry no unit metadata, so pyIrena assumed Q was always in 1/Å. A new Data Selector → Configure → Text File Options → Q unit in text files setting (default 1/Å, also offering 1/nm, 1/pm, 1/µm, 1/mm) lets you tell pyIrena what unit your files actually use; Q (and dQ) is converted to 1/Å on import. Applied everywhere text files are read: Data Selector, Data Merge, Data Manipulation, thepyirena.batchAPI (fit_sizes,fit_unified,fit_waxs,merge_data, etc.), andpyirena.plotting.plot_saxs. The assumed unit is recorded in the converted HDF5 sibling’s provenance, and changing the setting for a file you’ve already converted automatically invalidates the stale cached sibling rather than silently reusing it. See Q units.CSV file support in Data Selector, Data Merge, and Data Manipulation. Comma-separated
.csvfiles are now recognized alongside.dat/.txteverywhere those text formats were already supported:Data Selector’s “Text Files” / “All Supported Files” filters, and the load / plot / report / ASCII-export paths (auto-converted to a cleaned NXcanSAS
.h5sibling on first use).Data Merge’s and Data Manipulation’s file-type dropdown (now Text (.dat/.txt/.csv)) and reference-file loader. The underlying text reader (
readTextFile) now auto-detects a comma delimiter from the first data-bearing line, so headerless or header-labeled CSV exports (e.g.Q,I,dIcolumns) parse the same way as whitespace-separated files.
Data Selector — GitHub-based update notification. Replaces the retired Igor Pro APS/ANL-server version check (which also is not applicable to pyIrena). On startup, and at most once a week thereafter, the Data Selector reads GitHub’s public
releases/latestendpoint (pre-releases/betas are excluded automatically) and shows an info banner with a link to the GitHub releases page when a newer stable version is available. Stdlib-only (urllib.request, no new dependency), fails completely silently offline/on any error, and never blocks startup — the network call runs on a backgroundQThread(UpdateCheckWorker). Newpyirena/version_check.py; opt-out via a new “Check for new pyIrena releases on startup” checkbox in Data Selector’s Configure… dialog (check_for_updates, default on). Seedocs/gui_quickstart.md.
[1.1.0b2] - 2026-07-24#
Beta 2 is a cleanup / hardening release on top of the 1.1.0b1 slit-smearing beta. It closes gaps found in an independent code review — the control/MCP write surface, packaging metadata, and CI — with no change to the fitting science or numerical results.
Security#
Control / MCP file access is now confined to
PYIRENA_DATA_ROOT. The read-onlypyirena.apidiscovery/data tools already resolved user paths throughresolve_safe*, but the mutating control tools (open_dataset,save_fit,save_sizes_fit— all exposed as MCP tools) builtPath(...)directly, so settingPYIRENA_DATA_ROOTdid not confine the part of the API that can read and write HDF5 files. All three now resolve inputs withresolve_safe_file()and write targets withresolve_safe(..., must_exist=False), rejecting absolute paths and..traversal outside the root with aPATH_NOT_ALLOWEDerror dict (never an exception across the API boundary). The stale “information disclosure only” note inapi/_paths.pywas corrected.
Fixed#
Control API saved slit-smeared fits as if they were pinhole fits. A control-/MCP-driven Unified Fit or Size Distribution on slit-smeared data stored
slit_length = 0and no ideal (pinhole) model curve, silently losing the slit-smearing provenance that the batch and GUI paths record.save_fit()now writes the smeared model, the idealintensity_model_idealcurve, andslit_length;save_sizes_fit()now writesslit_length,data_is_slit_smeared, andintensity_model_ideal. Theopen_datasetJSON schema also gained theuse_slit_smearedproperty (the function always accepted it, but schema-driven clients could not request the_SMRdataset).Control API
output_pathproduced an incomplete data file. Saving a fit to a newoutput_pathpassed the path straight to the result writer, which created a results-only HDF5 (no reduced-data SASdata group) thatreadGenericNXcanSAS()could not reopen as reduced data. Both save functions now seed a new target from the source file (copy_and_strip_results, reduced data + metadata, stale results stripped) before appending — the original file is never modified.Declared NumPy floor now matches the code (NumPy ≥ 2.0). The core calls
numpy.trapezoid(a NumPy 2.0 API) in ~30 places, butpyproject.tomldeclarednumpy>=1.22and the conda recipenumpy>=1.20, so an install on NumPy 1.x would crash. The floors were raised tonumpy>=2.0in both.Slit-smearing engine now validates its inputs (
core/smearing.py). When smearing is active (slit length > 0),build_smearing_matrix,smear_curve, andbuild_extended_qraise a clearValueErroron non-finite, unsorted, or too-shortq, onn_l < 2, and on a q/intensity length mismatch — instead of returning silently wrong output or a crypticIndexError. Theslit_length <= 0no-op contract is preserved (inputs pass through untouched), so the already-sanitised fit paths are unaffected.Import Igor Experiment: Irena/Nika “Use QRS Names” data not recognised. Igor experiments (
.h5xp/.pxp) whose reduced 1-D data followed the common Irena/Nika “Use QRS Names” convention — waves namedQ_<folder>/R_<folder>/S_<folder>(uppercase prefix, data-folder name as suffix; R = intensity, S = error) — imported as zero samples: every folder was silently skipped. The importer’s wave-name picker tables only knew pyirena’s own lowercaseq_<folder>output and a few other conventions. Added the uppercase QRS triple to all three techniques (USAXS/SAXS/WAXS) in bothWAVE_PICKERS_H5XPandWAVE_PICKERSinpyirena/io/pxp_to_nexus.py. A real desktop-SAXS (Xenocs, ANSTO) file that previously imported 0/44 samples now imports 44/44. Note: a follow-up will make Igor wave-name matching fully case-insensitive, since Igor names are case-insensitive by design.“Teubner-Strey” model name typo. The Simple Fits model was misspelled “Treubner-Strey” (the model is named for M. Teubner & R. Strey, J. Chem. Phys. 87, 1987) in the registry key, internal function name, derived-value docs, and the Igor-compatibility wave name (
SimFitTreubnerStreyI→SimFitTeubnerStreyI). Corrected throughoutpyirena/core/simple_fits.py,pyirena/io/igor_names.py, docs, and README. Old saved GUI state, NXcanSAS result files, and JSON exports that stored the misspelled name keep loading correctly —SimpleFitModel.set_model(),SimpleFitModel.from_dict(), and the Simple Fits panel’sload_state()all transparently map the legacy spelling to the corrected one via a new_resolve_model_name()helper, so no existing files need to be migrated.
Changed / Internal#
Packaging metadata cleaned up. Added a real
plottingextra (pip install pyirena[plotting], referenced by the docs but previously undefined);import pyirenano longer eagerly imports matplotlib (theplot_saxsconvenience export is now lazy via module__getattr__); migrated to the SPDXlicense = "MIT"form (+license-files) ahead of the setuptools deprecation; the conda recipe now matchespyproject.toml(Python ≥ 3.9, NumPy ≥ 2.0, SciPy ≥ 1.8, and the previously-missingigor2dependency) with a documentedsha256placeholder; and the test suite is no longer packaged into the built wheel/sdist (developers and the conda recipe build from the source archive).CI is green and bounded. Fixed the 12 outstanding
rufffindings so the lint job passes; addedpytest-timeoutwith a 300 s per-test watchdog so one hung test can no longer stall a CI job; and fixed the long-hangingtest_export_includes_selected_fit_method— it blocked forever on an unmocked modalQMessageBoxoverwrite confirmation, now auto-accepted.New contract tests. The full MCP surface (68 tools) and all 51 control JSON schemas are now checked for structural validity and schema↔signature parity (this would have caught the
use_slit_smearedschema gap); new behaviour tests cover control-API path confinement,output_pathcompleteness, and slit-smearing provenance on save; and the slit-smearing input validation is covered by unit tests.Docs / repo hygiene.
docs/distribution.mdno longer tells maintainers to edit a version string inpyirena/__init__.py(the version is single-sourced frompyproject.toml);publish.ymlnow verifies the release tag equals thepyproject.tomlversion before publishing to PyPI; and the trackedscratch_sizes_diagnosis/development directory (already gitignored) was removed from version control.
[1.1.0b1] - 2026-07-22#
Added#
Slit smearing across all fitting tools (USAXS/Matilda). pyIrena can fit slit-smeared USAXS data directly by smearing the model to match the data (Lake infinite-slit,
I_sm(q)=(1/SL)∫₀^SL I(√(q²+l²))dl) — the data are never modified and fitted parameters are always ideal-space (pinhole-equivalent). Core enginepyirena/core/smearing.py(SlitSmearer,smear_model,smear_curve, a fixed sparse operatorWso a fit loop costs one matvec per iteration). Slit-smeared data are detected from NXcanSAS (Q@resolutionscontainingdQl+ a scalardQl); files with both a desmeared and a slit-smeared copy (Matilda) show a “Slit smeared data” checkbox to select which to load. Wired through Unified Fit (all levels + background + local Guinier/Porod cursor fits + “Show selected level” overlay; invariant computed from the ideal model), Size Distribution (G matrix smeared once, recovered distribution is ideal-space), Simple Fits (each analytic model smeared; Invariant disabled on smeared data with a message), and Modeling (total + per-population curves smeared). Fractals smears its comparison overlay. GUI control shared viapyirena/gui/slit_smearing_ui.py::SlitSmearingMixin(used by every fitting panel, incl. Unified Fit). Scripting/MCP contract:load_slit_smeared: true(+ optionalslit_length) in a tool’s JSON block, enforced with a hard error on files lackingdQl. Saved results recordslit_length/data_is_slit_smearedand an ideal (*_ideal) model curve alongside the smeared one. Seedocs/slit_smearing.md.Data Explorer — “Show all attributes” checkbox. The HDF5 tree browser previously only surfaced a curated set of attributes (
NX_class,units,analysis_type, …), silently hiding others such asdata_is_slit_smeared/slit_lengthonunified_fit_results. A new checkbox above the tree toggles between the curated set and every attribute on a node; internal bookkeeping (_pyirena_configand any other_-prefixed attribute) stays hidden either way. Toggling preserves the tree’s current expand state.Data Merge — slit-smearing provenance. Merging a slit-smeared USAXS curve with a pinhole SAXS curve produces a slit-smeared output: the merged file gets a
dQldataset (so downstream tools auto-detect it) and the merge provenance recordsslit_length_ds1/ds2andslit_length_merged. Two inputs with different nonzero slit lengths warn (the larger is kept). Optimization is unchanged — the slit length sits at/below the SAXS Qmin, negligible in the overlap.
Changed#
Data Manipulation — slit-smearing safety. Subtract/divide refuse to mix a slit-smeared curve with a pinhole one (or two different slit lengths); the check now lives in the core engine (
DataManipulation.check_slit_compatible), so batch scripting inherits it. Manipulation/merge outputs drop any stale_SMRtwin entry copied from the source and clear an orphaneddQl, so a later slit-smeared load can’t return an inconsistent curve.Create Report notes when a tool’s saved results used slit smearing (Unified/Sizes/Simple/Modeling), reading
slit_lengthfrom the HDF5 file.
Fixed#
Clear error for non-scattering / empty data files, instead of a different cryptic crash per tool. A file whose Q/Intensity arrays are empty (sample didn’t scatter, aborted measurement, corrupted file) used to load “successfully” and then crash deep inside each tool with an unrelated numpy error (
len() of unsized object,too many indices for array: array is 0-dimensional, mismatched broadcast shapes, …).readGenericNXcanSAS/readSimpleHDF5(pyirena/io/hdf5.py) now raise a singleNoScatteringDataErrorright at load time with a message that says what’s actually wrong, shown identically by every tool (Unified Fit, Size Distribution, Modeling, Simple Fits, SAXS Morph, Data Selector “Create Graph”). The batch API (_load_dataand allfit_*functions) already catches load errors per file and returnsNone, so unattended/scripted batch runs now skip a bad file with one clear log line instead of risking a crash — verified acrossfit_simple,fit_sizes, and the Data Selector’s batch-script worker. “Create Graph” now also reports which files were skipped and why instead of silently plotting nothing for them.Simple Fits — displayed model is now slit smeared. “Graph model” and auto-graph previously drew the ideal (sharp) curve even with smearing on, so Sphere/Spheroid/Teubner-Strey oscillations looked unsmeared;
compute()now smears, matching the fit. Guinier/Porod linearization is labelled best-effort (ideal-space) for smeared data (no closed-form linearization exists).Background prefits are ideal-space under smearing (Size Distribution and Simple Fits): the prefit power-law/flat is now smeared before comparison, so the returned B/P/flat are not double-smeared by the main fit.
Modeling saves the ideal (pinhole) model curve (
model_I_ideal) alongside the smeared one, and no longer reuses a wrong-length cached G matrix when producing that ideal curve.Fractals no longer silently shows an unsmeared overlay when smearing the comparison curve fails — it logs and flags the discrepancy.
Unified Fit — large slit-smeared fit slowdown fixed (~50× on affected fits). ETA/PACK are now only free fit parameters when a level’s correlations are enabled. With correlations off they have no effect on the model, so fitting them made the least-squares problem rank-deficient and the solver thrashed for thousands of no-op iterations — cheap for pinhole data but badly amplified by slit smearing (each iteration evaluates the model on the extended grid). A real 2-level USAXS fit dropped from ~2.5 s to ~0.05 s with identical χ² and parameters. Also speeds up pinhole fits and fixes a latent correctness issue (fitting parameters that cannot change the fit).
Size Distribution — power-law/complex background now displayed and subtracted slit-smeared. The background preview drew and subtracted the ideal (pinhole) background on slit-smeared data, so the curve sat below the data and looked unfitted and
I−bgwas wrong; it now smears the background for both display and subtraction, matching the fit.Size Distribution / Modeling panels — layout no longer forced too wide. The shared “Slit smeared data” control row is now compact (short labels; status text on its own wrapped line), so it no longer stretches narrow control panels and hides widgets. The Size Distribution control panel is now user-widenable via the splitter (420 px minimum instead of a hard-fixed width).
Size Distribution — fitted model + background now displayed slit-smeared. The fit was correct, but the result plot added the ideal (pinhole) background to the (smeared) model scattering and drew the ideal “Complex bg” curve, so the red model+background curve visibly misfit the smeared data. All three display paths (fit result, “Graph model”, background preview) now show the smeared background — and the “Graph model” preview smears the scattering too — matching the data.
Data Merge — select the slit-smeared copy. When a merge input file carries both a desmeared and a slit-smeared (USAXS) copy, a “Use slit-smeared copy” checkbox appears under that dataset’s file list; checking it reloads the slit-smeared data so the merged output is written slit smeared (
dQl). Previously only the desmeared@defaultentry could be loaded, so the provenance plumbing added earlier had no way to be triggered from the GUI.
Entries for 1.0.1 and earlier live in docs/CHANGELOG_archive.md.