ADR suggestion: ParameterAnalysis
#145
henrikjacobsenfys
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Name is also work in progress.
General
When users have fitted their raw data (using
Analysisor the not-yet-existingJob(orProject?)) they may want to fit the resultingParameters to figure out trends and to obtain parameters that describe theQor temperature dependence of their parameters. For now, we will only be concerned with theQdependence. There are two main cases to distinguish:Parameters describing diffusion, andParameters that don't describe diffusion. I'm unsure if they should be treated by different classes.For diffusion, users will want to fit the area and width of a particular
Lorentzianto the corresponding area and width calculated by aDiffusionModel. Some users will want to only fit the width.For other cases, most users will want to fit a single
Parameterto a function described by aComponentCollectionor just aModelComponent(most likely aPolynomial). Some advanced users may want to fit multipleParameters to a combined model.I propose to create a new class,
ParameterAnalysisfor this.Defining the data
It should be easy for users to pass their
Parameters. The standard method will be to pass theAnalysis(orJobin the future) object and thenameof either theLorentzianif fitting aDiffusionModelor thenameof theParameter(or a list ofnames for multipleParameters).It will also be allowed to pass a
scipp.Dataset, which is obtained fromAnalysis.parameters_to_dataset(), or ascipp.DataArraywith nonamearg - thescipp.DataArrayis then obtained from thescipp.Datasetby selecting thenamemanually.Defining the fit function
There are many use cases, and so it may be a good idea to split the functionality into different subclasses.
The fit function can be a
DiffusionModel, in which case users also need to be able to set afit_areaandfit_widthboolean. Internally, it will use theDiffusionModel.calculate_width()andDiffusionModel.calculate_area()methods.For a single
Parameter, the fit function should be either aComponentCollectionorModelComponent, in which case the.evaluate()method is used.For multiple
Parameters, the fit function will be a list (each element corresponds to aParameter) of eitherComponentCollections or,ModelComponents, or a mix. Either way, theevaluatemethod is used.All the fitting will be done with either
FitterorMultiFitter.Methods
The data and fit functions should be properties with setters and getters.
Users should be allowed to change fit settings.
Methods are needed to plot the results.
Future extensions
Care needs to be taken when temperature is also involved - people will want to sometimes fit as function of temperature instead of
Qand sometimes fit the same model to all temperatures (analogous to how people want to fit the same model to all Q instead of just one Q). I will cross this bridge when I get to it.Beta Was this translation helpful? Give feedback.
All reactions