In [1]:
print 'This is my notebook'
In [2]:
import json
with open('SplinedataDES_all_18000') as dat:
DESdata = json.load(dat)
In [117]:
%matplotlib
import random
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams['axes.linewidth'] = 0
count = 0
id_tmp = 0
objdata = {}
for entry in DESdata:
#if count != 0 and id_tmp != entry['id']:
count += 1
if count < 700:
continue
# if len(objdata) == 5:
# break
count += 1
if count == 1500:
plt.ylabel('Normalized Flux')
plt.xlabel('Phase (days)')
#plt.show()
break
if entry['band'] == 'r':
id_tmp = entry['id']
objdata = {}
objdata['rydata'] = [entry['spldata_sampled'], entry['splinedata'], entry['xraw'], entry['yraw'], entry['magerr']]
objdata['xdata'] = entry['mjddata_sampled']
plt.plot(entry['mjddata_sampled'], entry['spldata_sampled'], lw = 2)
#else:
# objdata['{}ydata'.format(entry['band'])] = [entry['spldata_sampled'], entry['splinedata'], entry['xraw'], \
# entry['yraw'], entry['magerr']]
else:
objdata['{}ydata'.format(entry['band'])] = entry['spldata_sampled']
if len(objdata) == 5:
break
import matplotlib.pyplot as plt
t = np.array(objdata['xdata'])
def denormalize(listdata, normalized):
listdata = np.array(listdata)
normalized = np.array(normalized)
maxd = np.amax(listdata)
mind = np.amin(listdata)
denormalized = (normalized * (maxd - mind)) + mind
return denormalized
#y0 = denormalize(objdata['gydata'][1], objdata['gydata'][0])
#y1 = denormalize(objdata['rydata'][1], objdata['gydata'][0])
#y2 = denormalize(objdata['iydata'][1], objdata['gydata'][0])
#y3 = denormalize(objdata['zydata'][1], objdata['gydata'][0])
y3 = objdata['gydata']
y2 = objdata['rydata'][0]
y1 = objdata['iydata']
y0 = objdata['zydata']
fig = plt.figure(figsize = (12,12))
#plt.title('All Band Lightcurve Comparison', fontsize = 18)
#fig.canvas.set_window_title('All Band Lightcurve Comparison')
fig.suptitle('All Band Lightcurve Comparison', fontsize = 18)
#plt.text(0.5, 0.5,'matplotlib',
#horizontalalignment='right',
#verticalalignment='top')
ax0 = fig.add_subplot(414)
ax0.plot(t, y0, lw = 2.5)
plt.setp(ax0.get_xticklabels(), fontsize = 12)
#axt = fig.add_subplot(111)
#axt.set_xlabel('Phase (days)')
#axt.set_ylabel('Normalized Flux')
ax1 = fig.add_subplot(413, sharex = ax0, sharey = ax0)
ax1.plot(t, y1, lw = 2.5)
plt.setp( ax1.get_xticklabels(), visible=False)
ax2 = fig.add_subplot(412, sharex = ax0, sharey = ax0)
ax2.plot(t, y2, lw = 2.5)
plt.setp( ax2.get_xticklabels(), visible=False)
ax3 = fig.add_subplot(411, sharex = ax0, sharey = ax0)
ax3.plot(t, y3, lw = 2.5)
ax3.text(0.5,0.5, 'matplotlib')
plt.setp( ax3.get_xticklabels(), visible=False)
#plt.xlim(-20, 60)
plt.show()
In [103]:
%matplotlib
import numpy as np
In [104]:
import matplotlib.pyplot as plt
t = np.array(objdata['xdata'])
def denormalize(listdata, normalized):
listdata = np.array(listdata)
normalized = np.array(normalized)
maxd = np.amax(listdata)
mind = np.amin(listdata)
denormalized = (normalized * (maxd - mind)) + mind
return denormalized
#y0 = denormalize(objdata['gydata'][1], objdata['gydata'][0])
#y1 = denormalize(objdata['rydata'][1], objdata['gydata'][0])
#y2 = denormalize(objdata['iydata'][1], objdata['gydata'][0])
#y3 = denormalize(objdata['zydata'][1], objdata['gydata'][0])
y3 = objdata['gydata']
print y3
y2 = objdata['rydata'][0]
print y2
y1 = objdata['iydata']
print y1
y0 = objdata['zydata']
print y0
In [120]:
print id_tmp
In [32]:
from pylab import *
t = arange(0.01, 5.0, 0.01)
s1 = sin(2*pi*t)
s2 = exp(-t)
s3 = sin(4*pi*t)
ax1 = subplot(311)
plot(t,s1)
setp( ax1.get_xticklabels(), fontsize=6)
## share x only
ax2 = subplot(312, sharex=ax1)
plot(t, s2)
# make these tick labels invisible
setp( ax2.get_xticklabels(), visible=False)
# share x and y
ax3 = subplot(313, sharex=ax1, sharey=ax1)
plot(t, s3)
xlim(0.01,5.0)
show()
In [145]:
fig = plt.figure(figsize = (12,12))
#plt.title('All Band Lightcurve Comparison', fontsize = 18)
#fig.canvas.set_window_title('All Band Lightcurve Comparison')
fig.suptitle('All Band Lightcurve Comparison', fontsize = 18)
#plt.text(0.5, 0.5,'matplotlib',
#horizontalalignment='right',
#verticalalignment='top')
ax0 = fig.add_subplot(414)
ax0.plot(t, y0, lw = 2.5, color = 'black')
ax0.text(35, 0.6, 'z', horizontalalignment='left', verticalalignment = 'top', fontsize = 14)
ax0.axvline(0, color = 'k', linestyle = '-')
plt.setp(ax0.get_xticklabels(), fontsize = 12)
print len(t), len(y1)
#axt = fig.add_subplot(111)
#axt.set_xlabel('Phase (days)')
#axt.set_ylabel('Normalized Flux')
plt.xlabel('Phase (days)', fontsize = 18)
ax1 = fig.add_subplot(413, sharex = ax0, sharey = ax0)
ax1.plot(t, y1, lw = 2.5, color = 'orange')
ax1.text(35, 0.6, 'i', horizontalalignment='left', verticalalignment = 'top', fontsize = 14)
ax1.axvline(0, color = 'k', linestyle = '-')
plt.setp( ax1.get_xticklabels(), visible=False)
ax2 = fig.add_subplot(412, sharex = ax0, sharey = ax0)
ax2.plot(t, y2, lw = 2.5, color = 'red')
ax2.text(35, 0.6, 'r', horizontalalignment='left', verticalalignment = 'top', fontsize = 14)
ax2.axvline(0, color = 'k', linestyle = '-')
plt.setp( ax2.get_xticklabels(), visible=False)
ax3 = fig.add_subplot(411, sharex = ax0, sharey = ax0)
ax3.plot(t, y3, lw = 2.5, color = 'green')
ax3.axvline(0, color = 'k', linestyle = '-')
ax3.text(35, 0.6, 'g', horizontalalignment='left', verticalalignment = 'top', fontsize = 14)
ax3.text(35, 0.8, 'DES_SN058692', horizontalalignment='left', verticalalignment = 'top', fontsize = 16)
plt.setp( ax3.get_xticklabels(), visible=False)
plt.ylabel('Normalized Flux', fontsize = 18, y = -1.25)
#plt.xlim(-20, 60)
plt.show()
In [56]:
In [ ]: