Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #56 from radicamc/master
Browse files Browse the repository at this point in the history
Bug fixes in plotting functions and new demo notebook
  • Loading branch information
hover2pi authored Jan 23, 2020
2 parents 82346dd + e146bc6 commit 10ace6f
Show file tree
Hide file tree
Showing 3 changed files with 850 additions and 964 deletions.
18 changes: 11 additions & 7 deletions awesimsoss/awesim.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def __init__(self, ngrps, nints, star=None, planet=None, tmodel=None, snr=700,
self.nints = nints
self.nresets = nresets
self.nframes = (self.nresets+self.ngrps)*self.nints
self.obs_date = datetime.datetime.now().strftime('%x')
self.obs_time = datetime.datetime.now().strftime('%X')
self.obs_date = datetime.datetime.now().strftime("%Y-%m-%d")
self.obs_time = datetime.datetime.now().strftime('%H:%M:%S.%f')[:-3]
self.orders = orders
self.filter = filter
self.header = ''
Expand Down Expand Up @@ -336,6 +336,8 @@ def export(self, outfile, all_data=False):
mod.meta.exposure.frame_time = self.frame_time
mod.meta.exposure.group_time = self.group_time
mod.meta.exposure.duration = self.time[-1]-self.time[0]
mod.meta.exposure.nresets_at_start = 1
mod.meta.exposure.nresets_between_ints = 1
mod.meta.subarray.name = self.subarray
mod.meta.subarray.xsize = data.shape[3]
mod.meta.subarray.ysize = data.shape[2]
Expand Down Expand Up @@ -727,7 +729,7 @@ def plot_lightcurve(self, column, time_unit='s', resolution_mult=20, draw=True):
# Get the scaled flux in each column for the last group in
# each integration
flux_cols = np.nansum(self.tso_ideal.reshape(self.dims3)[self.ngrps-1::self.ngrps], axis=1)
flux_cols = flux_cols/np.nanmax(flux_cols, axis=1)[:, None]
flux_cols = flux_cols/np.nanmax(flux_cols, axis=0)[None, :]

# Make it into an array
if isinstance(column, (int, float)):
Expand Down Expand Up @@ -760,18 +762,20 @@ def plot_lightcurve(self, column, time_unit='s', resolution_mult=20, draw=True):

# Make time axis and convert to desired units
time = np.linspace(min(self.time), max(self.time), self.ngrps*self.nints*resolution_mult)
time = time*q.d.to(time_unit)
time = time*q.s.to('d')

tmodel = batman.TransitModel(self.tmodel, time)
tmodel.rp = self.rp[col]
theory = tmodel.light_curve(tmodel)
theory *= max(lightcurve)/max(theory)

lc.line(time, theory, legend=label+' model', color=color, alpha=0.1)
time = time*q.d.to(time_unit)

lc.line(time, theory, legend=label+' model', color=color, alpha=0.8)

# Convert datetime
# Convert datatime
data_time = self.time[self.ngrps-1::self.ngrps].copy()
data_time*q.d.to(time_unit)
data_time = data_time*q.s.to(time_unit)

# Plot the lightcurve
lc.circle(data_time, lightcurve, legend=label, color=color)
Expand Down
Loading

0 comments on commit 10ace6f

Please sign in to comment.