ADR suggestion: Calculation
#180
Replies: 1 comment 1 reply
-
|
My comments: Making Too many constructor parameters. The proposed Current structure may be good enough. Looking at the actual code: Maybe instead of a full |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
General
Analysisdoes too much. It's a (too complicated) calculation engine, fitter and plotter. It has a convoluted (pun intended) way of handlingConvolutionobjects and ensuring that they are up to date. ExtendingAnalysisto more coordinates in accordance with #177 is near impossible in its current form. The solution is a class to handle calculations, which I will tentatively callCalculationCalculation
It will take the following inputs:
scipp.Dict: The coordinates for which to calculate the model. Will typically simply be e.g. data['Q',0, 'temperature', 2].coords.energywill be a required coordinate.ComponentCollection|ModelComponent: Typically the relevantComponentCollectionfrom aSampleModelComponentCollection|ModelComponent: Same, but for resolutionComponentCollection|ModelComponent: Same, but for backgroundParameter: temperature of the model e.g. for detailed balancingParameter: energy offset to handle instrument misalignmentCalculationSettings: see belownp.ndarray| sc.Variable | None: User-defined energy to do the calculation? Maybe? Or perhaps it should be in the coordinates. I'll think a bit about that.It will have various methods, the ones that come to mind are
These will be moved from
Analysisand updated in accordance with the rest of this ADR suggestion.CalculationSettings
I may want to collect the settings in a small
CalculationSettingsclass. It will includeDetailedBalanceSettingsandConvolutionSettings(#174 ). TheCalculationSettingscan handle things like whether components of the resolution should be calculated individually or as a sum (#146 ), whether resolution convolution should happen, if individual components should be calculated and so on.CalculationContext?I'm considering grouping all the inputs in its own class, tentatuvely named
CalculationContext. This will provide all the input required to do the calculation and will be easy to pass around. On the other hand, havingAnalysis1dcreate aCalculationContextwith the right input and then passing it toCalculationmay not be any simpler than havingAnalysis1dcreate aCalculationwith the right input to begin with. I'll make the first version without it and see how well that goes.Note on temperature
With the coming addition of temperature as a coordinate, we need to distinguish between model temperature and sample temperature
Beta Was this translation helpful? Give feedback.
All reactions