-
Couldn't load subscription status.
- Fork 3
Update to scippneutron=0.8 #136
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
| # Turn warnings into errors | ||
| warning_is_error = True |
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 also this in the pytest config: https://github.com/scipp/scipp/blob/c776d04616a36480968e9f6e3905aa62d1b59719/pyproject.toml#L25-L28
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.
hmm we need to be using tox for this (I think?), which ess is currently still not using.
That said, would this raise errors only in the python tests?
I don't really understand why the warnings raised by the notebooks did not fail the docs build...
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 tox? This is just a pytest option (in can also be configured in other config files).
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.
ok, my mistake, i thought the pyproject file was a tox thing.
| out = wav.rebin(wavelength=sc.linspace( | ||
| dim='wavelength', start=1.0, stop=10.0, num=1001, unit='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.
| out = wav.rebin(wavelength=sc.linspace( | |
| dim='wavelength', start=1.0, stop=10.0, num=1001, unit='angstrom')) | |
| out = wav.rebin(wavelength=1000) |
may be good enough for a test?
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 like it isn't. Test fails with your suggestion :-(
| sum_in_range = data.bin( | ||
| wavelength=sc.array(dims=['wavelength'], | ||
| values=[(lam - dlam).value, (lam + dlam).value], | ||
| unit=lam.unit)).hist().data['wavelength', 0] |
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.
Something like
| sum_in_range = data.bin( | |
| wavelength=sc.array(dims=['wavelength'], | |
| values=[(lam - dlam).value, (lam + dlam).value], | |
| unit=lam.unit)).hist().data['wavelength', 0] | |
| sum_in_range = data.hist(wavelength=sc.concat([lam - dlam, lam + dlam], 'wavelength']))data['wavelength', 0] |
unrelated, so ignore this is you like.
| "source": [ | ||
| "nbins = 165\n", | ||
| "theta_edges = sc.linspace(dim='theta', start=0.0, stop=1.2, num=nbins, unit='deg')\n", | ||
| "theta_edges = sc.linspace(dim='theta', start=0.0, stop=1.2, num=nbins, unit='deg').to_unit(theta_edges, 'rad')\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.
Something looks wrong here, mixing up function and method syntax for to_unit?
| assert len(w) == 1 | ||
| assert issubclass(w[-1].category, UserWarning) | ||
| assert 'orsopy' in str(w[-1].message) | ||
| array_normalized = corrections.normalize_by_counts(array) |
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 remove the asserts?
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.
Because there was no more warning, it got converted to an error and the length of w was now 0.
I didn't find an option in pytest to make this still work. So i decided that the check here is not that important, and the test is more about checking that the normalization is correct.
No description provided.