Skip to content

Commit 6c32060

Browse files
committed
Update default settings
1 parent eb44d9d commit 6c32060

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

_delphi_utils_python/delphi_utils/smooth.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818

1919
class Smoother:
2020
"""
21-
This is the smoothing utility class. It handles imputation and smoothing.
22-
Reasonable defaults are given for all the parameters, but fine-grained
21+
This is the smoothing utility class. It handles imputation and smoothing.
22+
Reasonable defaults are given for all the parameters, but fine-grained
2323
control is exposed.
24-
24+
2525
Instantiating a smoother class specifies a smoother with a host of parameters,
2626
which can then be applied to an np.ndarray with the function smooth:
2727
> smoother = Smoother(method_name='savgol', window_length=28, gaussian_bandwidth=100)
@@ -51,8 +51,6 @@ class Smoother:
5151
28 579
5252
35 905
5353
42 1303
54-
49 1774
55-
56 2318
5654
impute: bool
5755
If True, will fill nan values before smoothing. Currently uses the 'savgol' method
5856
for imputation.
@@ -72,8 +70,8 @@ def __init__(
7270
self,
7371
method_name="savgol",
7472
poly_fit_degree=2,
75-
window_length=42,
76-
gaussian_bandwidth=325, # corresponds to 95% weight on first 3 weeks
73+
window_length=28,
74+
gaussian_bandwidth=144, # a ~2 week window
7775
impute=True,
7876
minval=None,
7977
boundary_method="shortened_window",
@@ -127,17 +125,17 @@ def smooth(self, signal):
127125

128126
def moving_average_smoother(self, signal):
129127
"""
130-
Compute a moving average on signal.
128+
Computes a moving average on the signal.
131129
132130
Parameters
133131
----------
134132
signal: np.ndarray
135-
Input array
133+
Input array.
136134
137135
Returns
138136
-------
139137
signal_smoothed: np.ndarray
140-
An array with the same length as arr, but the first window_length-1
138+
An array with the same length as arr, but the first window_length-1
141139
entries are np.nan.
142140
"""
143141
if not isinstance(self.window_length, int):

0 commit comments

Comments
 (0)