-
Notifications
You must be signed in to change notification settings - Fork 2
Add masking #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add masking #55
Conversation
…ders for masking in pixels, wavelength and theta
| " | (x > sc.scalar(86e6, unit=\"ns\")),\n", | ||
| " # Mask in wavelength\n", | ||
| " WavelengthMask: lambda x: (x > sc.scalar(2.0, unit=\"angstrom\"))\n", | ||
| " & (x < sc.scalar(2.7, unit=\"angstrom\")),\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this mask come from? Is there an artefact in the data that needs to be masked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No there is no artifact. I was just to illustrate things.
I probably should make a separate example, either in a new section at the bottom or in a new notebook.
| "source": [ | ||
| "## Create pipeline using Sciline\n", | ||
| "\n", | ||
| "We use the basic providers available in `essdiffraction` as well as the specialised `powder` and `geant4` providers." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no basic providers, only ones for powder and geant4.
src/ess/dream/io/nexus.py
Outdated
| - The high-resolution and SANS detectors have a very odd numbering scheme. | ||
| The scheme attempts to follows some sort of physical ordering in space (x,y,z), | ||
| but it is not possible to reshape the data into all the logical dimensions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - The high-resolution and SANS detectors have a very odd numbering scheme. | |
| The scheme attempts to follows some sort of physical ordering in space (x,y,z), | |
| but it is not possible to reshape the data into all the logical dimensions. | |
| - The high-resolution and SANS detectors have a very odd numbering scheme. | |
| The scheme attempts to follows some sort of physical ordering in space (x,y,z), | |
| but it is not possible to reshape the data into all the logical dimensions. |
To get proper formatting. (Note the blank line)
|
@jl-wynen for now, the notebooks only work when computing d-spacing from positions, and not from a calibration file. |
|
I know an approach but it may not be good. For CIF files we need to write data in tof. So the idea was to do the reduction in d-spacing and then convert back to tof using fake positions. You could use a similar approach here where you essentially determine calibrated positions by converting back from d-spacing. There is some ambiguity here about how you define positions and tof, though. So you / we would have to make a judgement call. But since we need this anyway for CIF, we can use the same mechanism here. |
Co-authored-by: Jan-Lukas Wynen <jan-lukas.wynen@ess.eu>
src/ess/dream/io/nexus.py
Outdated
| from ess.reduce import nexus | ||
|
|
||
| DETECTOR_BANK_RESHAPING = { | ||
| "endcap_backward_detector": lambda x: x.fold( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this into sizes, not lambdas
| ) | ||
| from .types import DetectorInfo | ||
|
|
||
| DETECTOR_BANK_SHAPES = {"powgen_detector": {"bank": 23, "column": 154, "row": 7}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shapes -> sizes
src/ess/powder/grouping.py
Outdated
| def focus_data( | ||
| data: MaskedData[RunType], | ||
| dspacing_bins: DspacingBins, | ||
| twotheta_bins: Optional[TwoThetaBins] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe request a new data type to get data binned in theta, as in sans Qxy?
| " TofMask: lambda x: (x < sc.scalar(0.0, unit=\"us\"))\n", | ||
| " | (x > sc.scalar(16666.67, unit=\"us\")),\n", | ||
| " # Mask in wavelength\n", | ||
| " WavelengthMask: lambda x: (x > sc.scalar(0.18, unit=\"angstrom\"))\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove wavelength mask
src/ess/dream/data.py
Outdated
| """Data for tests and documentation with DREAM.""" | ||
|
|
||
| from pathlib import Path | ||
| # from pathlib import Path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented code
…ead of using Optional[TwoThetaBins]
This adds the framework for masking according to various coordinates (
pixel_id,tof,wavelength,two_theta).It also attempts to standardize the Powgen and dream-geant4 use cases, in terms of loading files and keeping logical dimensions.
This is part of #50, but it only implements the reduction workflow side of things, and not an interactive masking tool, which is defered to a later PR.
(Apologies about the noise with quotation marks, I accidentally ran
blackat some point on the files, after the config forblackwas removed due to the switch toruff, and it therefore did not ignore quotation marks)