Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/essreduce/src/ess/reduce/live/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ def position_noise_for_cylindrical_pixel(
# fulfill this. However, the rest of the data reduction currently assumes that
# the pixel offset corresponds to the pixel center, so if it is not fulfilled
# there are bigger problems elsewhere anywhere.
rng = np.random.default_rng()
rng = np.random.default_rng(seed=1234)
dims = ('position',)
size = _noise_size
z_hat = axis / sc.norm(axis) # Unit vector along the cylinder axis
Expand Down
8 changes: 8 additions & 0 deletions packages/essreduce/tests/live/raw_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ def test_gaussian_position_noise_is_sigma_unit_independent(sigma: sc.Variable) -
assert sc.identical(noise, reference)


def test_position_noise_for_cylindrical_pixel_is_deterministic() -> None:
axis = raw.PixelCylinderAxis(sc.vector([0.0, 0.0, 1.0], unit='m'))
radius = raw.PixelCylinderRadius(sc.vector([0.5, 0.0, 0.0], unit='m'))
reference = raw.position_noise_for_cylindrical_pixel(axis=axis, radius=radius)
noise = raw.position_noise_for_cylindrical_pixel(axis=axis, radius=radius)
assert sc.identical(noise, reference)


def test_clear_counts_resets_counts_to_zero() -> None:
detector_number = sc.array(dims=['pixel'], values=[1, 2, 3], unit=None)
det = raw.Detector(detector_number)
Expand Down
Loading