
# coding: utf-8

# In[31]:


import numpy as np
from time import time
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import pandas as pd
import pdspy.modeling as modeling
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.animation import FuncAnimation
from mpl_toolkits.mplot3d import Axes3D 
import os
import pickle

import george
from george import kernels
from scipy.optimize import minimize



# In[3]:


param_names = ["T_star","logL_star","logM_disk","logR_disk","h_0","logR_in",          "gamma","beta","logM_env","logR_env","f_cav","ksi","loga_max","p","incl"]

# get all model data
with open ('../grid_metadata/corefull.txt', 'rb') as fp:
    core= pickle.load(fp)
with open ('../grid_metadata/cubefull.txt', 'rb') as fp:
    cube = np.array(pickle.load(fp))
with open ('../grid_metadata/cubefull.txt', 'rb') as fp:
    nancube = np.array(pickle.load(fp))
    
# x values (wavelengths) - 500 values, in normal space
with open ('../grid_metadata/xvals.txt', 'rb') as fp:
    xvals = pickle.load(fp)
    
dictionary=np.load("../grid_metadata/dictionary.npy")


# In[4]:


plt.figure(figsize=(12,10))
plt.plot(np.log10(xvals),cube[16])
plt.xlabel("log(Wavelength) - microns").set_fontsize(16)
plt.ylabel("log(Flux Density) - Janskys").set_fontsize(16)
plt.tick_params(labelsize=12)
plt.title("example SED generated by pdspy",pad=20).set_fontsize(20)
plt.savefig("sample.png")
