Skip to content

Commit 32b55c4

Browse files
minor
1 parent e0b0f88 commit 32b55c4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

hexsample/clustering.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,23 @@ def run(self, event: DigiEventSparse | DigiEventRectangular | DigiEventCircular)
115115
if isinstance(event, DigiEventSparse):
116116
pass
117117
if isinstance(event, DigiEventCircular):
118-
#If the readout is circular, we want to take all the neirest neighbors.
118+
# If the readout is circular, we want to take all the neirest neighbors.
119119
self.num_neighbors = HexagonalReadoutCircular.NUM_PIXELS - 1 # -1 is bc the central px is already considered
120120
col = [event.column]
121121
row = [event.row]
122-
adc_channel_order = []
122+
adc_channel_order = [self.grid.adc_channel(event.column, event.row)]
123123
# Taking the NN in logical coordinates ...
124124
for _col, _row in self.grid.neighbors(event.column, event.row):
125125
col.append(_col)
126126
row.append(_row)
127127
# ... transforming the coordinates of the NN in its corresponding ADC channel ...
128-
adc_channel_order.append(self.grid.adc_channel(_col, row))
128+
adc_channel_order.append(self.grid.adc_channel(_col, _row))
129129
# ... reordering the pha array for the correspondance (col[i], row[i]) with pha[i].
130130
pha = event.pha[adc_channel_order]
131+
# Converting lists into numpy arrays
132+
col = np.array(col)
133+
row = np.array(row)
134+
pha = np.array(pha)
131135
# pylint: disable = invalid-name
132136
if isinstance(event, DigiEventRectangular):
133137
seed_col, seed_row = event.highest_pixel()
@@ -139,6 +143,7 @@ def run(self, event: DigiEventSparse | DigiEventRectangular | DigiEventCircular)
139143
col = np.array(col)
140144
row = np.array(row)
141145
pha = np.array([event(_col, _row) for _col, _row in zip(col, row)])
146+
# Zero suppressing the event (whatever the readout type)...
142147
pha = self.zero_suppress(pha)
143148
# Array indexes in order of decreasing pha---note that we use -pha to
144149
# trick argsort into sorting values in decreasing order.

0 commit comments

Comments
 (0)