PILArNetH5Dataset#
- class PILArNetH5Dataset(data_root: str | None = None, split='train', transform=None, test_mode=False, test_cfg=None, loop=1, ignore_index=-1, energy_threshold=0.0, min_points=1024, max_len=-1, remove_low_energy_scatters=False, old_pid_mapping=False, revision: Literal['v1', 'v2', 'v3'] = 'v2', overlay_n_events=1, overlay_prob=1.0, overlay_allow_repeats=True)[source]#
Bases:
PILArNetOverlayMixin,DatasetPILArNet-M LArTPC dataset read directly from clustered HDF5 shards.
Loads events straight from
point/cluster/cluster_extraHDF5 arrays (no per-event preprocessing), expands per-cluster truth to per-point arrays, and emits a flatdict. Standard keys per item:coord(N, 3),energy(N, 1, raw),segment_motif(N, 1, semantic class),segment_pid(N, 1, PID; v2/v3),momentum(N, 1; v2/v3),vertex(N, 3; v2/v3, interaction vertex in v3),is_primary(N, 1; v3 only),instance_particleandinstance_interaction(N, 1, remapped contiguous ids),segment_interaction(N, 1, background flag), plusname/split/revision. After collation a batch addsoffset. Registered asPILArNetH5Dataset– use astypeunderdata.train/data.val/data.test.Semantic classes (
segment_motif): 0 shower, 1 track, 2 Michel, 3 delta, 4 low-energy deposit. PID classes (segment_pid): 0 photon, 1 electron, 2 muon, 3 pion, 4 proton, 5 none/LED (6 whenold_pid_mapping).- Parameters:
data_root (str | None) – Root directory of the revision’s HDF5 shards. When
None, falls back to$PILARNET_DATA_ROOT_V1/_V2/_V3(byrevision) then to~/.cache/pimm/pilarnet/<revision>; raises if none exist. Defaults toNone.split (str | Sequence[str]) – Split name(s) used to glob
*<split>/*.h5underdata_root. Defaults to"train".transform (list[dict]) – List of transform configs (NOT a prebuilt
Compose). Defaults toNone.test_mode (bool) – Emit voxelized/augmented test fragments and force
loop = 1. Defaults toFalse.test_cfg (object) – Test config (
voxelize,crop,post_transform,aug_transform); required whentest_mode. Defaults toNone.loop (int) – Train-time epoch multiplier. Defaults to
1.ignore_index (int) – Ignored-label value. Defaults to
-1.energy_threshold (float) – Drop points with energy at or below this value when positive. Defaults to
0.0.min_points (int) – Minimum points per event; smaller events are excluded from the index. Defaults to
1024.max_len (int) – Cap on event count before the loop multiplier (-1 = no cap). Defaults to
-1.remove_low_energy_scatters (bool) – Drop the first (LED scatter) cluster and its points. Defaults to
False.old_pid_mapping (bool) – Map LED PID to
6instead of5. Defaults toFalse.revision ({"v1", "v2", "v3"}) – Dataset revision. v1 is the original PILArNet (no PID/momentum/vertex); v2 adds PID, momentum and particle vertices; v3 adds interaction-level vertices and primary-particle labels. Defaults to
"v2".overlay_n_events (int | tuple[int, int]) – Number (or inclusive range) of events to overlay into one point cloud;
> 1enables overlay. Defaults to1.overlay_prob (float) – Probability of applying overlay to a given sample. Defaults to
1.0.overlay_allow_repeats (bool) – Allow the same event to be sampled more than once when overlaying. Defaults to
True.
Note
Loader settings (
batch_size,num_worker) live at the top level of the config, not on the dataset constructor. Split membership differs between v1 and v2/v3, so a v1-trained model evaluated on v2/v3 (or vice versa) is not seeing a comparable split. Event overlay deduplicates colliding voxels by semantic priority (track > shower > Michel > delta > LED) and rotates overlaid events by random 90-degree increments.Example
>>> from pimm.datasets.builder import build_dataset >>> ds = build_dataset(dict(type="PILArNetH5Dataset", revision="v2", ... split="train", transform=[], min_points=1024)) >>> sample = ds[0] >>> sorted(sample)[:6] ['coord', 'energy', 'instance_interaction', 'instance_particle', 'momentum', 'name'] >>> sample["coord"].shape # (N, 3) float32 (7366, 3) >>> sample["segment_motif"].shape # (N, 1) semantic class (7366, 1) >>> # in a config: >>> # data = dict(train=dict(type="PILArNetH5Dataset", split="train", >>> # revision="v2", min_points=1024, transform=transform))
- get_data(idx)[source]#
Load a point cloud from h5 file.
Output dictionary: - coord: (N, 3) array of coordinates - energy: (N, 1) array of energies - momentum: (N, 1) array of particle momentum (v2/v3 only) - vertex: (N, 3) array of vertices (v2/v3 only; interaction vertex for v3) - is_primary: (N, 1) array of primary-particle flags (v3 only) - segment_motif: (N, 1) array of motif labels - segment_pid: (N, 1) array of PID labels (v2/v3 only) - instance_particle: (N, 1) array of particle instance labels - instance_interaction: (N, 1) array of interaction instance labels - segment_interaction: (N, 1) array of interaction labels