From 65c5fe5a2454149ee17ba8a8d32d64a8f64cae8d Mon Sep 17 00:00:00 2001 From: DJ Passey Date: Thu, 19 Sep 2024 11:51:43 -0400 Subject: [PATCH] Allowed for different combinations of scalar and list args to PerfectIntervention. --- interfere/interventions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/interfere/interventions.py b/interfere/interventions.py index 6346a05..7f1a82b 100644 --- a/interfere/interventions.py +++ b/interfere/interventions.py @@ -150,11 +150,11 @@ def __init__( intervention([10.0, 4.0, 4.0], 0) == [1.6, 4.0, 0.7] # (True.) """ # The case where indexs and constants are floats or ints - if isinstance(intervened_idxs, int) and isinstance(constants, (int, float)): - i = intervened_idxs - c = float(constants) - intervened_idxs = [intervened_idxs] - constants = [c] + if isinstance(intervened_idxs, (int, float)): + intervened_idxs = [int(intervened_idxs)] + + if isinstance(constants, (int, float)): + constants = [float(constants)] if len(constants) != len(intervened_idxs): raise ValueError(