ADR suggestion Example of full workflow in lib
#3
henrikjacobsenfys
started this conversation in
Ideas
Replies: 1 comment
-
|
This looks solid and well structured. E.g. ResModel.add_component('Gaussian',
amplitude=Parameter('G1amp',value=0.1,unit=None,fixed=False),
sigma=Parameter('G1sigma',value=0.1,unit='meV',fixed=False))why not use # add predefined gaussian component, which resides in say, ESpec.models
# and accepts `sigma` and `amplitude` as optional arguments
ResModel.components.add(component_id="g1")
ResModel.components["g1"].type = ESpec.models.gaussian
ResModel.components["g1"].amplitude.value = 0.1
ResModel.components["g1"].sigma.unit = 'meV'
ResModel.components["g1"].sigma.fixed = Falseor, create a local component and then assign it with component = ESpec.models.gaussian
component.amplitude.value = 0.1
component.sigma.value = 0.1
component.sigma.unit = 'meV'
component.sigma.fixed = False
ResModel.components.add(component) |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
General
I have attempted to write down a complete data analysis workflow in the lib, to figure out what methods are required and what the structure should be. Overall, a complete workflow consists of the following steps:
Current implementation
Nothing is implemented
Suggested implementation
1. Resolution
2. Initial fit of data
This will be almost identical to the fit of vanadium, so I will not quote the whole thing here. The important change is the resolution modeL
Inspect and fit the resulting fit parameters
Global model
In a global model, there will still be local parameters. I therefore think it makes sense to link parameters via a
ParameterModel:Then all the data will be fitted simultaneously. If we e.g. have data at 10 values of Q, we will fit 10 amplitudes, 10 backgrounds, but only one parameter to describe gamma and how it varies with Q.
Some thoughts
Analysisclass, but I've reached the end of my concentration.Overall structure and overview of methods
ProjectThe
Projectis intended to own a complete experiment on one sample. It containsData(added byadd_data),SampleModel,BackgroundModel,ResolutionModel,FitParameter. It has methods to plot (plot_data) and fit (fit_data) the data. It will use theResolutionHandlerdescribed in #2. It will also have a method to link fit parameters using global models (e.g. to diffusion) models (link_fit_parameter).A
SampleModeladded to theProjectwill attach aSampleModelto each data set inData.A
BackgroundModelis also aSampleModel, but will not be convoluted with the resolution functionA
ResolutionModelwill for now be restricted to also being aSampleModel, but can be expanded to be a data set to use raw data for the resolution convolution.DataContains the data with various methods to be defined. Each data set can be given a
SampleModelSampleModelAlso discussed in #2 . Contains a model of the sample, consisting of components. Has methods to add and remove components, as well as to evaluate them on an input x axis.
FitParameterFitted parameters are a kind of data set on their own. Perhaps they can even use the same class as
Data, but that's unclear for now. It needs methods to select and to plot specific parameters.Beta Was this translation helpful? Give feedback.
All reactions