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
6 changes: 6 additions & 0 deletions src/reboost/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from __future__ import annotations

from .cli import cli

if __name__ == "__main__":
cli()
6 changes: 6 additions & 0 deletions src/reboost/optmap/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from __future__ import annotations

from .cli import optical_cli

if __name__ == "__main__":
optical_cli()
6 changes: 3 additions & 3 deletions src/reboost/optmap/convolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class OptmapForConvolve(NamedTuple):

def open_optmap(optmap_fn: str) -> OptmapForConvolve:
dets = lh5.ls(optmap_fn, "/channels/")
detidx = np.arange(0, dets.shape[0])
detidx = np.arange(0, len(dets))

optmap_all = lh5.read("/all/prob", optmap_fn)
assert isinstance(optmap_all, Histogram)
Expand Down Expand Up @@ -61,14 +61,14 @@ def open_optmap(optmap_fn: str) -> OptmapForConvolve:
raise ValueError(msg)
else:
detidx = np.array([OPTMAP_ANY_CH])
dets = np.array(["all"])
dets = ["all"]

# check the exponent from the optical map file
if "_hitcounts_exp" in lh5.ls(optmap_fn):
msg = "found _hitcounts_exp which is not supported any more"
raise RuntimeError(msg)

dets = [d.replace("/channels/", "") for d in dets]
dets = np.array([d.replace("/channels/", "") for d in dets])

return OptmapForConvolve(dets, detidx, optmap_edges, ow)

Expand Down
2 changes: 1 addition & 1 deletion src/reboost/optmap/mapview.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def _read_data(
histogram_choice: str = "prob",
) -> tuple[tuple[NDArray], NDArray]:
histogram = histogram_choice if histogram_choice != "prob_unc_rel" else "prob"
detid = f"channels/{detid}" if detid != all and not detid.startswith("channels/") else detid
detid = f"channels/{detid}" if detid != "all" and not detid.startswith("channels/") else detid

optmap_all = lh5.read(f"/{detid}/{histogram}", optmap_fn)
optmap_edges = tuple([b.edges for b in optmap_all.binning])
Expand Down
9 changes: 7 additions & 2 deletions src/reboost/spms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from __future__ import annotations

from .pe import detected_photoelectrons, emitted_scintillation_photons, load_optmap
from .pe import detected_photoelectrons, emitted_scintillation_photons, load_optmap, load_optmap_all

__all__ = ["detected_photoelectrons", "emitted_scintillation_photons", "load_optmap"]
__all__ = [
"detected_photoelectrons",
"emitted_scintillation_photons",
"load_optmap",
"load_optmap_all",
]
11 changes: 8 additions & 3 deletions src/reboost/spms/pe.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def detected_photoelectrons(
"""
hits = ak.Array(
{
"num_scint_ph": num_scint_ph,
"particle": particle,
"num_scint_ph": units_conv_ak(num_scint_ph, "dimensionless"),
"particle": units_conv_ak(particle, "dimensionless"),
"time": units_conv_ak(time, "ns"),
"xloc": units_conv_ak(xloc, "m"),
"yloc": units_conv_ak(yloc, "m"),
Expand Down Expand Up @@ -171,7 +171,12 @@ def emitted_scintillation_photons(
material
scintillating material name.
"""
hits = ak.Array({"edep": units_conv_ak(edep, "keV"), "particle": particle})
hits = ak.Array(
{
"edep": units_conv_ak(edep, "keV"),
"particle": units_conv_ak(particle, "dimensionless"),
}
)

scint_mat_params = convolve._get_scint_params(material)
ph = convolve.iterate_stepwise_depositions_scintillate(hits, scint_mat_params)
Expand Down
1 change: 1 addition & 0 deletions tests/hit/configs/spms.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
objects:
spms: "['S001', 'S002']"
optmap_test: reboost.spms.load_optmap_all(ARGS.optmap_path)

processing_groups:
- name: spms
Expand Down
1 change: 1 addition & 0 deletions tests/hit/test_build_hit.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ def test_spms(test_gen_lh5_scint, tmptestdir):
m.create_probability()
m.write_lh5(map_file, "channels/S001", "overwrite_file")
m.write_lh5(map_file, "channels/S002", "write_safe")
m.write_lh5(map_file, "all", "write_safe")

outfile = f"{tmptestdir}/spms_hit.lh5"
reboost.build_hit(
Expand Down
Loading