-
Notifications
You must be signed in to change notification settings - Fork 3
Estia #108
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
Conversation
src/ess/estia/__init__.py
Outdated
|
||
providers = ( | ||
*reflectometry_providers, | ||
# *load.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.
# *load.providers, |
src/ess/estia/conversions.py
Outdated
""" | ||
p = position - sample_position.to(unit=position.unit) | ||
return ( | ||
sc.atan2(y=p.fields.x, x=p.fields.z) |
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 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.
Amor scatters vertically but Estia scatters horizontally, that's what makes the difference.
|
||
Computes the angle between the scattering direction of | ||
the neutron and the sample surface. | ||
''' |
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.
Can you also add descriptions of the parameters in the docstring?
src/ess/estia/conversions.py
Outdated
def divergence_angle( | ||
position, sample_position, detector_rotation, incident_angle_of_center_of_beam | ||
): | ||
""" | ||
Angle between the scattering direction and | ||
the ray from the sample to the center of the detector. | ||
""" |
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.
Type hints and params in docstring.
tests/estia/mcstas_test.py
Outdated
return wf | ||
|
||
|
||
def test_mcstas_loading(estia_mcstas_pipeline: sciline.Pipeline): |
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.
Seems this test is doing a bit more than loading. It's also adding a bunch of coordinates.
tests/estia/mcstas_test.py
Outdated
assert 'detector_rotation' in da.coords | ||
assert 'theta' in da.coords | ||
assert 'wavelength' in da.bins.coords | ||
assert 'Q' in da.bins.coords |
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.
So Q is already in the coordinates? I always thought that computing Q was the goal of the reduction?
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.
Computing the reflectivity as a function of Q
is the goal of the reduction. But Q
is just a coordinate associated with every event like wavelength
or anything else.
tests/estia/mcstas_test.py
Outdated
assert 'Q' in da.bins.coords | ||
|
||
|
||
def test_can_compute_reflectivity_curve(estia_mcstas_pipeline: sciline.Pipeline): |
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.
Out of curiosity, how long does this test take to run?
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.
I already trimmed the McStas files quite a bit, so it's fast.
tests/estia/mcstas_test.py
Outdated
).nanmax() | ||
|
||
assert max_q > sc.scalar(0.075, unit='1/angstrom') | ||
assert min_q < sc.scalar(0.007, unit='1/angstrom') |
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.
I feel we could benefit from more tests which check that the different parameters do what they are supposed to do (e.g. changing the masks or something else).
But it's also ok to do that in a follow-up PR.
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.
I agree it would be good to have more tests.
tests/estia/mcstas_test.py
Outdated
@@ -0,0 +1,82 @@ | |||
# SPDX-License-Identifier: BSD-3-Clause | |||
# Copyright (c) 2024 Scipp contributors (https://github.com/scipp) | |||
# flake8: noqa: F403, F405 |
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.
Why the global flake8
?
Also, I thought we had moved to ruff
everywhere?
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.
Don't know, I copied the file from one of the amor tests. I'll try to remove it here and from the amor tests.
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.
Couple of remaining things (summarizing here as it can get lost in the noise):
- move masking to a separate file
- unresolved (?) discussion about variances on mcstas data (waiting for simon to reply)
Otherwise, I think everything else has been addressed?
Co-authored-by: Neil Vaytet <39047984+nvaytet@users.noreply.github.com>
I'll add an example notebook for reducing Estia McStas data |
"q_theta_figure(results, q_bins=300, theta_bins=200)" | ||
] | ||
} | ||
], |
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 notebook makes a lot a plots. I think it would really benefit from some short explanations between the figures, explaining what we are showing.
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.
I agree with you, but I think it's good to not make this PR any longer now. It's a basic notebook that someone experienced in the technique will at least get the gist of. Let's postpone this step to a separate PR for improving the docs.
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.
I disagree, I think leaving it til later will increase the chances of us forgetting.
I don't think it's so much work to add small sentences and sections explaining a little what we are doing, especially if this is going to appear in the docs.
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 some explanations already added, maybe take a look at those and see if that's what you wanted to see there.
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.
Yes, sorry I had missed those.
@nvaytet You are the main reviewer here, if you are confident that it is correct and adequately explained, go ahead! |
Fixes #91
Initial draft for the ESTIA data reduction workflow.