<jupyter_start><jupyter_text>PLOT PCS<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
num_components_to_plot = 3<jupyter_output><empty_output><jupyter_text>KN PCs<jupyter_code>PCs_mixed = np.load(data_dir + "/mixed_pcs.npy", allow_pickle=True).item()
PCs_mixed = PCs_mixed['all'][0:num_components_to_plot]
var_mixed_dict = np.load(data_dir+"/pc_var_ratio_mixed_pcs.npy", allow_pickle=True).item()
var_mixed = var_mixed_dict['all']
markers = ['o','s','D','*','x']
fig = plt.figure(figsize=(10,5))

for i in range(num_components_to_plot):

    PC = PCs_mixed[i]
    x = np.arange(0,102,2)-50
    plt.plot(x,PC,marker=markers[i],label = "PC "+str(i+1), )

plt.xlabel("days since maximum", fontsize = 25)
plt.ylabel("PCs", fontsize=25)

plt.rc('xtick', labelsize=17)    
plt.rc('ytick', labelsize=17) 

plt.rc('legend', fontsize=15)
plt.legend()
plt.tight_layout()

plt.show()
markers = ['o','s','D','*','x']
fig = plt.figure(figsize=(10,5))
colors = ['#F5622E', '#15284F', '#3C8DFF']

for i in range(num_components_to_plot):

    PC = PCs_mixed[i]
    x = np.arange(0,102,2)-50
    variance = "{:.2f}".format(var_mixed[i])
    plt.plot(x,PC,marker=markers[i],label = "PC"+str(i+1) +", Var = "+ variance, color=colors[i])

plt.xlabel("days since maximum", fontsize = 25)
plt.ylabel("PCs", fontsize=25)

plt.rc('xtick', labelsize=17)    
plt.rc('ytick', labelsize=17) 

plt.rc('legend', fontsize=15)
plt.legend()
plt.tight_layout()

fig.savefig("results/"+"PCs_mixed.pdf")

plt.show()<jupyter_output><empty_output><jupyter_text>PC interpolation<jupyter_code>pcs_interpolated = np.load(data_dir + "/interpolated_mixed_pcs.npy", allow_pickle=True)
np.shape(pcs_interpolated)
x_interpolated = np.linspace(-50, 50, num=401, endpoint=True)
import numpy as np
fig = plt.figure(figsize=(10,5))
pc_names = ["PC1", "PC2", "PC3"]
colors = ['#F5622E', '#15284F', '#3C8DFF'] 
markers = ['o','s','D','*','x']
num_pc_components = 3

for i in range(num_pc_components):
    max_val = np.amax(np.abs(pcs_interpolated[i]))
    pcs_interpolated[i] = pcs_interpolated[i]/max_val
    PC = pcs_interpolated[i]
    plt.plot(x_interpolated, PC, label = pc_names[i], marker=markers[i], ms=5, color=colors[i])
    
ax = plt.gca()

plt.xlabel("days since maximum", fontsize=25)
plt.ylabel("normalized PCs", fontsize=25)
leg = ax.legend()

plt.rc('xtick', labelsize=17)    
plt.rc('ytick', labelsize=17) 

plt.rc('legend', loc='lower right', fontsize=15)
plt.legend()
plt.tight_layout()
plt.savefig("results/PCs_mixed_interpolated.pdf")
from astropy.table import Table
pc_generation_data = np.load(data_dir + "/PC_generation_dataset_mixed.npy", allow_pickle=True).item()
import matplotlib.pyplot as plt
def get_extracted_region(object_id, band, title):
    pos = np.where(np.asarray(pc_generation_data['object_ids']) == object_id)
    print(pos)
    band_data = pc_generation_data[band][pos]
    print(np.shape(band_data))
    x = np.linspace(-50, 50, num=51, endpoint=True)
    fig = plt.figure(figsize=(10,5))
    ax = plt.gca()
    #plt.axvline(x=0, ls="--", label="Day0", color='#15284F')
    
    plt.scatter(x, band_data.flatten(), c='#F5622E',label="r band")
    plt.axvspan(-2, +2, facecolor= '#D5D5D3', alpha=.25, lw=2, edgecolor ='#15284F', ls="--", label="region of max")
    plt.xticks(fontsize=22)
    plt.yticks(fontsize=22)
    plt.xlabel("Days since anchor", fontsize=30)
    plt.ylabel("FLUXCAL", fontsize=30)
    ax = plt.gca()
    leg = ax.legend(fontsize=17, loc='upper right')
    leg.set_title(title, prop={'size':17})
    plt.tight_layout()
    plt.savefig("results/perfect_single_band_extracted.pdf")
fig = get_extracted_region(2311, 'r', title='Extracted perfect lightcurve')<jupyter_output>(array([5]),)
(1, 51)
{'fraction_non_alphanumeric': 0.18736559139784947, 'fraction_numerical': 0.038978494623655914, 'mean_word_length': 5.827522935779816, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '583151', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1653, 'n_tokens_neox': 1518, 'n_words': 238, 'path': 'pc_generation/paper_plots.ipynb', 'repo_name': 'b-biswas/kn_ztf_detection', 'size': '3720'}