mirror of
https://github.com/pim-n/pg-rad
synced 2026-06-17 15:59:35 +02:00
hotfix: fix incorrect integration scheme, move to time integration as Bukartas 2021 doccomp.
This commit is contained in:
@ -108,6 +108,7 @@ def calculate_counts_along_path(
|
|||||||
landscape: "Landscape",
|
landscape: "Landscape",
|
||||||
detector: "Detector",
|
detector: "Detector",
|
||||||
velocity: float,
|
velocity: float,
|
||||||
|
t_acq: float,
|
||||||
points_per_segment: int = 10,
|
points_per_segment: int = 10,
|
||||||
bkg_cps_input: int | None = None,
|
bkg_cps_input: int | None = None,
|
||||||
seed: int | None = None
|
seed: int | None = None
|
||||||
@ -166,10 +167,26 @@ def calculate_counts_along_path(
|
|||||||
)
|
)
|
||||||
|
|
||||||
cps_with_bg = cps + bkg
|
cps_with_bg = cps + bkg
|
||||||
# reshape so each segment is on a row
|
|
||||||
cps_per_seg = cps_with_bg.reshape(num_segments, points_per_segment)
|
|
||||||
|
|
||||||
du = s[1] - s[0]
|
# Integrate along time dimension. see e.g. Bukartas (2021 doccomp.)
|
||||||
int_counts = np.trapezoid(cps_per_seg, dx=du, axis=1) / velocity
|
t = s / abs(velocity)
|
||||||
|
|
||||||
return original_distances[1:], s, cps_with_bg, int_counts, np.mean(bkg)
|
# acquisition bins
|
||||||
|
t_bins = np.arange(0, t[-1] + t_acq, t_acq)
|
||||||
|
|
||||||
|
int_counts = np.zeros(len(t_bins) - 1)
|
||||||
|
acq_points = np.zeros(len(t_bins) - 1)
|
||||||
|
|
||||||
|
for i in range(len(t_bins) - 1):
|
||||||
|
mask = (t >= t_bins[i]) & (t < t_bins[i + 1])
|
||||||
|
|
||||||
|
int_counts[i] = np.trapezoid(cps_with_bg[mask], t[mask])
|
||||||
|
acq_points[i] = np.mean(s[mask])
|
||||||
|
|
||||||
|
return (
|
||||||
|
acq_points[:-1],
|
||||||
|
s[:-1],
|
||||||
|
cps_with_bg[:-1],
|
||||||
|
int_counts[:-1],
|
||||||
|
np.mean(bkg)
|
||||||
|
)
|
||||||
|
|||||||
@ -49,6 +49,7 @@ class SimulationEngine:
|
|||||||
self.detector,
|
self.detector,
|
||||||
velocity=self.runtime_spec.speed,
|
velocity=self.runtime_spec.speed,
|
||||||
bkg_cps_input=self.sim_spec.bkg_cps,
|
bkg_cps_input=self.sim_spec.bkg_cps,
|
||||||
|
t_acq=self.runtime_spec.acquisition_time,
|
||||||
seed=self.sim_spec.seed
|
seed=self.sim_spec.seed
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user