Skip to content

Refactor molecule fitting#17

Draft
AntoineTUE wants to merge 24 commits into
Julian-Held:mainfrom
AntoineTUE:refactor-molecule-fitting
Draft

Refactor molecule fitting#17
AntoineTUE wants to merge 24 commits into
Julian-Held:mainfrom
AntoineTUE:refactor-molecule-fitting

Conversation

@AntoineTUE
Copy link
Copy Markdown
Contributor

(This PR is very much WIP; I'll update this post as it progresses, changes will be incremental at first)

Purpose

This PR seeks to improve how we handle fitting of molecular spectra and how the user can interact with the results.

The goal is to make fitting more robust, but also improve the interaction with it and fix (minor) issues.

As it stands, there are some small issues involving NaN values, or with a 'reversed' wavelength axis (i.e. decreasing), that can cause a fit to fail unexpectedly, without clear reason to the user.

Once fitted, the result table is fairly fragile when changing the amount of species fitted: it won't always put values in the corresponding (correct) column.

Also, apart from showing the fit and summarizing values, there is no other interaction possible to inspect fit parameters and results in detail (e.g. residuals, components of multiple species, etc), which would actually be very useful.

For fitting, it will move to use a model based approach using lmfit, to more clearly handle fit parameters and bounds, relying more directly on Moose for the modelling.

Finally, the goal is to decouple UI state from the fitting process.
Once started, a batch fit can be affected by (and fail due to) changes in the UI, such as (de)selecting a molecule.

Notable changes

(TODO)

…data loading in molecule module.

* Molecule data is now cached, filtering at runtime
* Available molecule data determined dynamically at start, with fallback to plain names if no label defined for UI.
* consistent plot label order and decimals
* Plot all zeros if a species has no lines in plotted range
…fits.

* Pass line databases directly to MoleculeFitter instead of non-threadsafe widgets
* Construct initial estimates and bounds in MoleculeFitter.
* Fixes changes in checkboxes affecting which species will be fitted when a batch of fits is already in-progress
…data loading in molecule module.

* Molecule data is now cached, filtering at runtime
* Available molecule data determined dynamically at start, with fallback to plain names if no label defined for UI.
* consistent plot label order and decimals
* Plot all zeros if a species has no lines in plotted range
…fits.

* Pass line databases directly to MoleculeFitter instead of non-threadsafe widgets
* Construct initial estimates and bounds in MoleculeFitter.
* Fixes changes in checkboxes affecting which species will be fitted when a batch of fits is already in-progress
…eTUE/OES-toolbox into refactor-molecule-fitting

Merge upstream changes of main into branch for refactorring molecule
fitting
…arameters from data.

* Use lmfit and Moose for clearer modelling of spectra based on parameters with bounds.
* Use `multi_species_objective` from Moose with `normalize=True`
* Store fit results with associated table row using FitResultRole
* Store ref to fit plot item with associated table row using PlotItemRole
…nt changes.

* Fit data and plots are now stored with the table and should be cleared alongside it as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant