You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation for the hampel_filter function states:
filtsize : int
the filter size expressed the number of datapoints
taken surrounding the analysed datapoint. a filtsize
of 6 means three datapoints on each side are taken.
total filtersize is thus filtsize + 1 (datapoint evaluated)
however, as currently implemented the slices will not be filtesize + 1, it will be exactly filtsize. e.g. for filtsize = 6, the following line:
dataslice = output[i - onesided_filt : i + onesided_filt]
on the first iteration of the loop (i = onesided_filt -> i = 3) will evaluate to dataslice = output[0:6]. Python is exclusive on the end of the slice, so you will only get 6 data points in the slice. I believe the code should read:
behavior for odd numbered filtsize is not well defined. Python's // operator will round down for odd numbers (e.g. 7//2 will result in 3). This means a filtsize = 7 is actually functionally the same as filtsize = 6. If I understand correctly an odd-numbered filtsize isn't really intended to be possible, so I'd suggest adding a guard clause at the top of the function to prevent this, as well as updating the docs.
Thanks!
The text was updated successfully, but these errors were encountered:
Two issues:
however, as currently implemented the slices will not be filtesize + 1, it will be exactly filtsize. e.g. for filtsize = 6, the following line:
on the first iteration of the loop (i = onesided_filt -> i = 3) will evaluate to dataslice = output[0:6]. Python is exclusive on the end of the slice, so you will only get 6 data points in the slice. I believe the code should read:
//
operator will round down for odd numbers (e.g.7//2
will result in 3). This means a filtsize = 7 is actually functionally the same as filtsize = 6. If I understand correctly an odd-numbered filtsize isn't really intended to be possible, so I'd suggest adding a guard clause at the top of the function to prevent this, as well as updating the docs.Thanks!
The text was updated successfully, but these errors were encountered: