ADR suggestion: extending dimensions
#177
Replies: 1 comment 1 reply
-
|
Be VERY careful about over-generalizing . . . That being said. I plan to use the In regards to fitting multiple different experiments, I plan to make my |
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
Currently, the dimensions are pretty hard-coded: a dataset is a sc.Dataarray with coordinates
energyandQ. This is a good beginning, but it needs to be extended to arbitrary dimensions such as temperature, pressure, and perhaps even sample number. A more general approach is needed. This requires changes inExperiment,SampleModel(andResolutionModelandBackgroundModel),Analysis1d,AnalysisandParameterAnalysis.These changes will have to happen simultaneously, as the API of all these classes will have to change. I'm unsure how best to do this. The first thing that comes to mind is that I just make a giant PR, since I'm also designing as I code. But it may be better to make a new develop branch and make smaller PR's against that. I'll still need the old develop branch to make quick bug fixes.
Experiment
This is the most straightforward change: we simply allow any coordinates, and only
energyis a required coordinate. I think theenergyproperty can remian, but theQproperty should be removed/replaced with a more general coordinate getter.It is the source of truth for all coordinates, see below.
We should also consider using a DataGroup - it will be needed in some form eventually. A typical example would be users measuring the same sample at two different experiments, or with two different instrument settings (e.g. low resolution, wide energy/Q range, high resolution, narrow energy/Q range), and wanting to fit that data simultaneously. But I think it's good to build this thing in steps.
Shared changes among other classes
Currently, there is always a
Qcoordinate, andAnalysis,Analysis1d,SampleModel,ResolutionModel,BackgroundModelall store the relevant objects (e.g.ComponentCollectionorAnalysis1d) as a matching list. This will need to change. Extending to nested lists is bound to go wrong, so we will instead use a dict-like system, probably based on scipp DataGroup. I will need to look a bit more at how exactly to implement things, but the idea is that users must be able to select an object both based on physical variables (e.g. all data at temperature of 300 K, with optional tolerance) and on indices/slices (e.g. the first and last temperature). I don't thinkEasyListis general enough.It may make sense to make a small helper class that handles indexing, since it will be needed by so many classes. I'll need to make a prototype and try it out.
Generation of objects
SampleModel,ResolutionModelandBackgroundModelwill need to generate aComponentCollectionfor each coordinate.Analysiswill need to create aAnalysis1dfor each coordinate, which will also generate aConvolution. This is a lot of generation. Generation of things is currently not standardized and a mix og eager/lazy generation. I will move to a standard solution of lazy generation, i.e. any changes marks the object as dirty in some way, and any call to calculate, fit etc. checks if it's dirty and acts accordingly. There will also be a public method to generate everything, since it may be time consuming for big data sets.AnalysisIn addition to what's mentioned above, it will have a rebin method, which uses the rebin method from the data. This will also solve #157 . It will require a confirm=True argument, since it will destroy all generated objects.
Anaysis1dAnalysis1dis the basic analysis object, and remains so. But it currently stores the full DataArray and a Q index, and allows changing the Q index. This functionality will be removed, and it will instead store only the data given to it, i.e. only the data at the particular Q index. It will not allow changing the Q index. It will store all metadata, i.e. what the Q, temperatue etc. index it corresponds to.SampleModelSpecial care needs to be taken with models of diffusion, as they will require a Q coordinate, and the data won't necessarily have one anymore. At the same time, SampleModel will not and should not require knowing what coordinates it will have eventually when attached to an Analysis object.
Beta Was this translation helpful? Give feedback.
All reactions