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
import numpy as np | |
from scipy import spatial | |
import matplotlib.pyplot as plt | |
from matplotlib import animation | |
from numpngw import AnimatedPNGWriter | |
def mandala(n_iter, n_points, radius, ax=None): |
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
# | |
# Test utilities for numpy's hypergeometric distribution. | |
# | |
# Author: Warren Weckesser | |
# License: BSD 2 clause | |
# | |
import mpmath | |
import numpy as np | |
from numpy.random import Generator, Xoshiro256 |
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
import numpy as np | |
def random_select(items, nsample=None, p=None, size=None): | |
""" | |
Select random samples from `items`. | |
The function randomly selects `nsample` items from `items` without | |
replacement. |
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
# Scratch work for rewriting how scipy.stats.pearsonr handles several | |
# edge cases. | |
import warnings | |
import numpy as np | |
from numpy.testing import assert_equal, assert_allclose, assert_warns | |
from scipy import special | |
from scipy import linalg |
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
""" | |
Some signal functions implemented using mpmath. | |
""" | |
from __future__ import division | |
try: | |
import mpmath | |
except ImportError: | |
mpmath = None |
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
from __future__ import division | |
import numpy as np | |
from scipy.signal import freqz, butter, cheby1, firwin | |
import mpmath | |
import mpsig | |
import matplotlib.pyplot as plt | |
# oldfreqz is copied from freqz in the master branch of scipy. |
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
# File: animated_gif_writer.py | |
# Author: Warren Weckesser | |
# License: BSD 2-Clause (http://opensource.org/licenses/BSD-2-Clause) | |
# | |
# Copyright (c) 2015, Warren Weckesser | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are met: | |
# |
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
from __future__ import print_function, division | |
import time | |
import numpy as np | |
from numpy import convolve as np_convolve | |
from scipy.signal import convolve as sig_convolve, fftconvolve, firwin | |
from scipy.ndimage import convolve1d | |
from pylab import grid, show, legend, loglog, xlabel, ylabel, figure |
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
from __future__ import division, print_function | |
import numpy as np | |
from scipy import signal | |
import matplotlib.pyplot as plt | |
def plot_response(fs, w, h, title): | |
plt.figure() | |
plt.plot(0.5*fs*w/np.pi, 20*np.log10(np.abs(h))) |
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
import numpy as np | |
from scipy.signal.filter_design import _cplxreal | |
def pop_real(p): | |
"""Pop the first real value in the list p.""" | |
k = 0 | |
while k < len(p) and p[k].imag != 0: | |
k += 1 | |
if k == len(p): |