<jupyter_start><jupyter_text>This cell is in the Raw format. Convert it to Code if you wish to plot other light curves. get 2 of each objectlc_snia = matrix[Ia_flag].sample(n=1)lc_galaxy = matrix[galaxy_flag].sample(n=1)lc_multobj = matrix[multiple_obj_flag].sample(n=1)lc_star = matrix[star_flag].sample(n=1)lcs = pd.concat([lc_snia, lc_galaxy, lc_multobj, lc_star], ignore_index=True)ids = lcs['id'].values<jupyter_code>ids = [1424192755315015009, 1452439215115010000, 1277247161915010000,
       1385238050715015010]
data_raw = pd.read_csv('../../../../referee/data/raw.csv.gz')
ids_flag = np.array([data_raw['candid'].values[i] in ids for i in range(data_raw.shape[0])])
all_lcs = data_raw[ids_flag]
lcs = convert_full_dataset(all_lcs)
all_lcs[['objectId', 'candid', 'TNS', 'cdsxmatch']]
c = ['#15284F', '#F5622E']

filters = list(np.unique(lcs['FLT'].values))

features = []

for name in ids:
    
    ax = {}

    lc_flag = lcs['id'].values == name
    lc_indiv = lcs[lc_flag]

    features_flag = matrix['id'].values == name
    features_indiv = matrix[features_flag]
    features.append(features_indiv)

    plt.figure(figsize=(10,5))

    for f in filters:
        if f == 'r':
            plt.subplot(1,2, filters.index(f) + 1, sharey=ax['g'])
        else:
            plt.subplot(1,2, filters.index(f) + 1)
            
        filter_flag = lc_indiv['FLT'].values == f
        lc_filter = lc_indiv[filter_flag]
    
        # compute the derivative
        deriv_ewma = get_ewma_derivative(lc_filter['FLUXCAL'], 3)
        data_masked = lc_filter.mask(deriv_ewma < 0)
        rising_data = data_masked.dropna()
    
        x = np.arange(0, max(rising_data['MJD']) - min(rising_data['MJD']), 0.4)
    
        y = get_predicted_flux(x, features_indiv['a_' + f].values[0], features_indiv['b_' + f].values[0], 
                           features_indiv['c_' + f].values[0]) 
    
        ax[f] = plt.gca()
        plt.errorbar(lc_filter['MJD'] - min(rising_data['MJD']), 
                     y=lc_filter['FLUXCAL'], yerr=lc_filter['FLUXCALERR'], 
                     fmt='o', label=f, color=c[filters.index(f)])
        plt.plot(x, y, ls='--', lw=2, color=c[filters.index(f)])
    
        plt.xlim(-0.5, 1.4*max(x))

        legend = plt.legend(loc='lower right', fontsize=14, frameon=False,
                            title = 'class: ' + features_indiv['type'].values[0]) 
        plt.setp(legend.get_title(), fontsize=14)
        plt.xlabel('days since first epoch', fontsize=14)
        plt.ylim()
        if f == 'g':
            plt.ylabel('FLUXCAL', fontsize=14)
        
        if f == 'r':
            plt.setp(ax['r'].get_yticklabels(), visible=False)
        
    plt.tight_layout()
    #plt.show()
    plt.savefig('../../../../referee/plots/LC_' + features_indiv['type'].values[0] + '.pdf')
df_features = pd.concat(features, ignore_index=True)
features_subset_transposed = df_features.T
features_subset_transposed<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1632996632996633, 'fraction_numerical': 0.04141414141414142, 'mean_word_length': 2.9772423025435075, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '568308', 'license': 'MIT', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1097, 'n_words': 176, 'path': 'code/plots/02_light_curves.ipynb', 'repo_name': 'emilleishida/fink_sn_activelearning', 'size': '2970'}