示例#1
0
'''

import numpy as np
#import ctypes
from matplotlib import pyplot as plt
from scipy import optimize

import os
import oscaar

## Run parameters:
plotFit = True  ## Plot light curve fit
animatePB = False  ## Plot each prayer-bead iteration

dataBank = oscaar.load(
    os.path.join(os.path.dirname(__file__),
                 '../examples/sampleOutput/oscaarDataBase.pkl'))
t = times = np.require(dataBank.getTimes(), dtype=np.float64)
F = dataBank.lightCurve
sigmas = dataBank.lightCurveError
Npoints = len(t)
n = Npoints

## np.require() will force the ndarrays to the right dtype as assigned in the `argtypes` list.
t = np.require(t, np.float64)
#F = np.empty_like(t,dtype=np.float32)
#occultquad(t, p,  ap,  P,  i,  gamma1,  gamma2, e,longPericenter, t0,  n,  F)	## Simulate fake data
# Enter Initial Parameters to vary
initParamNames = ['R_p/R_s', 'a/R_s', 'inc', 't_0']
modelParams = np.loadtxt(
    os.path.join(os.path.dirname(__file__), 'modelParams.txt'))
    prayer-bead method.
'''

import numpy as np
#import ctypes
from matplotlib import pyplot as plt
from scipy import optimize

import os
import oscaar

## Run parameters: 
plotFit = True		## Plot light curve fit
animatePB = False 	## Plot each prayer-bead iteration

dataBank = oscaar.load(os.path.join(os.path.dirname(__file__),'../examples/sampleOutput/oscaarDataBase.pkl'))
t = times = np.require(dataBank.getTimes(),dtype=np.float64)
F = dataBank.lightCurve
sigmas = dataBank.lightCurveError
Npoints = len(t)
n = Npoints

## np.require() will force the ndarrays to the right dtype as assigned in the `argtypes` list.
t = np.require(t,np.float64)
#F = np.empty_like(t,dtype=np.float32)
#occultquad(t, p,  ap,  P,  i,  gamma1,  gamma2, e,longPericenter, t0,  n,  F)	## Simulate fake data
# Enter Initial Parameters to vary
initParamNames = ['R_p/R_s','a/R_s','inc','t_0']
modelParams = np.loadtxt(os.path.join(os.path.dirname(__file__),'modelParams.txt'))
print modelParams
[p,ap,P,i,gamma1,gamma2,e,longPericenter,t0] = modelParams
示例#3
0
import oscaar
from oscaar import astrometry
from oscaar import photometry
import pyfits
import numpy as np
from matplotlib import pyplot as plt
from time import time
import os
import matplotlib
print matplotlib.__version__
#plt.ion()
import datetime

outputPath = 'outputs' + os.sep + 'oscaarDataBase.pkl'
data = oscaar.load(outputPath)

fig = plt.figure(num=None, figsize=(10, 8), facecolor='w', edgecolor='k')
fig.canvas.set_window_title('oscaar2.0')
print 'plotting'
times = data.getTimes()
meanComparisonStar, meanComparisonStarError = data.calcMeanComparison(
    ccdGain=1.0)
lightCurve, lightCurveError = data.computeLightCurve(meanComparisonStar,
                                                     meanComparisonStarError)
binnedTime, binnedFlux, binnedStd = oscaar.medianBin(times, lightCurve, 10)
photonNoise = data.getPhotonNoise()

print times.shape, lightCurve.shape

ax1 = fig.add_subplot(111)
示例#4
0
import oscaar
from oscaar import astrometry
from oscaar import photometry
import pyfits
import numpy as np
from matplotlib import pyplot as plt
from time import time
import os
import matplotlib

print matplotlib.__version__
# plt.ion()
import datetime

outputPath = "outputs" + os.sep + "oscaarDataBase.pkl"
data = oscaar.load(outputPath)

fig = plt.figure(num=None, figsize=(10, 8), facecolor="w", edgecolor="k")
fig.canvas.set_window_title("oscaar2.0")
print "plotting"
times = data.getTimes()
meanComparisonStar, meanComparisonStarError = data.calcMeanComparison(ccdGain=1.0)
lightCurve, lightCurveError = data.computeLightCurve(meanComparisonStar, meanComparisonStarError)
binnedTime, binnedFlux, binnedStd = oscaar.medianBin(times, lightCurve, 10)
photonNoise = data.getPhotonNoise()

print times.shape, lightCurve.shape

ax1 = fig.add_subplot(111)

示例#5
0
    uncertainties in the extracted system parameters with the
    prayer-bead method.
'''

import numpy as np
#import ctypes
from matplotlib import pyplot as plt
from scipy import optimize

import os
import oscaar
## Run parameters: 
plotFit = True		## Plot light curve fit
animatePB = False 	## Plot each prayer-bead iteration

dataBank = oscaar.load(os.path.join(os.path.dirname(__file__),os.path.abspath("../../../outputs/oscaarDataBase.pkl")))
t = times = np.require(dataBank.getTimes(),dtype=np.float64)
F = dataBank.lightCurve
sigmas = dataBank.lightCurveError
Npoints = len(t)
n = Npoints

## np.require() will force the ndarrays to the right dtype as assigned in the `argtypes` list.
t = np.require(t,np.float64)
#F = np.empty_like(t,dtype=np.float32)
#occultquad(t, p,  ap,  P,  i,  gamma1,  gamma2, e,longPericenter, t0,  n,  F)	## Simulate fake data
# Enter Initial Parameters to vary
initParamNames = ['R_p/R_s','a/R_s','inc','t_0']
modelParams = np.loadtxt(os.path.join(os.path.dirname(__file__),'modelParams.txt'))
print modelParams
[p,ap,P,i,gamma1,gamma2,e,longPericenter,t0] = modelParams
示例#6
0
import numpy as np
from matplotlib import pyplot as plt

## Import oscaar directory using relative paths
import os, sys
lib_path = os.path.abspath('../../Code/')
sys.path.append(lib_path)
import oscaar

sampleData = oscaar.load('oscaarDataBase.pkl')

## Set up the figure
fig = plt.figure(figsize=(10, 10))
axis1 = fig.add_subplot(221)
axis2 = fig.add_subplot(222)
axis3 = fig.add_subplot(223)
axis4 = fig.add_subplot(224)

## Plot light curve
axis1.set_title('Transit light curve')
axis1.set_xlabel('Time (JD)')
axis1.set_ylabel('Relative Flux')
axis1.plot(sampleData.times, sampleData.lightCurve, '.')  ## Plot Light Curve
axis1.axvline(ymin=0, ymax=1, x=sampleData.ingress, linestyle=":")
axis1.axvline(ymin=0, ymax=1, x=sampleData.egress, linestyle=":")

## Trace (x,y) position of the target star
starDictionary = sampleData.getDict(
)  ## The position data is stored in a dictionary
starKeys = sampleData.keys  ## There are keys for each star in the dictionary
targetX = starDictionary[starKeys[0]][
示例#7
0
    prayer-bead method.
'''

import numpy as np
#import ctypes
from matplotlib import pyplot as plt
from scipy import optimize

import os
import oscaar
## Run parameters:
plotFit = True  ## Plot light curve fit
animatePB = True  ## Plot each prayer-bead iteration

dataBank = oscaar.load(
    os.path.join(os.path.dirname(__file__),
                 os.path.abspath("../../../outputs/oscaarDataBase.pkl")))
t = times = np.require(dataBank.getTimes(), dtype=np.float64)
F = dataBank.lightCurve
sigmas = dataBank.lightCurveError
Npoints = len(t)
n = Npoints

## np.require() will force the ndarrays to the right dtype as assigned in the `argtypes` list.
t = np.require(t, np.float64)
#F = np.empty_like(t,dtype=np.float32)
#occultquad(t, p,  ap,  P,  i,  gamma1,  gamma2, e,longPericenter, t0,  n,  F)	## Simulate fake data
# Enter Initial Parameters to vary
initParamNames = ['R_p/R_s', 'a/R_s', 'inc', 't_0']
modelParams = np.loadtxt(
    os.path.join(os.path.dirname(__file__), 'modelParams.txt'))
示例#8
0
import numpy as np
from matplotlib import pyplot as plt
import oscaar

sampleData = oscaar.load('sampleOutput/oscaarDataBase.pkl')

## Set up the figure
fig = plt.figure(figsize=(10,10))
axis1 = fig.add_subplot(221)
axis2 = fig.add_subplot(222)
axis3 = fig.add_subplot(223)
axis4 = fig.add_subplot(224)

## Plot light curve
axis1.set_title('Transit light curve')
axis1.set_xlabel('Time (JD)')
axis1.set_ylabel('Relative Flux')
axis1.plot(sampleData.times,sampleData.lightCurve,'.')	## Plot Light Curve
axis1.axvline(ymin=0,ymax=1,x=sampleData.ingress,linestyle=":")
axis1.axvline(ymin=0,ymax=1,x=sampleData.egress,linestyle=":")

## Trace (x,y) position of the target star 
starDictionary = sampleData.getDict()	## The position data is stored in a dictionary
starKeys = sampleData.keys				## There are keys for each star in the dictionary
targetX = starDictionary[starKeys[0]]['x-pos'] ## Access the position data with this dictionary look-up
targetY = starDictionary[starKeys[0]]['y-pos']
axis2.plot(targetX,targetY)
axis2.set_title('Target centroid pixel position (trace)')
axis2.set_xlabel('X')
axis2.set_ylabel('Y')
示例#9
0
import numpy as np
from matplotlib import pyplot as plt

## Import oscaar directory using relative paths
import os, sys
lib_path = os.path.abspath('../../Code/')
sys.path.append(lib_path)
import oscaar

sampleData = oscaar.load('oscaarDataBase.pkl')

## Set up the figure
fig = plt.figure(figsize=(10,10))
axis1 = fig.add_subplot(221)
axis2 = fig.add_subplot(222)
axis3 = fig.add_subplot(223)
axis4 = fig.add_subplot(224)

## Plot light curve
axis1.set_title('Transit light curve')
axis1.set_xlabel('Time (JD)')
axis1.set_ylabel('Relative Flux')
axis1.plot(sampleData.times,sampleData.lightCurve,'.')	## Plot Light Curve
axis1.axvline(ymin=0,ymax=1,x=sampleData.ingress,linestyle=":")
axis1.axvline(ymin=0,ymax=1,x=sampleData.egress,linestyle=":")

## Trace (x,y) position of the target star 
starDictionary = sampleData.getDict()	## The position data is stored in a dictionary
starKeys = sampleData.keys				## There are keys for each star in the dictionary
targetX = starDictionary[starKeys[0]]['x-pos'] ## Access the position data with this dictionary look-up
targetY = starDictionary[starKeys[0]]['y-pos']