Skip to content

Commit

Permalink
Fix case where events is specified in construction
Browse files Browse the repository at this point in the history
  • Loading branch information
teubert committed Jul 23, 2024
1 parent b8c5a5f commit 3e58d90
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/progpy/predictors/monte_carlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,20 @@ def predict(self, state: UncertainData, future_loading_eqn: Callable=None, event
if events is None:
# Predict to all events
# change to list because of limits of jsonify
events = list(self.model.events)
if 'events' in params and params['events'] is not None:
# Set at a model level
events = list(params['events'])
else:
# Otherwise, all events
events = list(self.model.events)
if len(events) == 0 and 'horizon' not in params:
raise ValueError("If specifying no event (i.e., simulate to time), must specify horizon")

if 'events' in params:
# Params is provided as a argument in construction
# Remove it so it's not passed to simulate_to*
def params['events']

# Sample from state if n_samples specified or state is not UnweightedSamples (Case 2)
# Or if is Unweighted samples, but there are the wrong number of samples (Case 1)
if (
Expand Down

0 comments on commit 3e58d90

Please sign in to comment.