Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add start and end times to QoI templates #609

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions pyciemss/ouu/qoi.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from typing import Dict, List
from typing import Dict, List, Optional

import numpy as np
import torch


def obs_nday_average_qoi(
samples: Dict[str, torch.Tensor], contexts: List, ndays: int = 7
samples: Dict[str, torch.Tensor],
contexts: List,
ndays: int = 7,
start_time: Optional[int] = None,
end_time: Optional[int] = None,
) -> np.ndarray:
"""
Return estimate of last n-day average of each sample.
Expand All @@ -18,7 +22,12 @@ def obs_nday_average_qoi(
return np.mean(dataQoI[:, -ndays:], axis=1)


def obs_max_qoi(samples: Dict[str, torch.Tensor], contexts: List) -> np.ndarray:
def obs_max_qoi(
samples: Dict[str, torch.Tensor],
contexts: List,
start_time: Optional[int] = None,
end_time: Optional[int] = None,
) -> np.ndarray:
"""
Return maximum value over simulated time.
samples is is the output from a Pyro Predictive object.
Expand Down
Loading