remove_nan
result = remove_nan(x)
Input: x · Output: result
What it is
x with the missing samples dropped.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = remove_nan(x) | x vector or Signalnot documented yet | result vector or Signal | Returns a plain vector even from a Signal, same reasoning as remove_outliers: what is left is no longer uniformly sampled. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
print(interpolate_nan([0, nan, nan, 30])) # [0, 10, 20, 30]
print(interpolate_nan([0, 10, 20, nan])) # [0, 10, 20, 20] -- holds, does not climb
print(fill_missing([1, nan, 9], method = "previous")) # [1, 1, 9]
print(fill_missing([1, nan, 9], value = 0)) # [1, 0, 9]
print(find_missing([1, nan, 3])) # [1]
print(remove_nan([1, nan, 3])) # [1, 3]
[0, 10, 20, 30] [0, 10, 20, 20] [1, 1, 9] [1, 0, 9] [1] [1, 3]
from noise
How it works
find_missing/remove_nan/fill_missing/interpolate_nan — dropouts, which real DAQ data has and which nothing else in the engine had an answer for: detrend([1, 2, nan, 4], 0) is four NaNs, and every spectral builtin behaves the same way, so one dropout costs the whole record until it is dealt with. "Missing" means NOT FINITE -- NaN or +-Inf, not just NaN. An infinity poisons a mean exactly as thoroughly as a NaN does and a saturated channel can produce either, so treating only NaN as missing would leave the other one to be discovered downstream. remove_nan keeps its familiar name and removes both; the book says so out loud. As with the outlier family there is no count in the return value: length(find_missing(x)) is the count, and these stay chainable.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.