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
0 |
import pyfits | |
import csv | |
if __name__ == "__main__": | |
hdulist = pyfits.open("foo.fits") | |
blob = hdulist[-1].data | |
with open('foo.csv', 'wb') as f: | |
writer = csv.writer(f) | |
writer.writerows(blob) |
echo Hello World |
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
<img width="20" height="20" align="absmiddle" src="http://octodex.github.com/images/nyantocat.gif" class="emoji" alt=":nyantocat:"> |
import numpy as np | |
import time as tt | |
def main(): | |
timing = np.array([]) | |
log2N = np.arange(6) + 8 | |
for N in 2 ** log2N: | |
uu = np.random.normal(size=(N, N+2)) | |
matrix = np.dot(uu, uu.T) | |
print matrix.shape |
import numpy as np | |
import scipy.linalg as la | |
# create data matrix and design matrices A (for sinusoids) and B (for nuisances) and M (for both) | |
y = np.random.normal(size=(100)) # data | |
A = np.random.normal(size=(2, 100)) # components we care about | |
B = np.random.normal(size=(10, 100)) # nuisance components | |
M = np.vstack((B, A)) | |
C = np.diag(0.25 * np.ones(100)) | |
Cinv = np.diag(4.00 * np.ones(100)) |
import numpy as np | |
def int_string(x, base, digits): | |
xx = x + 0 | |
str = "" | |
for i in range(digits): | |
str = (xx % base).__str__() + str | |
xx /= base | |
return str |
import numpy as np | |
def hoggsumexp(qns, dqn_dams, diag=False): | |
""" | |
# purpose: | |
- Computes L = log(sum(exp(qns, axis=-1))). | |
- Also computes its M-dimensional gradient components dL / da_m. | |
# input | |
- qns: ndarray of shape [n1, n2, n3, ..., nD, N] |
import numpy as np | |
from scipy.interpolate import interp1d | |
def weighted_median(xs, ws=None): | |
if ws is None: | |
ws = np.ones_like(xs) | |
totalw = np.sum(ws) | |
sindx = np.argsort(xs) # expensive | |
cs = np.cumsum(ws[sindx]) / totalw | |
symcumsum = 0.5 * (cs + np.append(0., cs[0:-1])) |