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 | |
""" | |
ffmpeg, convert png to mpg | |
ffmpeg -r FRAMES_PER_SECOND -i IMAGE_PATHS -q:a 0 -q:v 0 -vcodec mpeg4 -vb 20M -r FRAMES_PER_SECOND_MOV OUTPUT_FILE | |
`-qscale 0` - Forces lossless quality conversion -> should use `-q:a 0 -q:v 0` | |
`FRAMES_PER_SECOND` - Number of images to display per second, can be fractional | |
`IMAGE_PATHS` - Image paths, use normal substitution macros, i.e. frame%04dfig4.png would expand to frameXXXXfig4.png where XXXX is zero filled. |
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 os | |
import subprocess | |
html_header = r""" | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> |
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
\newcommand{\eg}{{e.g.}\xspace} | |
% ============================================================================== | |
% Generic math macros | |
\renewcommand{\v}[1]{\boldsymbol{#1}} | |
\newcommand{\m}[1]{\text{\textsf#1}} | |
\newcommand{\pd}[2]{\ensuremath{\frac{\partial #1}{\partial #2}}} % partial | |
\newcommand{\dee}{\ensuremath{\mathrm{d}}} % d symbol | |
\newcommand{\diff}[2]{\ensuremath{\frac{\dee #1}{\dee #2}}} % Derivative d/dx |
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 | |
r"""chile2010_adjoint regression test for GeoClaw | |
To create new regression data use | |
`python regression_tests.py True` | |
""" | |
from __future__ import absolute_import | |
import os |
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
# Based on the code by Nick Higham | |
# https://gist.github.com/higham/6f2ce1cdde0aae83697bca8577d22a6e | |
# Compares relative error formulations using single precision and compared to double precision | |
N = 501 # Note: Use 501 instead of 500 to avoid the zero value | |
d = numpy.finfo(numpy.float32).eps * 1e4 | |
a = 3.0 | |
x = a * numpy.ones(N, dtype=numpy.float32) | |
y = [x[i] + numpy.multiply((i - numpy.divide(N, 2.0, dtype=numpy.float32)), d, dtype=numpy.float32) for i in range(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 | |
import matplotlib.pyplot as plt | |
X, Y = numpy.meshgrid(numpy.linspace(-2, 2, 200, numpy.linspace(-2 ,2 ,20)) | |
fig = plt.figure(figsize=[16,8]) | |
axes = [] | |
for n in xrange(2): |
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 add(colormaps, break_location=0.5): | |
lhs_dict = colormaps[0]._segmentdata | |
rhs_dict = colormaps[1]._segmentdata | |
new_dict = dict(red=[], green=[], blue=[]) | |
# Scale rhs by half | |
for key in rhs_dict: | |
val_list = rhs_dict[key] | |
print(key, val_list) |