In [1]:
print 'This is my notebook'


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()


Using matplotlib backend: TkAgg

In [103]:
%matplotlib
import numpy as np


Using matplotlib backend: TkAgg

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


[1.0, 0.9786465137783198, 0.9572930275566394, 0.935943885951875, 0.9146487203745496, 0.8814744338295942, 0.8420132623532738, 0.8025520908769533, 0.763090919400633, 0.7236297479243127, 0.6841685764479922, 0.6447074049716719, 0.6067828431550801, 0.5692235155142888, 0.5316641878734976, 0.4941048602325731, 0.45654553259178177, 0.41898620495099065, 0.3814268773101993, 0.343867549669408, 0.30630822202861674, 0.2687488943878254, 0.23281256017090035, 0.2095313041538187, 0.18625004813673673, 0.16296879211957244, 0.1396875361024908, 0.11640628008540885, 0.0931250240683272, 0.06984376805124524, 0.0465625120341636, 0.023281256017081642, 0.0, 0.08573741782943936, 0.17718001239336909, 0.2686226069576228, 0.36006520152155225, 0.45150779608548164, 0.5429503906494111, 0.6343929852133405]
[0.49915249181388055, 0.6172472389173157, 0.735341986020751, 0.8509100935871798, 0.9504974312590935, 0.9862682410583685, 0.9890634951723414, 0.9918587492863145, 0.9946540034002876, 0.9974492575142607, 1.0, 0.9741492090812498, 0.9312778447449935, 0.8773853284504695, 0.8234928121559455, 0.7696002958612302, 0.7157077795667062, 0.6618152632721822, 0.5894754478032006, 0.5099936023430062, 0.43051175688281157, 0.35102991142261697, 0.2984454315601215, 0.25188577415016145, 0.20532611674020113, 0.15876645933007583, 0.1361962529337735, 0.11662976200401814, 0.0970632710742625, 0.07749678014450702, 0.05793028921475154, 0.03836379828499605, 0.021392860673428906, 0.018375884397208057, 0.015358908120987202, 0.012341931844755714, 0.009303496911449266, 0.006202331274299511, 0.0031011656371497556, 0.0]
[0.0, 0.1438696183716153, 0.2836104698376224, 0.4007542683304633, 0.5164171829882901, 0.6320800976465274, 0.7218654923797658, 0.7828746204071987, 0.8437420545607066, 0.8945199093981295, 0.9320318802446321, 0.9653837299501643, 0.9987355796556965, 1.0, 0.9505718797699481, 0.9159590067197887, 0.8960298964089116, 0.8761007860980344, 0.8561716757871574, 0.8362425654762803, 0.8163134551654032, 0.796384344854526, 0.7898025703630105, 0.7850984306750155, 0.7803942909870206, 0.7756901512990092, 0.7709860116110144, 0.7662818719230196, 0.7402569375431217, 0.7141455498847658, 0.6880341622264097, 0.6625832218304178, 0.6439219723551816, 0.6252607228799453, 0.6065994734047089, 0.5867955752035833, 0.5610738124245939, 0.5353520496456046, 0.5096302868666152, 0.4839085240876258]
[0.0, 0.09249225018268345, 0.1849845003653669, 0.30268704177624617, 0.4346418040764817, 0.5665965663771853, 0.6985513286774208, 0.7532675636310335, 0.7806822787831302, 0.808096993935227, 0.8355117090873233, 0.86292642423942, 0.8903411393915166, 0.9177558545436131, 0.9451705696957096, 0.9725852848479035, 1.0, 0.9682166082363353, 0.9019718735636233, 0.835727138890911, 0.7694824042181989, 0.7085622853742035, 0.6760782234909961, 0.6435941616077886, 0.6111100997245812, 0.5786260378412585, 0.5461419759580511, 0.5136579140748436, 0.4811738521916362, 0.44868979030842876, 0.4162057284252213, 0.4036071736622615, 0.41853542428260343, 0.43346367490294546, 0.44839192552328744, 0.4633201761436823, 0.47824842676402435, 0.4931766773843664, 0.5081049280047084, 0.5230331786250503]
print id_tmp

In [120]:
print id_tmp


DES_SN058692.DAT

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()


40 40

In [56]:


In [ ]: