In [1]:
import json
import numpy as np
import matplotlib.pyplot as plt
import os, sys
from collections import Counter

In [3]:
path_to_SNe = '../gen_lightcurves/gp_smoothed/'
SNe_lightcurves = np.loadtxt(path_to_SNe + 'OSC_subset.LIST', dtype=bytes).astype(str)
print(SNe_lightcurves)

filters = []
for lcurve in SNe_lightcurves:
    lightcurve_path = path_to_SNe + lcurve
    #print(lightcurve_path)
    with open(path_to_SNe + lcurve) as f:
        lcurve_data = json.load(f)
    
    filters += [lcurve_data[filt]['mapping'] for filt in lcurve_data if lcurve_data[filt]['mapping'].endswith('to g')]
print(set(filters))


['SDSS-II_SN_18689_gpsmoothed.json' 'OGLE-2013-SN-075_gpsmoothed.json'
 'SN2006gr_gpsmoothed.json' ..., 'SN2012ec_gpsmoothed.json'
 'SN2006gu_gpsmoothed.json' 'SDSS-II_SN_15944_gpsmoothed.json']
{'V_CfA4_KEP1 to g', 'B_kait3 to g', 'g_CSP to g', 'B_CfA3_KEP to g', 'B_CfA3_4SH to g', 'B_Swift to g', 'B_NTT_Vega to g', 'B_kait2 to g', 'B_kait4 to g', 'V_CTIO-0.9m_Landolt to g', 'V_kait1 to g', 'gprime_SDSS_SDSS to g', 'B_CfA4_KEP2 to g', 'V_KAIT to g', 'V_CfA3_KEP to g', 'V_kait3 to g', 'V_Swift_Swift to g', 'V_NTT_Vega to g', 'V__CSP to g', 'Vprime_SWO_SDSS to g', 'g__CSP to g', 'B_Swift_Vega to g', 'V__Vega to g', 'V_CfA3_MINI to g', 'V_Swift_Vega to g', 'g_SNLS_Vega to g', 'V_EKAR_Vega to g', 'B__CSP to g', 'B_CfA3_MINI to g', 'B_KAIT to g', 'V_kait4 to g', 'gprime__SDSS to g'}

In [4]:
filter_set = set(filters)
master_counter = {}
for filt in filter_set:
    master_counter[filt] = Counter()
print(master_counter)

for lcurve in SNe_lightcurves:
    lightcurve_path = path_to_SNe + lcurve
    #print(lightcurve_path)
    with open(path_to_SNe + lcurve) as f:
        lcurve_data = json.load(f)
    
    if 'g' not in lcurve_data.keys():
        continue
    filter_mapping = lcurve_data['g']['mapping']
    if filter_mapping not in filter_set:
        continue
    
    sntype = lcurve_data['g']['type']
    if sntype != 'Ia':
        sntype = 'II'

    master_counter[filter_mapping].update([sntype])
for key in master_counter:
    print(key, master_counter[key])


{'V_EKAR_Vega to g': Counter(), 'B_kait3 to g': Counter(), 'V_Swift_Swift to g': Counter(), 'V_NTT_Vega to g': Counter(), 'V_CfA4_KEP1 to g': Counter(), 'V__CSP to g': Counter(), 'Vprime_SWO_SDSS to g': Counter(), 'B_CfA3_KEP to g': Counter(), 'g__CSP to g': Counter(), 'B_CfA4_KEP2 to g': Counter(), 'B_CfA3_4SH to g': Counter(), 'B_Swift to g': Counter(), 'V_CTIO-0.9m_Landolt to g': Counter(), 'V__Vega to g': Counter(), 'B_kait2 to g': Counter(), 'B_NTT_Vega to g': Counter(), 'V_CfA3_MINI to g': Counter(), 'V_Swift_Vega to g': Counter(), 'V_kait4 to g': Counter(), 'B_kait4 to g': Counter(), 'g_SNLS_Vega to g': Counter(), 'V_kait1 to g': Counter(), 'gprime_SDSS_SDSS to g': Counter(), 'V_KAIT to g': Counter(), 'V_CfA3_KEP to g': Counter(), 'gprime__SDSS to g': Counter(), 'V_kait3 to g': Counter(), 'B_CfA3_MINI to g': Counter(), 'B__CSP to g': Counter(), 'B_KAIT to g': Counter(), 'g_CSP to g': Counter(), 'B_Swift_Vega to g': Counter()}
V_EKAR_Vega to g Counter({'II': 1})
B_kait3 to g Counter({'Ia': 47, 'II': 2})
V_Swift_Swift to g Counter({'Ia': 1})
V_NTT_Vega to g Counter({'II': 1})
V_CfA4_KEP1 to g Counter({'II': 11})
V__CSP to g Counter({'Ia': 1})
Vprime_SWO_SDSS to g Counter({'II': 1})
B_CfA3_KEP to g Counter({'II': 15})
g__CSP to g Counter({'Ia': 64, 'II': 1})
B_CfA4_KEP2 to g Counter({'II': 2})
B_CfA3_4SH to g Counter({'II': 3})
B_Swift to g Counter({'II': 5, 'Ia': 1})
V_CTIO-0.9m_Landolt to g Counter({'II': 1})
V__Vega to g Counter({'II': 40})
B_kait2 to g Counter({'Ia': 21, 'II': 2})
B_NTT_Vega to g Counter({'II': 6})
V_CfA3_MINI to g Counter({'II': 2})
V_Swift_Vega to g Counter({'Ia': 61, 'II': 53})
V_kait4 to g Counter({'Ia': 9, 'II': 2})
B_kait4 to g Counter({'Ia': 7})
g_SNLS_Vega to g Counter({'II': 2})
V_kait1 to g Counter({'Ia': 2})
gprime_SDSS_SDSS to g Counter({'II': 1303, 'Ia': 735})
V_KAIT to g Counter({'II': 5})
V_CfA3_KEP to g Counter({'II': 6})
gprime__SDSS to g Counter({'II': 6})
V_kait3 to g Counter({'Ia': 3})
B_CfA3_MINI to g Counter({'II': 3})
B__CSP to g Counter({'Ia': 5})
B_KAIT to g Counter({'II': 19})
g_CSP to g Counter({'Ia': 1})
B_Swift_Vega to g Counter({'II': 4, 'Ia': 2})

In [ ]: