import sn
samples = np.array([...]) # Some numpy array of samples.
pars = sn.fit_skew_normal(samples)
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 () { | |
var root = this; | |
root.Slider = function (target, min, max, on_finish, on_change) { | |
var _this = this; | |
var w = 260, h = 20, margin = 10, radius = 5; | |
// On change event. | |
this.on_change = function () {}; |
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
cd ~ | |
git clone https://github.com/davidwhogg/TheThresher.git | |
cd TheThresher | |
virtualenv venv --distribute | |
. venv/bin/activate | |
pip install numpy | |
pip install -r requirements.txt |
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 matplotlib import rc | |
rc("font", family="serif", size=12) | |
rc("text", usetex=True) | |
import daft | |
pgm = daft.PGM([3.5, 3], origin=[0, -0.5]) |
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
Copyright (c) 2012–2013 Daniel Foreman-Mackey | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
the Software, and to permit persons to whom the Software is furnished to do so, | |
subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all |
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 cPickle as pickle | |
for pos, lnprob, rstate in sampler.sample(pos0, iterations=500, storechain=False): | |
# First save the positions as you usually would. Following: http://dfm.io/RrU8w8 | |
# Save the current state. | |
with open("state.pkl", "w") as f: | |
pickle.dump([pos, lnprob, rstate], f, -1) | |
# |
First install the Python module:
pip install casjobs
Then set the environment variables:
export CAS_DR9_WSID="1234567890" # get yours here: http://skyserver.sdss3.org/CasJobs/ChangeDetails.aspx
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
fs = [] | |
for i in range(10): | |
fs.append(lambda: i) | |
print [f() for f in fs] |
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 emcee | |
def lnprob(x, ivar): | |
return -0.5 * np.array([np.sum(ivar * x ** 2), ]) | |
ndim, nwalkers = 10, 100 | |
ivar = 1. / np.random.rand(ndim) | |
p0 = [np.random.rand(ndim) for i in range(nwalkers)] |
The script works.py
runs fine and give reasonable results but the script notworking.py
throws a cPickle.UnpicklingError
and then stalls. The only difference is the line:
nwalkers = 100 # Works.
nwalkers = 150 # Doesn't work.