Spaces:
Paused
Paused
Support interactive synthetic cohorts, MLP resampling and configurable binned VPCs (part 2)
Browse files- synthetic_priors/simulation/__pycache__/pd.cpython-311.pyc +0 -0
- synthetic_priors/simulation/__pycache__/protocols.cpython-311.pyc +0 -0
- synthetic_priors/simulation/__pycache__/time_gauge.cpython-311.pyc +0 -0
- synthetic_priors/simulation/__pycache__/types.cpython-311.pyc +0 -0
- synthetic_priors/simulation/__pycache__/v1.cpython-311.pyc +0 -0
- synthetic_priors/simulation/__pycache__/views.cpython-311.pyc +0 -0
- synthetic_priors/simulation/arms.py +7 -6
- synthetic_priors/simulation/integrators.py +44 -20
- synthetic_priors/simulation/protocols.py +5 -6
synthetic_priors/simulation/__pycache__/pd.cpython-311.pyc
ADDED
|
Binary file (10.8 kB). View file
|
|
|
synthetic_priors/simulation/__pycache__/protocols.cpython-311.pyc
ADDED
|
Binary file (3.92 kB). View file
|
|
|
synthetic_priors/simulation/__pycache__/time_gauge.cpython-311.pyc
ADDED
|
Binary file (7.08 kB). View file
|
|
|
synthetic_priors/simulation/__pycache__/types.cpython-311.pyc
ADDED
|
Binary file (2.01 kB). View file
|
|
|
synthetic_priors/simulation/__pycache__/v1.cpython-311.pyc
ADDED
|
Binary file (3.9 kB). View file
|
|
|
synthetic_priors/simulation/__pycache__/views.cpython-311.pyc
ADDED
|
Binary file (2.97 kB). View file
|
|
|
synthetic_priors/simulation/arms.py
CHANGED
|
@@ -26,10 +26,11 @@ def simulate_arm(
|
|
| 26 |
) -> SimulationResult:
|
| 27 |
if not events:
|
| 28 |
raise ValueError("a dose arm requires at least one event")
|
| 29 |
-
durations =
|
| 30 |
-
if
|
| 31 |
-
raise ValueError("
|
| 32 |
-
|
|
|
|
| 33 |
times = np.asarray([event["time"] for event in events], dtype=float)
|
| 34 |
amounts = np.asarray([event["amount"] for event in events], dtype=float)
|
| 35 |
extent = population.bioavailability
|
|
@@ -38,11 +39,11 @@ def simulate_arm(
|
|
| 38 |
if scales.shape != extent.shape or not np.all(np.isfinite(scales)) or np.any(scales <= 0):
|
| 39 |
raise ValueError("individual dose scales must be finite, positive and patient-aligned")
|
| 40 |
extent = extent * scales
|
| 41 |
-
dense_tau = protocol_grid(1.0, times, duration
|
| 42 |
amount, diagnostics = integrate_batch_converged(
|
| 43 |
system, population.rate_multipliers, dense_tau,
|
| 44 |
n_steps=480 if len(events) > 1 else 240,
|
| 45 |
-
dose_times=times, dose_amps=amounts, infusion_dur=duration
|
| 46 |
dose_extent=extent,
|
| 47 |
rtol=numerics.integration_rtol, atol=numerics.integration_atol,
|
| 48 |
max_refinements=numerics.max_grid_refinements,
|
|
|
|
| 26 |
) -> SimulationResult:
|
| 27 |
if not events:
|
| 28 |
raise ValueError("a dose arm requires at least one event")
|
| 29 |
+
durations = np.asarray([float(event.get("duration", 0.0)) for event in events])
|
| 30 |
+
if not np.all(np.isfinite(durations)) or np.any(durations < 0):
|
| 31 |
+
raise ValueError("dose durations must be finite and non-negative")
|
| 32 |
+
# Preserve the scalar production path for historical equal-duration arms.
|
| 33 |
+
duration = float(durations[0]) if np.all(durations == durations[0]) else durations
|
| 34 |
times = np.asarray([event["time"] for event in events], dtype=float)
|
| 35 |
amounts = np.asarray([event["amount"] for event in events], dtype=float)
|
| 36 |
extent = population.bioavailability
|
|
|
|
| 39 |
if scales.shape != extent.shape or not np.all(np.isfinite(scales)) or np.any(scales <= 0):
|
| 40 |
raise ValueError("individual dose scales must be finite, positive and patient-aligned")
|
| 41 |
extent = extent * scales
|
| 42 |
+
dense_tau = protocol_grid(1.0, times, duration, numerics.dense_grid_size)
|
| 43 |
amount, diagnostics = integrate_batch_converged(
|
| 44 |
system, population.rate_multipliers, dense_tau,
|
| 45 |
n_steps=480 if len(events) > 1 else 240,
|
| 46 |
+
dose_times=times, dose_amps=amounts, infusion_dur=duration,
|
| 47 |
dose_extent=extent,
|
| 48 |
rtol=numerics.integration_rtol, atol=numerics.integration_atol,
|
| 49 |
max_refinements=numerics.max_grid_refinements,
|
synthetic_priors/simulation/integrators.py
CHANGED
|
@@ -153,12 +153,28 @@ def _system_time_knots(sp: SystemParams, horizon: float) -> np.ndarray:
|
|
| 153 |
values = np.asarray(knots, dtype=float)
|
| 154 |
return values[np.isfinite(values) & (values >= 0) & (values <= horizon)]
|
| 155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
def _integration_grid(
|
| 157 |
sp: SystemParams,
|
| 158 |
tau_eval: np.ndarray,
|
| 159 |
n_steps: int,
|
| 160 |
dose_times: np.ndarray,
|
| 161 |
-
infusion_dur:
|
| 162 |
) -> np.ndarray:
|
| 163 |
"""Combine a uniform accuracy grid with every discontinuity and output time."""
|
| 164 |
horizon = float(tau_eval[-1])
|
|
@@ -168,8 +184,8 @@ def _integration_grid(
|
|
| 168 |
return np.array([0.0])
|
| 169 |
pieces = [np.linspace(0.0, horizon, n_steps + 1), tau_eval, dose_times]
|
| 170 |
pieces.append(_system_time_knots(sp, horizon))
|
| 171 |
-
if infusion_dur is not None and infusion_dur > 0:
|
| 172 |
-
pieces.append(np.clip(dose_times +
|
| 173 |
return np.unique(np.concatenate(pieces))
|
| 174 |
|
| 175 |
def _next_refined_step_count(
|
|
@@ -177,7 +193,7 @@ def _next_refined_step_count(
|
|
| 177 |
tau_eval: np.ndarray,
|
| 178 |
current_steps: int,
|
| 179 |
dose_times: Optional[np.ndarray],
|
| 180 |
-
infusion_dur:
|
| 181 |
) -> int:
|
| 182 |
"""Choose a base grid that halves the largest interval actually integrated.
|
| 183 |
|
|
@@ -206,9 +222,13 @@ def _infusion_rates(
|
|
| 206 |
t: float,
|
| 207 |
dose_times: np.ndarray,
|
| 208 |
dose_amps: np.ndarray,
|
| 209 |
-
infusion_dur:
|
| 210 |
dose_map: dict,
|
| 211 |
) -> Dict[int, float]:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
if infusion_dur is None or infusion_dur <= 0:
|
| 213 |
return {}
|
| 214 |
active = (dose_times <= t) & (t < dose_times + infusion_dur)
|
|
@@ -220,7 +240,7 @@ def _infusion_rates(
|
|
| 220 |
def integrate_batch(
|
| 221 |
sp: SystemParams, kappa_mult: np.ndarray, tau_eval: np.ndarray, n_steps: int = 240,
|
| 222 |
dose_times: Optional[np.ndarray] = None, dose_amps: Optional[np.ndarray] = None,
|
| 223 |
-
infusion_dur:
|
| 224 |
return_mass_defect: bool = False,
|
| 225 |
):
|
| 226 |
"""One fixed-grid exponential-Euler solve for a batch of individuals.
|
|
@@ -237,18 +257,20 @@ def integrate_batch(
|
|
| 237 |
tau, multipliers, extent, all_dose_times, all_dose_amps = _prepare_batch_inputs(
|
| 238 |
sp, kappa_mult, tau_eval, dose_times, dose_amps, dose_extent,
|
| 239 |
)
|
| 240 |
-
|
| 241 |
-
raise ValueError("infusion_dur must be finite and non-negative")
|
| 242 |
|
| 243 |
n_individuals = multipliers.shape[0]
|
| 244 |
n_nodes = sp.graph.n_nodes
|
| 245 |
grid = _integration_grid(sp, tau, n_steps, all_dose_times, infusion_dur)
|
| 246 |
dose_map = sp.graph.dose_map()
|
| 247 |
-
|
|
|
|
|
|
|
|
|
|
| 248 |
|
| 249 |
bolus_at_index: Dict[int, float] = {}
|
| 250 |
if not infusing:
|
| 251 |
-
for dose_time, amplitude in zip(
|
| 252 |
if dose_time <= 0:
|
| 253 |
continue
|
| 254 |
index = int(np.searchsorted(grid, dose_time))
|
|
@@ -257,7 +279,7 @@ def integrate_batch(
|
|
| 257 |
state = np.zeros((n_individuals, n_nodes))
|
| 258 |
mass_defect = np.zeros(n_individuals)
|
| 259 |
if not infusing:
|
| 260 |
-
initial_amplitude = float(
|
| 261 |
for node, fraction in dose_map.items():
|
| 262 |
state[:, node] = float(fraction) * initial_amplitude * extent
|
| 263 |
|
|
@@ -334,7 +356,7 @@ def integrate_batch_reference(
|
|
| 334 |
tau_eval: np.ndarray,
|
| 335 |
dose_times: Optional[np.ndarray] = None,
|
| 336 |
dose_amps: Optional[np.ndarray] = None,
|
| 337 |
-
infusion_dur:
|
| 338 |
dose_extent: Optional[np.ndarray] = None,
|
| 339 |
*,
|
| 340 |
method: str = "Radau",
|
|
@@ -350,17 +372,19 @@ def integrate_batch_reference(
|
|
| 350 |
tau, multipliers, extent, all_dose_times, all_dose_amps = _prepare_batch_inputs(
|
| 351 |
sp, kappa_mult, tau_eval, dose_times, dose_amps, dose_extent,
|
| 352 |
)
|
| 353 |
-
|
| 354 |
-
raise ValueError("infusion_dur must be finite and non-negative")
|
| 355 |
if rtol <= 0 or atol <= 0:
|
| 356 |
raise ValueError("reference tolerances must be positive")
|
| 357 |
|
| 358 |
horizon = float(tau[-1])
|
| 359 |
dose_map = sp.graph.dose_map()
|
| 360 |
-
|
|
|
|
|
|
|
|
|
|
| 361 |
boundaries = [np.array([0.0, horizon]), all_dose_times, _system_time_knots(sp, horizon)]
|
| 362 |
-
if
|
| 363 |
-
boundaries.append(np.clip(all_dose_times +
|
| 364 |
segment_grid = np.unique(np.concatenate(boundaries))
|
| 365 |
segment_grid = segment_grid[(segment_grid >= 0) & (segment_grid <= horizon)]
|
| 366 |
|
|
@@ -370,7 +394,7 @@ def integrate_batch_reference(
|
|
| 370 |
individual_extent = float(extent[individual])
|
| 371 |
state = np.zeros(sp.graph.n_nodes)
|
| 372 |
if not infusing:
|
| 373 |
-
initial_amplitude = float(
|
| 374 |
for node, fraction in dose_map.items():
|
| 375 |
state[node] = float(fraction) * initial_amplitude * individual_extent
|
| 376 |
output[individual, tau == 0] = state[sp.graph.central]
|
|
@@ -414,7 +438,7 @@ def integrate_batch_reference(
|
|
| 414 |
state = np.clip(state, 0.0, None)
|
| 415 |
|
| 416 |
if not infusing:
|
| 417 |
-
amplitude = float(
|
| 418 |
if amplitude:
|
| 419 |
for node, fraction in dose_map.items():
|
| 420 |
state[node] += float(fraction) * amplitude * individual_extent
|
|
@@ -442,7 +466,7 @@ def integrate_batch_converged(
|
|
| 442 |
n_steps: int = 240,
|
| 443 |
dose_times: Optional[np.ndarray] = None,
|
| 444 |
dose_amps: Optional[np.ndarray] = None,
|
| 445 |
-
infusion_dur:
|
| 446 |
dose_extent: Optional[np.ndarray] = None,
|
| 447 |
*,
|
| 448 |
rtol: float = 2e-3,
|
|
|
|
| 153 |
values = np.asarray(knots, dtype=float)
|
| 154 |
return values[np.isfinite(values) & (values >= 0) & (values <= horizon)]
|
| 155 |
|
| 156 |
+
def _validated_duration(duration, dose_times, horizon):
|
| 157 |
+
if duration is None:
|
| 158 |
+
return None
|
| 159 |
+
value = np.asarray(duration, dtype=float)
|
| 160 |
+
if value.ndim > 1 or not np.all(np.isfinite(value)) or np.any(value < 0):
|
| 161 |
+
raise ValueError("infusion_dur must be finite and non-negative")
|
| 162 |
+
if value.ndim == 0:
|
| 163 |
+
return float(value)
|
| 164 |
+
times = np.asarray(dose_times, dtype=float)
|
| 165 |
+
if (times.ndim != 1 or value.shape != times.shape or not times.size
|
| 166 |
+
or times[0] != 0 or np.any(np.diff(times) < 0)
|
| 167 |
+
or np.any(times > horizon)):
|
| 168 |
+
raise ValueError("per-dose durations require aligned, ordered dose times starting at zero within the horizon")
|
| 169 |
+
return value
|
| 170 |
+
|
| 171 |
+
|
| 172 |
def _integration_grid(
|
| 173 |
sp: SystemParams,
|
| 174 |
tau_eval: np.ndarray,
|
| 175 |
n_steps: int,
|
| 176 |
dose_times: np.ndarray,
|
| 177 |
+
infusion_dur: float | np.ndarray | None,
|
| 178 |
) -> np.ndarray:
|
| 179 |
"""Combine a uniform accuracy grid with every discontinuity and output time."""
|
| 180 |
horizon = float(tau_eval[-1])
|
|
|
|
| 184 |
return np.array([0.0])
|
| 185 |
pieces = [np.linspace(0.0, horizon, n_steps + 1), tau_eval, dose_times]
|
| 186 |
pieces.append(_system_time_knots(sp, horizon))
|
| 187 |
+
if infusion_dur is not None and np.any(np.asarray(infusion_dur) > 0):
|
| 188 |
+
pieces.append(np.clip(dose_times + infusion_dur, 0.0, horizon))
|
| 189 |
return np.unique(np.concatenate(pieces))
|
| 190 |
|
| 191 |
def _next_refined_step_count(
|
|
|
|
| 193 |
tau_eval: np.ndarray,
|
| 194 |
current_steps: int,
|
| 195 |
dose_times: Optional[np.ndarray],
|
| 196 |
+
infusion_dur: float | np.ndarray | None,
|
| 197 |
) -> int:
|
| 198 |
"""Choose a base grid that halves the largest interval actually integrated.
|
| 199 |
|
|
|
|
| 222 |
t: float,
|
| 223 |
dose_times: np.ndarray,
|
| 224 |
dose_amps: np.ndarray,
|
| 225 |
+
infusion_dur: float | np.ndarray | None,
|
| 226 |
dose_map: dict,
|
| 227 |
) -> Dict[int, float]:
|
| 228 |
+
if isinstance(infusion_dur, np.ndarray):
|
| 229 |
+
active = (infusion_dur > 0) & (dose_times <= t) & (t < dose_times + infusion_dur)
|
| 230 |
+
rate = float(np.sum(dose_amps[active] / infusion_dur[active]))
|
| 231 |
+
return {node: float(frac) * rate for node, frac in dose_map.items()} if rate else {}
|
| 232 |
if infusion_dur is None or infusion_dur <= 0:
|
| 233 |
return {}
|
| 234 |
active = (dose_times <= t) & (t < dose_times + infusion_dur)
|
|
|
|
| 240 |
def integrate_batch(
|
| 241 |
sp: SystemParams, kappa_mult: np.ndarray, tau_eval: np.ndarray, n_steps: int = 240,
|
| 242 |
dose_times: Optional[np.ndarray] = None, dose_amps: Optional[np.ndarray] = None,
|
| 243 |
+
infusion_dur: float | np.ndarray | None = None, dose_extent: Optional[np.ndarray] = None,
|
| 244 |
return_mass_defect: bool = False,
|
| 245 |
):
|
| 246 |
"""One fixed-grid exponential-Euler solve for a batch of individuals.
|
|
|
|
| 257 |
tau, multipliers, extent, all_dose_times, all_dose_amps = _prepare_batch_inputs(
|
| 258 |
sp, kappa_mult, tau_eval, dose_times, dose_amps, dose_extent,
|
| 259 |
)
|
| 260 |
+
infusion_dur = _validated_duration(infusion_dur, dose_times, float(tau[-1]))
|
|
|
|
| 261 |
|
| 262 |
n_individuals = multipliers.shape[0]
|
| 263 |
n_nodes = sp.graph.n_nodes
|
| 264 |
grid = _integration_grid(sp, tau, n_steps, all_dose_times, infusion_dur)
|
| 265 |
dose_map = sp.graph.dose_map()
|
| 266 |
+
durations = np.broadcast_to(0.0 if infusion_dur is None else infusion_dur, all_dose_times.shape)
|
| 267 |
+
bolus_times = all_dose_times[durations == 0]
|
| 268 |
+
bolus_amps = all_dose_amps[durations == 0]
|
| 269 |
+
infusing = not len(bolus_times)
|
| 270 |
|
| 271 |
bolus_at_index: Dict[int, float] = {}
|
| 272 |
if not infusing:
|
| 273 |
+
for dose_time, amplitude in zip(bolus_times, bolus_amps, strict=False):
|
| 274 |
if dose_time <= 0:
|
| 275 |
continue
|
| 276 |
index = int(np.searchsorted(grid, dose_time))
|
|
|
|
| 279 |
state = np.zeros((n_individuals, n_nodes))
|
| 280 |
mass_defect = np.zeros(n_individuals)
|
| 281 |
if not infusing:
|
| 282 |
+
initial_amplitude = float(bolus_amps[bolus_times == 0].sum())
|
| 283 |
for node, fraction in dose_map.items():
|
| 284 |
state[:, node] = float(fraction) * initial_amplitude * extent
|
| 285 |
|
|
|
|
| 356 |
tau_eval: np.ndarray,
|
| 357 |
dose_times: Optional[np.ndarray] = None,
|
| 358 |
dose_amps: Optional[np.ndarray] = None,
|
| 359 |
+
infusion_dur: float | np.ndarray | None = None,
|
| 360 |
dose_extent: Optional[np.ndarray] = None,
|
| 361 |
*,
|
| 362 |
method: str = "Radau",
|
|
|
|
| 372 |
tau, multipliers, extent, all_dose_times, all_dose_amps = _prepare_batch_inputs(
|
| 373 |
sp, kappa_mult, tau_eval, dose_times, dose_amps, dose_extent,
|
| 374 |
)
|
| 375 |
+
infusion_dur = _validated_duration(infusion_dur, dose_times, float(tau[-1]))
|
|
|
|
| 376 |
if rtol <= 0 or atol <= 0:
|
| 377 |
raise ValueError("reference tolerances must be positive")
|
| 378 |
|
| 379 |
horizon = float(tau[-1])
|
| 380 |
dose_map = sp.graph.dose_map()
|
| 381 |
+
durations = np.broadcast_to(0.0 if infusion_dur is None else infusion_dur, all_dose_times.shape)
|
| 382 |
+
bolus_times = all_dose_times[durations == 0]
|
| 383 |
+
bolus_amps = all_dose_amps[durations == 0]
|
| 384 |
+
infusing = not len(bolus_times)
|
| 385 |
boundaries = [np.array([0.0, horizon]), all_dose_times, _system_time_knots(sp, horizon)]
|
| 386 |
+
if infusion_dur is not None and np.any(durations > 0):
|
| 387 |
+
boundaries.append(np.clip(all_dose_times + infusion_dur, 0.0, horizon))
|
| 388 |
segment_grid = np.unique(np.concatenate(boundaries))
|
| 389 |
segment_grid = segment_grid[(segment_grid >= 0) & (segment_grid <= horizon)]
|
| 390 |
|
|
|
|
| 394 |
individual_extent = float(extent[individual])
|
| 395 |
state = np.zeros(sp.graph.n_nodes)
|
| 396 |
if not infusing:
|
| 397 |
+
initial_amplitude = float(bolus_amps[bolus_times == 0].sum())
|
| 398 |
for node, fraction in dose_map.items():
|
| 399 |
state[node] = float(fraction) * initial_amplitude * individual_extent
|
| 400 |
output[individual, tau == 0] = state[sp.graph.central]
|
|
|
|
| 438 |
state = np.clip(state, 0.0, None)
|
| 439 |
|
| 440 |
if not infusing:
|
| 441 |
+
amplitude = float(bolus_amps[bolus_times == right].sum())
|
| 442 |
if amplitude:
|
| 443 |
for node, fraction in dose_map.items():
|
| 444 |
state[node] += float(fraction) * amplitude * individual_extent
|
|
|
|
| 466 |
n_steps: int = 240,
|
| 467 |
dose_times: Optional[np.ndarray] = None,
|
| 468 |
dose_amps: Optional[np.ndarray] = None,
|
| 469 |
+
infusion_dur: float | np.ndarray | None = None,
|
| 470 |
dose_extent: Optional[np.ndarray] = None,
|
| 471 |
*,
|
| 472 |
rtol: float = 2e-3,
|
synthetic_priors/simulation/protocols.py
CHANGED
|
@@ -2,8 +2,6 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import Optional
|
| 6 |
-
|
| 7 |
import numpy as np
|
| 8 |
|
| 9 |
|
|
@@ -29,7 +27,7 @@ def sample_dose_schedule(n_doses, interval, config, rng):
|
|
| 29 |
def protocol_grid(
|
| 30 |
horizon: float,
|
| 31 |
dose_times: np.ndarray,
|
| 32 |
-
infusion_duration:
|
| 33 |
nominal_size: int,
|
| 34 |
) -> np.ndarray:
|
| 35 |
"""Return an event-aware evaluation grid with post-dose logarithmic resolution."""
|
|
@@ -38,9 +36,10 @@ def protocol_grid(
|
|
| 38 |
positive = np.geomspace(max(horizon * 1e-7, 1e-10), horizon, n_global - 1)
|
| 39 |
pieces = [np.array([0.0]), positive, np.linspace(0.0, horizon, max(32, n_global // 3))]
|
| 40 |
local = np.geomspace(1e-7, 1.0, 64)
|
| 41 |
-
|
|
|
|
| 42 |
pieces.extend((dose_time + local, np.array([dose_time])))
|
| 43 |
-
if
|
| 44 |
-
pieces.append(np.array([dose_time +
|
| 45 |
grid = np.unique(np.concatenate(pieces))
|
| 46 |
return grid[(grid >= 0.0) & (grid <= horizon)]
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
|
|
|
|
|
|
| 5 |
import numpy as np
|
| 6 |
|
| 7 |
|
|
|
|
| 27 |
def protocol_grid(
|
| 28 |
horizon: float,
|
| 29 |
dose_times: np.ndarray,
|
| 30 |
+
infusion_duration: float | np.ndarray | None,
|
| 31 |
nominal_size: int,
|
| 32 |
) -> np.ndarray:
|
| 33 |
"""Return an event-aware evaluation grid with post-dose logarithmic resolution."""
|
|
|
|
| 36 |
positive = np.geomspace(max(horizon * 1e-7, 1e-10), horizon, n_global - 1)
|
| 37 |
pieces = [np.array([0.0]), positive, np.linspace(0.0, horizon, max(32, n_global // 3))]
|
| 38 |
local = np.geomspace(1e-7, 1.0, 64)
|
| 39 |
+
durations = np.broadcast_to(0.0 if infusion_duration is None else infusion_duration, np.shape(dose_times))
|
| 40 |
+
for dose_time, duration in zip(np.asarray(dose_times, dtype=float), durations, strict=True):
|
| 41 |
pieces.extend((dose_time + local, np.array([dose_time])))
|
| 42 |
+
if duration > 0:
|
| 43 |
+
pieces.append(np.array([dose_time + duration]))
|
| 44 |
grid = np.unique(np.concatenate(pieces))
|
| 45 |
return grid[(grid >= 0.0) & (grid <= horizon)]
|