Skip to content
Snippets Groups Projects
Commit cc45e8f2 authored by Danilo Enoque Ferreira de Lima's avatar Danilo Enoque Ferreira de Lima
Browse files

Subtract pedestal per pulse.

parent a9912b5a
No related tags found
1 merge request!29Per pulse pedestal subtraction
Pipeline #150805 passed
This commit is part of merge request !29. Comments created here will be created in the context of that merge request.
...@@ -508,10 +508,22 @@ class SelectRelevantLowResolution(TransformerMixin, BaseEstimator): ...@@ -508,10 +508,22 @@ class SelectRelevantLowResolution(TransformerMixin, BaseEstimator):
if self.delta_tof is not None: if self.delta_tof is not None:
first = max(0, self.tof_start - self.delta_tof) first = max(0, self.tof_start - self.delta_tof)
last = min(X[self.channels[0]].shape[1], self.tof_start + self.delta_tof) last = min(X[self.channels[0]].shape[1], self.tof_start + self.delta_tof)
y = {channel: [item[:, (first + delta):(last + delta)] - self.pedestal[channel] # subtract pedestal per channel, per pulse
for delta in pulse_spacing[channel]] for ch in channels:
for channel, item in X.items() # mean of test data, over ensemble
if channel in self.channels} mean_trace[ch] = X[ch].mean(0)
# for each pulse, get a pedestal and subtract it from the trace
for p in pulse_spacing[ch]:
# slice a pulse
s = slice(first + p - self.delta_tof - 1, first + p + self.delta_tof + 1)
# get first 10 points in pulse and take its average
pulse_pedestal = mean_trace[ch][s][:10].mean()
# subtract the pedestal from the trace
X[ch][:, s] = X[ch][:, s] - pulse_pedestal
# y = {channel: [item[:, (first + delta):(last + delta)] - self.pedestal[channel]
# for delta in pulse_spacing[channel]]
# for channel, item in X.items()
# if channel in self.channels}
# convert to Numpy if it is a Dask array # convert to Numpy if it is a Dask array
y = {ch: [item.compute().astype(np.float32) if isinstance(item, da.Array) else item.astype(np.float32) for item in v] y = {ch: [item.compute().astype(np.float32) if isinstance(item, da.Array) else item.astype(np.float32) for item in v]
for ch, v in y.items()} for ch, v in y.items()}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment