Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nvaytet
Copy link
Member

@nvaytet nvaytet commented Aug 2, 2022

No description provided.

@nvaytet nvaytet marked this pull request as draft August 2, 2022 12:58
@nvaytet nvaytet changed the title Update to Scipp=0.15 Update to scippneutron=0.8 Aug 2, 2022
Comment on lines +95 to +96
# Turn warnings into errors
warning_is_error = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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...

Copy link
Member

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).

Copy link
Member Author

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.

Comment on lines +98 to +99
out = wav.rebin(wavelength=sc.linspace(
dim='wavelength', start=1.0, stop=10.0, num=1001, unit='angstrom'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Copy link
Member Author

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 :-(

Comment on lines +119 to +122
sum_in_range = data.bin(
wavelength=sc.array(dims=['wavelength'],
values=[(lam - dlam).value, (lam + dlam).value],
unit=lam.unit)).hist().data['wavelength', 0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like

Suggested change
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",
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the asserts?

Copy link
Member Author

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.

@nvaytet nvaytet marked this pull request as ready for review August 3, 2022 11:38
@nvaytet nvaytet merged commit 4a16288 into main Aug 4, 2022
@nvaytet nvaytet deleted the update_to_scipp0.15 branch August 4, 2022 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants