Skip to content

Instantly share code, notes, and snippets.

View eteq's full-sized avatar

Erik Tollerud eteq

View GitHub Profile
@eteq
eteq / local_build.py
Last active July 3, 2018 14:49
Authorea script to build locally with LaTeX NOTE: updates at https://github.com/eteq/authorea-scripts
#!/usr/bin/env python
from __future__ import division, print_function
"""
This script generates a file to use for building authorea papers, and then runs
latex on them.
Requires python >= 2.6 (3.x should work, too)
The key assumptions are:
@eteq
eteq / galacto_plots.ipynb
Last active August 29, 2015 14:08
Code to show galactocentric stuff
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eteq
eteq / old-style class property weirdness.ipynb
Created December 3, 2014 00:32
IPython notebook demonstrating how properties are different in new-style and old-style py 2.x classes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eteq
eteq / adsjson_to_orcid.py
Last active August 29, 2015 14:11
A script to grab ADS private libraries and send them to ORCID
from __future__ import division, print_function
"""
This script takes in the URL to the JSON version of an ADS private library, and outputs a bibtex file suitable for importing into ORCiD
"""
import json
import urllib2
@eteq
eteq / dolphot_runner.py
Created June 26, 2015 14:42
Scripts to make doing things with ACS and DOLPHOT easier from python
from __future__ import division
import os
import sys
import pty
import select
import subprocess
def find_dolphot(dirstocheck=None):
@eteq
eteq / astroplan_realtime_update.ipynb
Last active September 15, 2015 23:32
Demo of astroplan for real-time observatory updates
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import sys
sys.path.insert(0, '/Users/bmorris/git/tmp/astropy')
import astropy
from astropy.time import Time
from astropy.coordinates import (SkyCoord, Longitude, Latitude, GCRS, ICRS,
@eteq
eteq / invocation.py
Last active December 18, 2015 20:54
Hypothetical example for how parameter file schema might be defined. Annoyingly, it appears gists automatically re-order to alphabetical... But best to read this from the bottom file up to understand what's going on.
import schema_example # this schema gets created *on import* here
import astropfile
astropfile.engage('parfile_example') # runs all the tasks in the file
parset = astropfile.edit_params('parfile_example') # pops up a GUI/Web page that can edit the file
parset.engage() # actually runs the thing
parset = astropfile.edit_params(schema_example.fit_gaussian_to_echelle1) # same as above, but creates a GUI with the defaults
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

>>> import numpy as np >>> from astropy import units as u

Create a quantity from a pre-existing sampled distribution. The MC direction is the first dimension.

>>> parr = np.random.poisson([1, 5, 30, 400],(1000, 4)) >>> distr = u.Distribution(parr, u.kpc)