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
#!/usr/bin/env julia | |
# Demonstrate the following features: | |
# 1) Complex type compatible with h5py and pytables Python modules. | |
# 2) Create dataset with this type, chunking, etc. | |
# 3) Write data in pieces, not all at once. | |
# 4) Read back data in h5py format as native julia complex type. | |
# | |
# Brian Hawkins | |
# 2018-09-08 | |
# MIT license |
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
#!python | |
# Adapted from StackOverflow user mab | |
# http://stackoverflow.com/a/33672015/112699 | |
import timeit | |
import numpy as np | |
import pandas as pd | |
from IPython.display import display | |
def profile_this(methods, setup='', n=100, niter=10**4): | |
print('n: {0}, niter: {1:.0e}'.format(n, niter)) |
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
#!/usr/bin/env python | |
import numpy as np | |
import pylab as p | |
from mpl_toolkits.mplot3d import Axes3D | |
n = 201 | |
R = 1.0 | |
gamma = 1 |
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
#!/usr/bin/env python | |
from __future__ import print_function | |
import timeit | |
import numpy as np | |
from distutils.version import StrictVersion | |
from six.moves import range | |
setup = """ | |
import numpy as np | |
from six.moves import range |
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
#!/usr/bin/env python | |
from __future__ import print_function | |
import numpy as np | |
from numpy import log, ceil | |
def nextpower(n, base=2.0): | |
"""Return the next integral power of two greater than the given number. | |
Specifically, return m such that | |
m >= n |
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
#!/usr/bin/env python | |
import numpy as np | |
def medfilt (x, k): | |
"""Apply a length-k median filter to a 1D array x. | |
Boundaries are extended by repeating endpoints. | |
""" | |
assert k % 2 == 1, "Median filter length must be odd." |