Repository navigation
Fix Planckian/exponential fits on physical units; add fit formulas - #75
Merged
Merged
Conversation
#74) The automatic Planckian fit returned its initial guess (peak exp(5) - 1 times too low) on physically scaled data such as wavelengths in meters: the amplitude seed ignored the model peak value and curve_fit stopped at its first iteration. The seed now matches the data peak and the fit runs on normalized data. The docstring explains how to derive the peak wavelength, temperature and emissivity from the fitted parameters. The exponential fit bounded the rate to [-10, 10] whatever the X unit and clipped the rate itself when evaluating the model: the rate bound now scales with the X range and only the exponent is clipped. Every fit computer now exposes its model formula (FORMULA attribute and get_formula() method) for interactive fit dialogs. Assisted-by: Claude Opus 5.5
…fo (#74) Gaussian, 2D ramp, sinusoidal grating, ring pattern, Siemens star and 2D sinc images are computed over a [xmin, xmax] x [ymin, ymax] domain which was ignored by the image coordinates. These parameter classes now derive from DomainImageParam, whose "Physical coordinates" option (enabled by default) applies the domain to the image uniform coordinates. The blackbody signal gets default axis labels and units (wavelength in m, spectral radiance in W·sr⁻¹·m⁻³). Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
This was referenced Oct 19, 2026
PierreRaybaut
marked this pull request as ready for review
October 20, 2026 03:46
This was referenced Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #74
Several problems reported by DataLab 1.3.0 users about the blackbody signal, curve fitting and synthetic images.
Bug fixes
planckian_fitreturned its initial guess unchanged. The fitted peak came out exactlyexp(5) - 1(about 147) times too low, with no warning. The initial guess now matches the data peak, and the fit runs on normalized data, so it converges whatever the units. With the default blackbody signal, the fit gives backT = 293 Kand an emissivity of 1, to better than 1e-6 relative error.bwas bounded to [-10, 10] whatever the X unit, so a 1 ms time constant with X in seconds could not be fitted. The bound now scales with1/Δx, andevaluateclips the exponentb·xinstead ofbitself.New features
FitComputer.FORMULAandget_formula()give the rich-text formula of every fit model (single source of truth for SigimaX, DataLab and DataLab-Web).PlanckParamnow has default axis titles and units: wavelength in m, spectral radiance in W·sr⁻¹·m⁻³. Its docstring had the wrong unit.DomainImageParam. Its "Physical coordinates" option (enabled by default) uses the[xmin, xmax] × [ymin, ymax]domain as the image coordinates. Parameters serialized without this option (creation metadata, workspaces, history) are deserialized with it disabled, so recreating an older image keeps its pixel coordinates.Not changed
The 4-parameter Planck model and the
fit_paramsschema are unchanged. The model is still over-parameterized (#43 stays open); the docstring now explains how to derive peak wavelength, temperature and emissivity from the fitted parameters.Companion PRs (merge order: Sigima → SigimaX → DataLab)
Validation
FORMULAfor every fit type;