-
Notifications
You must be signed in to change notification settings - Fork 3
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
Py separation #147
base: main
Are you sure you want to change the base?
Py separation #147
Conversation
…o the proposed new NeXus format for LoKI
Sorry, I have not seen your comment @wpotrzebowski earlier. |
src/ess/loki/nurf/utils.py
Outdated
I don't check for int because scipp does it. | ||
""" | ||
|
||
if not ('spectrum' and 'wavelength') in da.dims: |
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.
This condition only checks for the presence of 'wavelength'
.
>>> spectrum = {'spectrum': 1}
>>> wavelength = {'wavelength': 1}
>>> both = {'spectrum': 1, 'wavelength': 1}
>>> print(('spectrum' and 'wavelength') in spectrum)
False
>>> print(('spectrum' and 'wavelength') in wavelength)
True
>>> print(('spectrum' and 'wavelength') in both)
True
I think you meant to write if 'spectrum' not in da.dims or 'wavelength' not in da.dims
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.
Hi @dmytrokyrychuk
Thank you very much for pointing this out. I fell for a syntax that Python does not support. I replaced your suggestion with the issubset()
-method:
if not {'spectrum', 'wavelength'}.issubset(da.dims):
raise ValueError('Dimensions spectrum and wavelength expected.')
What do you think about this?
You are correct. I want both spectrum
and wavelength
as dimensions in the scipp.DataArray. Your suggestion would work, of course, too.
I should have implemented tests, but my contract finished.
In addition, I fixed changes in the API of scipp, in utils.py
, fluo.py
, 'uv.py'. But on the TODO list remain now some issues in the plot.py
.
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.
Your suggestion is valid. I like my suggestion because it reads like a sentence.
Please note that I am not affiliated with this project. I was simply stumbled upon this PR and reported an issue I noticed.
Here is my latest version for the NURF project.
There are 4 .py files
There are three .ipynb for demonstration, that need more cleaning, and the SANS version needs more TLC.
-fluo_demonstration.ipynb
-uv_demonstration.ipynb
-SANS_demonstration.ipynb
There is as well:
nurf_file_creator
function that outlines how NURF data should be organised in Nexus files.A future NURF module at ESS does not need these files because you will have your own Nexus files, but I provide them because the test files from ILL require them to convert the data to the new format.