Update scripts to scippneutron v0.4.1#39
Conversation
jl-wynen
left a comment
There was a problem hiding this comment.
Looks ok. But note that scipp 0.11 introduces some more breaking changes.
Are you planning to move parts of this to ess?
diffraction/powder_reduction.py
Outdated
| sample_dspacing = sample_dspacing.rename_dims({'wavelength': 'dspacing'}) | ||
| del sample_dspacing.coords['wavelength'] # free up some memory, if not needed any more | ||
| if sample_dspacing.bins is not None: | ||
| del sample_dspacing.bins.coords['wavelength'] # free up a lot of memory |
There was a problem hiding this comment.
You can use transform_coords with keep_inputs=False to remove wavelength more easily.
But this also removed the other inputs like tzero...
There was a problem hiding this comment.
There was a problem hiding this comment.
Ah, right. You are using the full conversion graph. So it computes dspacing from tof and not from wavelength. Is this what you want?
If you want the latter, you need to either construct a graph yourself or use scn.convert(target='dspacing', origin='wavelength'). We don't expose a graph for that conversion yet.
There was a problem hiding this comment.
I added an intermediate conversion to tof before applying convert_with_calibration.
diffraction/powder_reduction.py
Outdated
| if calibration is None: | ||
| # No calibration data, use standard convert algorithm | ||
| sample_dspacing = scn.convert(sample_lambda, 'tof', 'dspacing') | ||
| sample_dspacing = scn.convert(sample_lambda, 'wavelength', 'dspacing', scatter=True) |
There was a problem hiding this comment.
Why didn't you use transform_coords here?
There was a problem hiding this comment.
I removed the option to reduce data without calibration. Instead an exception is raised if equal to None.
Allowing calibration=None would require too many modifications because it is used for the calibration of detectors but also for the definition of groups, which is required to select the relevant groups of sample and vanadium data before normalisation.
This option will be available in a more complete workflow.
using scipp 0.11.1 and scippneutron 0.4.2
|
The plan is to move some of these algorithms to the ess repo. |
Additional step before converting to d-spacing with calibration

No description provided.