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 | |
import scipy.special as sp | |
from matplotlib.colors import LinearSegmentedColormap | |
import matplotlib.cm as cm | |
import matplotlib.pyplot as pl | |
def reshist2d(x, y, *args, **kwargs): | |
ax = kwargs.pop('ax', pl.gca()) | |
extent = kwargs.pop('extent', [[x.min(), x.max()], [y.min(), y.max()]]) |
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
__all__ = ["triplot"] | |
import itertools | |
import matplotlib.pyplot as pl | |
from matplotlib.ticker import MaxNLocator | |
import numpy as np | |
def triplot(samples, titles=None, sfactor=0.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
function count_code_booboos() { | |
GIT_DIR=$(git rev-parse --git-dir 2> /dev/null) || return | |
NOTES_PATTERN="FIXME|TODO|MAGIC" | |
NOTES_RES=$(echo $(ack -hi --ignore-dir="venv" --ignore-dir="build" \ | |
"\b$NOTES_PATTERN\b" "$(dirname $GIT_DIR)" 2>/dev/null)) | |
for NM in "FIXME" "MAGIC" "TODO" | |
do | |
num=$(echo $(echo $NOTES_RES | ack -i "\b$NM\b" | wc -l)) | |
if [ $num != 0 ] | |
then |
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 | |
import scipy.optimize as op | |
# x, y, yerr = ... read in your data | |
def chi(p): | |
sig2 = p[2] ** 2 | |
m = p[0] * np.exp(-0.5 * (x - p[1]) ** 2 / sig2) / np.sqrt(2 * np.pi * sig2) + p[3] | |
return (y - m) / yerr |
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
0.29012 4.69497 0.58980 | |
0.39687 4.53831 0.61233 | |
0.58085 4.58511 0.72283 | |
0.79724 3.88045 0.58649 | |
0.96492 3.28931 0.59474 | |
1.44055 2.63219 0.52092 | |
2.00743 1.76821 0.57815 | |
2.71773 0.46981 0.64042 | |
2.73360 0.32956 0.50058 | |
3.04199 -0.22867 0.63828 |
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
#include <Python.h> | |
#include <numpy/arrayobject.h> | |
#include "chi2.h" | |
/* Docstrings */ | |
static char module_docstring[] = | |
"This module provides an interface for calculating chi-squared using C."; | |
static char chi2_docstring[] = | |
"Calculate the chi-squared of some data given a model."; |
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 | |
import json | |
from collections import defaultdict | |
import time | |
from datetime import datetime | |
import requests | |
import numpy as np |
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
>>> str("weiß") | |
'wei\xc3\x9f' | |
>>> str(u"weiß") | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in position 3: ordinal not in range(128) |
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
libchi2.so: chi2.o | |
gcc -shared -Wl,-soname,libchi2.so.1 -o libchi2.so.1.0.0 chi2.o -lc | |
chi2.o: chi2.c | |
gcc -fPIC -g -c -Wall chi2.c |
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
__all__ = ["hist2d", "error_ellipse", "corner"] | |
import numpy as np | |
import scipy.special as sp | |
import matplotlib.pyplot as pl | |
from matplotlib.ticker import MaxNLocator | |
from matplotlib.colors import LinearSegmentedColormap | |
from matplotlib.patches import Ellipse | |
import matplotlib.cm as cm |