In [1]:
#import necessary python libraries
import json
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit, minimize
import pandas as pd
import math
from JSON_to_DF import JSON_to_DataFrame
from Lightcurve_class import *
import celerite
import pickle
%matplotlib notebook
In [2]:
SN = deserialize('../../../OSC_data/pickled_data/SN2011fe.pickle')
SN.Lightcurves['B_10'].Kapernka_fit_plot()
Out[2]:
In [2]:
#create new supernovae object and load meta and Lightcurve data
SN2011fe = Supernovae('../../../OSC_data/JSON_data/SN2011fe.json')
SN2011fe.load_LightCurves()
SN2011fe.meta_data()
SN2011fe.serialize()
In [4]:
#Create Kernels for Gaussian Process
#Real term parameter initialization
a = 1e-5
c = 1
#Matern term parameter initialization
sig = 1e-5
rho = 100
#Bounds on parameters
bounds = dict(log_a = (-15,15), log_c = (-15,15))
bounds = dict(log_sigma = (-15, 15), log_rho = (-15, 15))
#Create Kernels
Real_Kernel = celerite.terms.RealTerm(log_a = np.log(a), log_c = np.log(c), bounds=bounds)
Matern_Kernel = celerite.terms.Matern32Term(log_sigma = np.log(sig), log_rho = np.log(rho))
In [7]:
#Matern_Kernel fit
plt.figure()
SN2011fe.Lightcurves['V_10'].Gaussian_process(Matern_Kernel, plot=True)
Out[7]:
In [25]:
plt.figure()
SN2011fe.Lightcurves['V_10'].Gaussian_process(Real_Kernel, plot=True)
Out[25]:
In [26]:
plt.figure()
SN2011fe.Lightcurves['V_10'].Kapernka_fit_plot(plot=True)
Out[26]:
In [60]:
plt.figure()
SN2011fe.Lightcurves['V_10'].polynomial_fit_plot(6, plot=True)
Out[60]:
In [61]:
plt.figure()
SN2011fe.Lightcurves['V_10'].polynomial_fit_plot(8, plot=True)
Out[61]:
In [63]:
plt.figure()
SN2011fe.Lightcurves['V_10'].Bazin_fit_plot(plot=True)
Out[63]:
In [64]:
SN2011fe.Lightcurves['V_10'].Rchi2
Out[64]:
In [66]:
#create new supernovae object and load meta and Lightcurve data
SN2008es = Supernovae('../../../OSC_data/JSON_data/SN2008es.json')
SN2008es.load_LightCurves()
SN2008es.meta_data()
SN2008es.serialize()
In [ ]:
SN2008es = deserialize("../../../OSC_data/pickled_data/SN2008es.pickle")
In [68]:
#Matern_Kernel fit
plt.figure()
SN2008es.Lightcurves['B_2'].Gaussian_process(Matern_Kernel, plot=True)
Out[68]:
In [69]:
plt.figure()
SN2008es.Lightcurves['B_2'].Gaussian_process(Real_Kernel, plot=True)
Out[69]:
In [71]:
plt.figure()
SN2008es.Lightcurves['B_2'].Kapernka_fit_plot(plot=True)
Out[71]:
In [72]:
plt.figure()
SN2008es.Lightcurves['B_2'].polynomial_fit_plot(6, plot=True)
Out[72]:
In [73]:
plt.figure()
SN2008es.Lightcurves['B_2'].polynomial_fit_plot(8, plot=True)
Out[73]:
In [74]:
SN2008es.Lightcurves['B_2'].Rchi2
Out[74]:
In [75]:
#create new supernovae object and load meta and Lightcurve data
#create new supernovae object and load meta and Lightcurve data
SN2009ip = Supernovae('../../../OSC_data/JSON_data/SN2009ip.json')
SN2009ip.load_LightCurves()
SN2009ip.meta_data()
SN2009ip.serialize()
SN2009ip = deserialize("../../../OSC_data/pickled_data/SN2009ip.pickle")
In [76]:
SN2009ip = deserialize("../../../OSC_data/pickled_data/SN2009ip.pickle")
In [78]:
plt.figure()
SN2009ip.Lightcurves['B_7'].Gaussian_process(Matern_Kernel, plot=True)
Out[78]:
In [79]:
plt.figure()
SN2009ip.Lightcurves['B_7'].Gaussian_process(Real_Kernel, plot=True)
Out[79]:
In [80]:
plt.figure()
SN2009ip.Lightcurves['B_7'].polynomial_fit_plot(6, plot=True)
Out[80]:
In [81]:
plt.figure()
SN2009ip.Lightcurves['B_7'].polynomial_fit_plot(8, plot=True)
Out[81]:
In [82]:
SN2009ip.Lightcurves['B_7'].Rchi2
Out[82]:
In [2]:
#create new supernovae object and load meta and Lightcurve data
SN1999em = Supernovae('../../../OSC_data/JSON_data/SN1999em.json')
SN1999em.load_LightCurves()
SN1999em.meta_data()
SN1999em.serialize()
In [3]:
SN1999em = deserialize("../../../OSC_data/pickled_data/SN1999em.pickle")
In [86]:
plt.figure()
SN1999em.Lightcurves['B_1'].Gaussian_process(Matern_Kernel, plot=True)
Out[86]:
In [87]:
plt.figure()
SN1999em.Lightcurves['B_1'].Gaussian_process(Real_Kernel, plot=True)
Out[87]:
In [88]:
plt.figure()
SN1999em.Lightcurves['B_1'].Kapernka_fit_plot(plot = True)
Out[88]:
In [89]:
plt.figure()
SN1999em.Lightcurves['B_1'].polynomial_fit_plot(6, plot=True)
Out[89]:
In [90]:
plt.figure()
SN1999em.Lightcurves['B_1'].polynomial_fit_plot(8, plot=True)
Out[90]:
In [91]:
SN1999em.Lightcurves['B_1'].Rchi2
Out[91]:
In [3]:
SN2016fzm = deserialize('../../../OSC_data/pickled_data/SN2017uq.pickle')
In [26]:
Out[26]:
In [ ]: