Skip to content

Instantly share code, notes, and snippets.

@bmorris3
bmorris3 / modelLightCurveEarth.py
Last active December 17, 2015 16:18
Model transit light curve of Earth using OSCAAR.
import numpy as np
from matplotlib import pyplot as plt
import oscaar
## Define system parameters for planet Earth, pulled from Wolfram Alpha
## Limb-darkening coeffs loosely based on Sanchez-Bajo et al. (2002) http://iopscience.iop.org/0143-0807/23/3/311
RpOverRs = 6367.5/695500.0 ## R_p/R_s = ratio of planetary radius to stellar radius
aOverRs = 1.49597887e8/695500.0 ## a/R_s = ratio of semimajor axis to stellar radius
period = 365.25 ## Period [days]
inclination = 90.0 ## Inclination [degrees]
import numpy as np
import cPickle
import os
data = np.random.random(10)
## Simulate behavior of oscaar.IO.save()
outputName = "null\\0test.pkl"
output = open(outputName, 'wb')
cPickle.dump(data, output)
@bmorris3
bmorris3 / exoplanetplotter.py
Created May 22, 2014 17:33
Plot the exoplanets.org database with Python/Matplotlib
'''
Downloads, unpacks and "pickles" (saves a python binary) of the exoplanets.org
planet database, saves the data in nested dictionaries.
For exoplanets.org's parameter field keywords, see Table 1 of
Wright et al. 2011: http://arxiv.org/pdf/1012.5676v3.pdf
Brett Morris
'''
@bmorris3
bmorris3 / exoplanetplotter2.py
Created May 29, 2014 18:03
With a mass-radius relation from Mordasini et al. 2012: http://adsabs.harvard.edu/abs/2012A%26A...547A.112M
'''
Downloads, unpacks and "pickles" (saves a python binary) of the exoplanets.org
planet database, saves the data in nested dictionaries.
For exoplanets.org's parameter field keywords, see Table 1 of
Wright et al. 2011: http://arxiv.org/pdf/1012.5676v3.pdf
Brett Morris
'''
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Recipe for calculating which bright exoplanets will be transiting tonight and
visible from Apache Point Obsevatory.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from astropy.time import Time
from astroplan import Observer, get_site, Exoplanets
from astroplan import Observer, FixedTarget
from astroplan.constraints import (is_observable, is_always_observable,
AltitudeConstraint, AirmassConstraint,
AtNight)
from astropy.time import Time
import astropy.units as u
import numpy as np
time_range = Time(["2015-01-01", "2015-01-03"])
subaru = Observer.at_site("Subaru")
class SeparationConstraint(Constraint):
"""
Constrain the separation between one target and another target.
"""
def __init__(self, separation_target_function, separation_target_args=[],
min=None, max=None):
"""
Parameters
----------