Created
June 21, 2021 10:55
-
-
Save arnobaer/1f76a7499d736806475e0482e79a07d9 to your computer and use it in GitHub Desktop.
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
def linspace(start, stop, count): | |
delta = (stop - start) / max(1, count - 1) | |
return [start + i * delta for i in range(count)] | |
def sample(data, count): | |
n = len(data) | |
count = min(n, count) | |
return [int(round(i)) for i in linspace(0, len(data) - 1, count)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment