This file contains hidden or 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
| import numpy as np | |
| import numpy.fft as fft | |
| def stft(x, Nwin, Nfft=None): | |
| """ | |
| Short-time Fourier transform: convert a 1D vector to a 2D array | |
| The short-time Fourier transform (STFT) breaks a long vector into disjoint | |
| chunks (no overlap) and runs an FFT (Fast Fourier Transform) on each chunk. |
This file contains hidden or 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
| import itertools | |
| # Microkanren programs are 'goal' functions that take in a | |
| # state and return a stream of states that satisfy the given goal. | |
| # I am interested about microkanren because it presents a logic | |
| # programming kernel which fits into a dynamically typed language. | |
| # Anything could go as a variable, but I wanted names for variables. | |
| class Variable(object): |
This file contains hidden or 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
| import Control.Monad | |
| ------------------------------------------------------------------------------- | |
| -- State Monad Implementation | |
| ------------------------------------------------------------------------------- | |
| newtype State s a = State { runState :: s -> (a,s) } | |
| instance Monad (State s) where | |
| return a = State $ \s -> (a, s) |
This file contains hidden or 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
| # The MIT License (MIT) | |
| # Copyright (c) 2016 Vladimir Ignatev | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining | |
| # a copy of this software and associated documentation files (the "Software"), | |
| # to deal in the Software without restriction, including without limitation | |
| # the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| # and/or sell copies of the Software, and to permit persons to whom the Software | |
| # is furnished to do so, subject to the following conditions: | |
| # |