Skip to content

Instantly share code, notes, and snippets.

View bmcfee's full-sized avatar

Brian McFee bmcfee

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bmcfee
bmcfee / aliasing-animation.py
Created December 25, 2019 16:56
Aliasing animation plot
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import cycler
from matplotlib.animation import FuncAnimation
colors = [_['color'] for _ in list(matplotlib.rcParams['axes.prop_cycle'])]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bmcfee
bmcfee / frame2d.py
Created August 15, 2019 22:00
In-place patching (framing of 2d inputs)
def frame2d(x, patch_length, hop_length):
n_frames = 1 + (x.shape[-1] - patch_length) // hop_length
x_frame = np.lib.stride_tricks.as_strided(x, shape=(x.shape[0], patch_length, n_frames),
strides=(1 * x.itemsize, x.shape[0] * x.itemsize, hop_length * x.shape[0] * x.itemsize))
return x_frame
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.