Example #1
0
def test_read_simu_info_merged_hdf5(merged_h5file):
    from lstchain.io.io import read_simu_info_merged_hdf5

    mcheader = read_simu_info_merged_hdf5(merged_h5file)
    # simtel verion of the mc_gamma_testfile defined in test_lstchain
    assert mcheader.simtel_version == 1462392225
    assert mcheader.num_showers == 40000
# hipecta_d['dir'] = '/fefs/aswg/workspace/thomas.vuillaume/mchdf5/DL2/20190415/{particle}/south_pointing/20200410_vRTA_v0.4.5.post117+git62d122d_tailcuts_6_3_no_intercept/'
hipecta_d['dir'] = os.path.join('/fefs/aswg/workspace/thomas.vuillaume/mchdf5/DL2/20190415/{particle}/south_pointing/', hipecta_dir_id)


filename_simu = '/fefs/aswg/workspace/thomas.vuillaume/mchdf5/DL2/20190415/gamma/south_pointing/20200529_vRTA_v0.5.1_v00/dl2_gamma_south_pointing_20200529_vRTA_v0.5.1_v00_DL1_testing.h5'

particles = ['gamma', 'proton', 'electron']

# La Palma
for dic in [lstchain_d, hipecta_d]:
    for particle in particles:
        particle_dir = dic['dir'].format(particle=particle)
        filename = [os.path.join(particle_dir, f) for f in os.listdir(particle_dir) if 'testing' in f][0]
        dic[particle] = {}
        dic[particle]['filename'] = filename
        dic[particle]['simu_info'] = read_simu_info_merged_hdf5(filename_simu)
        dic[particle]['events'] = pd.read_hdf(filename, key=dl2_params_lstcam_key)
        
        # some rescaling 
#         if dic is hipecta_d:
#             dic[particle]['events']['reco_energy'] *= 1e3
#             dic[particle]['events']['log_mc_energy'] += 3
#             dic[particle]['events']['log_reco_energy'] += 3

        
# # laptop where all files are in the same dir
# for dic in [lstchain_d, hipecta_d]:
#     files = [os.path.join(dic['dir'], f) for f in os.listdir(dic['dir']) if f.endswith('.h5')]
#     for f in files:
#         for p in particles:
#             if p in f:
Example #3
0
def test_read_simu_info_merged_hdf5():
    mcheader = io.read_simu_info_merged_hdf5(merged_dl1_file)
    assert mcheader.simtel_version == 1462392225  # simtel verion of the mc_gamma_testfile defined in test_lstchain
    assert mcheader.num_showers == 40000