Skip to content

Commit dfd4c9f

Browse files
authored
Merge pull request #189 from DUNE/reflow-prep
Updates for latest data reflows
2 parents b595702 + c5172b2 commit dfd4c9f

File tree

10 files changed

+454
-20
lines changed

10 files changed

+454
-20
lines changed

data/fsd_flow/light_module_desc-6.0.1.yaml

Lines changed: 408 additions & 0 deletions
Large diffs are not rendered by default.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
'scikit-learn>=1.3.0',
2424
'h5flow>=0.2.0',
2525
'pylandau @ git+https://github.com/cuddandr/pylandau.git#egg=pylandau',
26-
'adc64format @ git+https://github.com/larpix/adc64format.git@v0.1.2#egg=adc64format',
26+
'adc64format @ git+https://github.com/larpix/adc64format.git@v0.1.3#egg=adc64format',
2727
]
2828
)

src/proto_nd_flow/reco/charge/raw_event_builder.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from h5flow.core import resources
1010

11-
from proto_nd_flow.util.array import fill_with_last
11+
from proto_nd_flow.util.array import fill_with_last, fill_with_next
1212

1313

1414
class RawEventBuilder(object):
@@ -147,11 +147,11 @@ def unroll_timestamps(self, packets: np.ndarray) -> np.ndarray:
147147
ts = (packets['timestamp'].astype('i8') % rollover_ticks) + offsets
148148

149149
# Timestamp packets require special treatment, since their timestamp
150-
# field is actually a unix timestamp. For these, we just subtract this
151-
# unix timestamp back out, so that their "ts" is the corresponding entry
152-
# of "offsets".
150+
# field is actually a unix timestamp. For these, we just assign the same
151+
# unrolled timestamp as the one in the next non-timestamp packet
153152
unix_mask = packets['packet_type'] == 4
154-
ts[unix_mask] -= packets[unix_mask]['timestamp'].astype('i8')
153+
ts[unix_mask] = -1
154+
ts = fill_with_next(ts, marker=-1)
155155

156156
return ts
157157

src/proto_nd_flow/reco/light/mpd_event_generator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def __init__(self, **params):
146146

147147
# skip to start position
148148
self.input_file.stream.seek(self.nbytes_runinfo, 0)
149+
self.input_file.skip(self.start_position)
149150

150151
def __len__(self):
151152
return (self.end_position - self.start_position) // (self.batch_size)

src/proto_nd_flow/util/array.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
import numpy as np
22

33

4-
def fill_with_last(arr: np.ndarray) -> np.ndarray:
4+
def fill_with_last(arr: np.ndarray, marker=0) -> np.ndarray:
55
'''
6-
Given an array ARR, copy it and replace all zeros with the last
7-
nonzero value. E.g.,
6+
Given an array ARR, copy it and replace all elements equal to MARKER
7+
(default: 0) with the last value that was not equal to MARKER. E.g.,
88
[3, 0, 0, 5, 0, 8, 0, 0, 0] => [3, 3, 3, 5, 5, 8, 8, 8, 8].
99
TODO: Replace with a faster implementation. (This one is based on
1010
the code that calculates unix_ts in raw_event_generator.py.)
1111
'''
12-
groups = np.split(arr, np.argwhere(arr).ravel())
12+
groups = np.split(arr, np.argwhere(arr != marker).ravel())
1313
# SLOW:
1414
groups = [np.full(len(group), group[0])
1515
for group in groups if len(group)]
1616
return np.concatenate(groups, axis=0)
17+
18+
19+
def fill_with_next(arr: np.ndarray, marker=0) -> np.ndarray:
20+
'''
21+
Given an array ARR, copy it and replace all elements equal to MARKER
22+
(default: 0) with the next value that is not equal to MARKER. E.g.,
23+
[0, 3, 0, 0, 5, 0, 8] => [3, 3, 5, 5, 5, 8, 8].
24+
TODO: Replace with a faster implementation.
25+
'''
26+
a = arr[::-1]
27+
a = fill_with_last(a, marker=marker)
28+
return a[::-1]

yamls/fsd_flow/reco/charge/RawEventGenerator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ params:
88
# configuration parameters
99
mc_tracks_dset_name: 'mc_truth/segments'
1010
buffer_size: 100000
11-
nhit_cut: 20
11+
nhit_cut: 5
1212
sync_noise_cut: [100, 11000000] # Stephen says no need to cut > first 10 usec
1313
sync_noise_cut_enabled: True
1414
event_builder_class: 'ExtTrigRawEventBuilder' #'SymmetricWindowRawEventBuilder'

yamls/fsd_flow/reco/light/SiPMHitFinder.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ params:
1212
# output
1313
hits_dset_name: 'light/sipm_hits' # new dataset to produce
1414

15+
#threshold: !include yamls/fsd_flow/reco/light/sipm_threshold.yaml
16+
threshold: 2
17+
1518
# configuration parameters
1619
near_samples: 4
1720
hit_level: 'sipm'
18-
19-
#threshold: !include yamls/fsd_flow/reco/light/sipm_threshold.yaml
20-
threshold: 2
21+
mad_factor: 5.0
22+
noise_factor: 5.0
23+
n_bins_rolled: 5
24+
rt_sqrt_factor: 5.0
25+
pe_weight: 1.0
26+
rising_edge: False
27+
local_maxima: True

yamls/fsd_flow/reco/light/SumHitFinder.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ params:
1212
# output
1313
hits_dset_name: 'light/sum_hits' # new dataset to produce
1414

15+
#threshold: !include yamls/fsd_flow/reco/light/sipm_threshold.yaml
16+
threshold: 4
17+
1518
# configuration parameters
1619
near_samples: 4
1720
hit_level: 'sum'
18-
19-
#threshold: !include yamls/fsd_flow/reco/light/sipm_threshold.yaml
20-
21-
threshold: 4
21+
mad_factor: 5.0
22+
noise_factor: 5.0
23+
n_bins_rolled: 5
24+
rt_sqrt_factor: 5.0
25+
pe_weight: 1.0
26+
rising_edge: False
27+
local_maxima: True

yamls/fsd_flow/resources/GeometryData.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ params:
88
# crs_geometry_to_module: [0,0,1,0]
99
crs_geometry_files: ['data/fsd_flow/multi_tile_layout-3.0.40_fsd_v3.yaml']
1010
crs_geometry_to_module: [0]
11-
lrs_geometry_file: 'data/fsd_flow/light_module_desc-6.0.0.yaml'
11+
lrs_geometry_file: 'data/fsd_flow/light_module_desc-6.0.1.yaml'
1212
beam_direction: 'z'
1313
drift_direction: 'x'
1414
network_agnostic: true

yamls/fsd_flow/resources/GeometryMC.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ params:
88
# crs_geometry_to_module: [0,0,1,0]
99
crs_geometry_files: ['data/fsd_flow/multi_tile_layout-3.0.40_NDLArModule_v3.yaml']
1010
crs_geometry_to_module: [0]
11-
lrs_geometry_file: 'data/fsd_flow/light_module_desc-6.0.0.yaml'
11+
lrs_geometry_file: 'data/fsd_flow/light_module_desc-6.0.1.yaml'
1212
beam_direction: 'z'
1313
drift_direction: 'x'
1414
network_agnostic: true

0 commit comments

Comments
 (0)