Example #1
0
def test_load_sim_split():
    df_train_0, df_test_0 = load_sim(config='IC86.2012',
                                     energy_reco=False,
                                     log_energy_min=None,
                                     log_energy_max=None,
                                     test_size=0.5)
    df_train_1, df_test_1 = load_sim(config='IC86.2012',
                                     energy_reco=False,
                                     log_energy_min=None,
                                     log_energy_max=None,
                                     test_size=0.5)
    pd.testing.assert_frame_equal(df_train_0, df_train_1)
    pd.testing.assert_frame_equal(df_test_0, df_test_1)
Example #2
0
def test_load_sim_energy_reco(energy_reco):
    df = load_sim(test_size=0,
                  energy_reco=energy_reco,
                  log_energy_min=None,
                  log_energy_max=None)

    assert ('reco_log_energy' in df.columns) == energy_reco
Example #3
0
def test_load_sim_log_energy_max():
    log_energy_max = 7.5
    df = load_sim(test_size=0,
                  energy_reco=False,
                  energy_cut_key='MC_log_energy',
                  log_energy_min=None,
                  log_energy_max=log_energy_max)

    np.testing.assert_allclose(log_energy_max,
                               df['MC_log_energy'].max(),
                               rtol=1e-2)
Example #4
0
def test_load_sim_test_size():
    test_size = 0.4
    df_train, df_test = load_sim(test_size=test_size,
                                 energy_reco=False,
                                 log_energy_min=None,
                                 log_energy_max=None)

    n_train = len(df_train)
    n_test = len(df_test)

    np.testing.assert_allclose(n_test / (n_test + n_train),
                               test_size,
                               rtol=1e-2)