add bkg count option in input

This commit is contained in:
Pim Nelissen
2026-04-21 10:53:53 +02:00
parent 8017159c5b
commit 591e2fb41a
5 changed files with 33 additions and 7 deletions

View File

@ -109,6 +109,7 @@ def calculate_counts_along_path(
detector: "Detector",
velocity: float,
points_per_segment: int = 10,
bkg_cps_input: int | None = None
) -> Tuple[np.ndarray, np.ndarray]:
"""Compute the counts recorded in each acquisition period in the landscape.
@ -116,6 +117,7 @@ def calculate_counts_along_path(
landscape (Landscape): _description_
detector (Detector): _description_
points_per_segment (int, optional): _description_. Defaults to 100.
bkg_cps_input (int | None, optional): Optional background CPS.
Returns:
Tuple[np.ndarray, np.ndarray]: Array of acquisition points and
@ -148,9 +150,17 @@ def calculate_counts_along_path(
landscape, full_positions, detector
)
bkg = generate_background(
cps, detector, landscape.point_sources[0].isotope.E
)
if bkg_cps_input is None:
bkg = generate_background(
cps, detector, landscape.point_sources[0].isotope.E
)
elif bkg_cps_input == 0:
bkg = bkg_cps_input
else:
bkg = generate_background(
cps, detector, landscape.point_sources[0].isotope.E,
lam_inp=bkg_cps_input
)
cps_with_bg = cps + bkg
# reshape so each segment is on a row