Skip to content

Commit

Permalink
Allowed for different combinations of scalar and list args to Perfect…
Browse files Browse the repository at this point in the history
…Intervention.
  • Loading branch information
djpasseyjr committed Sep 19, 2024
1 parent 35757ea commit 65c5fe5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions interfere/interventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 65c5fe5

Please sign in to comment.