Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions sigmet/au3_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ def find_start(series, user_start, user_end, ma_window=6):
assert(ma_window > 0, "Moving average window cannot be less than 1")
# filter series to window between start and end date, smooth moving average
# NOTE: we inclusively filter with user_start b/c when we run the differencing it will no longer be part of the series
filtered_series = series.rolling(ma_window).mean().loc[(
filtered_series = series.rolling(ma_window, min_periods=1).mean().loc[(
series.index >= user_start) & (series.index < user_end)]
if filtered_series.hasnans:
raise ValueError("Moving average value too large for search window. Decrease the moving_average value or increase the size of the search window.")

# special case if monotonic decreasing, want to check for largest first derivative
if filtered_series.is_monotonic_decreasing:
Expand Down
8 changes: 6 additions & 2 deletions sigmet/sigmet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, data):
# self.end_point = end_point
self.data = data

def fit(self, window_start, window_end, sarimax_params=(5, 1, 1), standardize=False, moving_average=1, force_start=False, recovery_threshold=0.9):
def fit(self, window_start=None, window_end=None, sarimax_params=(5, 1, 1), standardize=False, moving_average=1, force_start=False, recovery_threshold=0.9):
"""
Fits the model and returns a score representing the magnitude of the largest negative shock in the window.

Expand Down Expand Up @@ -47,7 +47,11 @@ def fit(self, window_start, window_end, sarimax_params=(5, 1, 1), standardize=Fa
"""

srs = self.data.copy(deep=True)


if window_start == None:
window_start = self.data.index[0]
if window_end == None:
window_end = self.data.index[-1]
if standardize == True:
srs = standardize(srs)

Expand Down