Skip to content

Commit

Permalink
Merge pull request #56 from scipp/neutron-ids
Browse files Browse the repository at this point in the history
Add ids to neutrons
  • Loading branch information
nvaytet authored Oct 7, 2024
2 parents 5c855ef + 52e65b1 commit 6c50516
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ skip-string-normalization = true
[tool.isort]
skip_gitignore = true
profile = "black"

[tool.ruff.format]
quote-style = "preserve"
9 changes: 9 additions & 0 deletions src/tof/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ def __init__(
"time": pulse_params["time"],
"wavelength": pulse_params["wavelength"],
"speed": pulse_params["speed"],
"id": sc.arange("event", pulse_params["time"].size, unit=None).fold(
"event", sizes=pulse_params["time"].sizes
),
},
)

Expand Down Expand Up @@ -270,6 +273,9 @@ def from_neutrons(
"time": birth_times,
"wavelength": wavelengths,
"speed": wavelength_to_speed(wavelengths).to(unit="m/s", copy=False),
"id": sc.arange("event", birth_times.size, unit=None).fold(
"event", sizes=birth_times.sizes
),
},
)

Expand Down Expand Up @@ -326,6 +332,9 @@ def from_distribution(
"time": pulse_params["time"],
"wavelength": pulse_params["wavelength"],
"speed": pulse_params["speed"],
"id": sc.arange("event", pulse_params["time"].size, unit=None).fold(
"event", sizes=pulse_params["time"].sizes
),
},
)
return source
Expand Down

0 comments on commit 6c50516

Please sign in to comment.