Created
March 23, 2018 14:01
-
-
Save rbino/6d56a1a0399ba03941b33c7f797b3036 to your computer and use it in GitHub Desktop.
ExLTTB.Stream example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input_stream = | |
Stream.iterate(%{x: 0, y: :random.uniform() * 100}, fn %{x: x} -> | |
%{x: x + 1, y: :random.uniform() * 100} | |
end) | |
# Take 20 samples output samples after downsampling by 2.3 | |
# The 20 output samples will correspond to ~ 20 * 2.3 input samples | |
output_samples = | |
ExLTTB.Stream.downsample(input_stream, 2.3) | |
|> Enum.take(20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment