Skip to content

Instantly share code, notes, and snippets.

View davidwhogg's full-sized avatar

David W. Hogg davidwhogg

View GitHub Profile
@davidwhogg
davidwhogg / beliefs.py
Last active August 29, 2015 14:19
testing Hogg's linear algebra beliefs
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
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
@davidwhogg
davidwhogg / gist:4719653
Created February 6, 2013 02:13
:nyantocat:
<img width="20" height="20" align="absmiddle" src="http://octodex.github.com/images/nyantocat.gif" class="emoji" alt=":nyantocat:">
@davidwhogg
davidwhogg / README.md
Created November 15, 2012 16:43 — forked from dfm/README.md
Get some stars.

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
@davidwhogg
davidwhogg / gist:3875572
Created October 11, 2012 21:24
I don't really know what a gist is, but here is one
echo Hello World
@davidwhogg
davidwhogg / gist:3217947
Created July 31, 2012 15:43
fits to csv!
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)
@davidwhogg
davidwhogg / gist:3059589
Created July 6, 2012 11:08
Yo how many characters can a github:gist be before I get closed down? Could we use github:gist as the new Twitter (tm)? Or the new Google+? Hooray for github!
0