Qu

remove_outliers

Builtin index · Noise

result = remove_outliers(x, [method=], [threshold=], [window=])

Input: x, method, threshold, window · Output: result

What it is

The same criterion, with the flagged samples dropped.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = remove_outliers(x, [method=], [threshold=], [window=])
x —not documented yet
method optionalnot documented yet
threshold optionalnot documented yet
window optionalnot documented yet
result vector or Signal
Returns a plain vector, shorter than the input, even from a Signal — the surviving samples are no longer evenly spaced, so the old Fs would be a lie (the same call interpolate_at makes, for the same reason). Use replace_outliers when the rate must survive.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

y = [1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 100]
print(find_outliers(y, method = "modified_zscore"))      # [10]

print(remove_outliers(y, method = "modified_zscore"))    # the 100 is gone

print(replace_outliers(y, method = "modified_zscore")[10])  # 2 -- patched in place


drift = 0 to 40
drift[20] = drift[20] + 30
print(find_outliers(drift, method = "hampel", window = 7))  # [20]

print(find_outliers(drift, method = "zscore"))              # [] -- global test cannot see it

output
[10]
[1, 2, 3, 2, 1, 2, 3, 2, 1, 2]
2
[20]
[]

from noise