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
local function plot(series, tpause) | |
local gp = io.popen("gnuplot", 'w') | |
local lines = { } | |
for k,v in pairs(series) do | |
table.insert(lines, string.format(" '-' u 1:2 title '%s'", k)) | |
end | |
gp:write("plot" .. table.concat(lines, ",") .. "\n") | |
for k,v in pairs(series) do |
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
#!/usr/bin/env python | |
import numpy as np | |
def Quantile(data, q, precision=1.0): | |
""" | |
Returns the q'th percentile of the distribution given in the argument | |
'data'. Uses the 'precision' parameter to control the noise level. | |
""" |
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
#!/usr/bin/env python | |
def load_from_many(pattern): | |
""" | |
Take a pattern and return a numpy array containing the concatenation of all | |
the files matching that pattern. Only the first column and rows after the | |
first are returned, and the data values are offset by the difference between | |
the first and second columns of the first row. | |
""" |
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
#!/usr/bin/env python | |
import numpy as np | |
from matplotlib import pyplot as plt | |
from scipy.optimize import leastsq | |
from scipy.ndimage import binary_closing, grey_closing | |
def LineModel(pt1, pt2, Nx=100, Ny=100, h=1.0, sig=0.1): | |
""" |
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
LUAHOME = $(HOME)/Work/lunum/lua-5.2.0 | |
CFLAGS = -Wall | |
default : luawrap | |
luawrap : luawrap.cpp | |
$(CXX) $(CFLAGS) -o $@ $^ -L$(LUAHOME)/lib -I$(LUAHOME)/include -llua | |
clean : |
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
void draw_vbo() | |
{ | |
GLuint vbo,ibo; | |
GLfloat verts[8][3] = {{0.0, 0.0, 0.0}, | |
{0.0, 0.0, 0.1}, | |
{0.0, 0.1, 0.0}, | |
{0.0, 0.1, 0.1}, | |
{0.1, 0.0, 0.0}, | |
{0.1, 0.0, 0.1}, | |
{0.1, 0.1, 0.0}, |
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
/* ----------------------------------------------------------------------------- | |
* | |
* AUTHOR: Jonathan Zrake, NYU CCPP: [email protected] | |
* | |
* | |
* USAGE: $> ./tetrun [number of trials] | |
* | |
* | |
* DESCRIPTION: |
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
void TakeScreenshot(const char *fname) | |
{ | |
printf("writing a screenshot to %s\n", fname); | |
int dimx = glutGet(GLUT_WINDOW_WIDTH); | |
int dimy = glutGet(GLUT_WINDOW_HEIGHT); | |
size_t imsize = 3*dimx*dimy; | |
char *pixels = (char*) malloc(imsize*sizeof(char)); | |
glReadPixels(0, 0, dimx, dimy, GL_RGB, GL_UNSIGNED_BYTE, pixels); |
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
#!/usr/bin/env python | |
# ------------------------------------------------------------------------------ | |
# | |
# Authors: Jonathan Zrake, Bez Laderman: NYU CCPP | |
# Date: May 7th, 2012 | |
# | |
# This piece of code implements the left and right eigenvectors of the ideal | |
# special relativistic hydrodynamics equations. The formulas are an exact | |
# translation of those given in the literature: |
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
#include <iostream> | |
#include <stdexcept> | |
class ZrakeFailed : public std::runtime_error | |
{ | |
public: | |
ZrakeFailed(const std::string &msg) : std::runtime_error("zraker failed. " + msg) { } |
OlderNewer