From 389a124ae93eb72aa3ca67ec388a1c6c671c6729 Mon Sep 17 00:00:00 2001 From: Matthew K Defenderfer <mdefende@uab.edu> Date: Thu, 1 May 2025 14:41:19 -0500 Subject: [PATCH] fix logic for dealing with naked integers in prep_age_distribution --- src/rc_gpfs/utils/core.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rc_gpfs/utils/core.py b/src/rc_gpfs/utils/core.py index 1409d4f..2596c4c 100644 --- a/src/rc_gpfs/utils/core.py +++ b/src/rc_gpfs/utils/core.py @@ -70,9 +70,11 @@ def prep_age_distribution( age_breakpoints: int | List[int], time_unit: Literal['D','W'] ) -> Tuple[List[np.datetime64],List[str]]: - if any([b < 0 for b in age_breakpoints]): - raise ValueError("Timestamp cannot be newer than the current date time") - age_breakpoints = list(set(age_breakpoints)) + if not isinstance(age_breakpoints,list): + age_breakpoints = [age_breakpoints] + else: + age_breakpoints = list(set(age_breakpoints)) + age_breakpoints.sort() age_breakpoints = [t for t in age_breakpoints if t > 0] -- GitLab