Skip to content
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 some unit tests #23

Merged
merged 15 commits into from
Apr 27, 2023
Merged

Add some unit tests #23

merged 15 commits into from
Apr 27, 2023

Conversation

nvaytet
Copy link
Member

@nvaytet nvaytet commented Apr 26, 2023

Fix #12

@nvaytet nvaytet marked this pull request as ready for review April 27, 2023 08:57
phase=0.0 * deg,
distance=1.0 * meter,
)
assert chopper.omega == (2.0 * rad * sc.constants.pi) * f
Copy link
Member

Choose a reason for hiding this comment

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

Define two_pi on top?

open=sc.array(dims=['cutout'], values=[10.0], unit='deg'),
close=sc.array(dims=['cutout'], values=[20.0], unit='deg'),
phase=0.0 * deg,
distance=1.0 * meter,
Copy link
Member

Choose a reason for hiding this comment

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

Having a factor(?) of 1 is bad for tests, since it it hard to tell whether it was missed or accidentally included in an equation.

Comment on lines +214 to +231
def test_neutron_conservation():
N = 100_000
pulse = tof.Pulse(neutrons=N, kind='ess')

chopper1 = make_chopper(
topen=[5.0 * ms],
tclose=[16.0 * ms],
f=10.0 * Hz,
phase=0.0 * deg,
distance=10 * meter,
name="chopper1",
)
chopper2 = make_chopper(
topen=[9.0 * ms, 15.0 * ms],
tclose=[15.0 * ms, 20.0 * ms],
f=15.0 * Hz,
phase=0.0 * deg,
distance=15 * meter,
Copy link
Member

Choose a reason for hiding this comment

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

Could parametrize this, or consider using hypothesis in the future?

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 for hypothesis in the future

Copy link
Member Author

Choose a reason for hiding this comment

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

See #25

@nvaytet nvaytet mentioned this pull request Apr 27, 2023
@nvaytet nvaytet merged commit 1eeff78 into main Apr 27, 2023
@nvaytet nvaytet deleted the some_tests branch April 27, 2023 13:41
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.

Unit tests needed
2 participants