Example #1
0
def test_read_simu_info_hdf5(simulated_dl1_file):
    from lstchain.io.io import read_simu_info_hdf5

    mcheader = read_simu_info_hdf5(simulated_dl1_file)
    # simtel verion of the mc_gamma_testfile defined in test_lstchain
    assert mcheader.simtel_version == 1462392225
    assert mcheader.num_showers == 20000
Example #2
0
def test_read_simu_info_hdf5():
    mcheader = io.read_simu_info_hdf5(dl1_file)
    assert mcheader.simtel_version == 1462392225  # simtel verion of the mc_gamma_testfile defined in test_lstchain
    assert mcheader.num_showers == 20000
    events_filters = config["events_filters"]

    # nacteni pouze sloupcu s parametry
    param = pd.read_hdf(filename, key=args.dl1_params_camera_key)
    param = utils.filter_events(param, filters=events_filters)

    # energy histogram (thrown events)
    # - kazdy sloupec matice histogram je jeden bin v core distance
    # - kazdy radek je jeden bin v energii
    # - pro simulovane spektrum energii se musi poscitat vsechny sloupce - axis=1
    #hist = read_simtel_energy_histogram(filename)
    hist, hist_merged = read_simtel_energy_histogram_merged(filename)
    #print(hist)
    print('E_min [Tev]: {:.4f}, E_max [TeV]: {:.4f}, N_bins: {:d}'.format(min(hist.bins_energy), max(hist.bins_energy), len(hist.bins_energy)-1))

    mc_header = read_simu_info_hdf5(filename)
    #print(mc_header)

    # vyber jednoho ze simulovanych telescopu
    param = param.where(param.tel_id == args.telescope)
    param = param.dropna()
    print(param.count)

    # vyhozeni eventu co se nenafitovaly po prisnejsich tailcutech
    param = param[param['intensity'] > 0]
    param = param.dropna()
    print(param.count)

    # mc_energy = (10**param.mc_energy)/1000.0  # TeV, POZOR - param.mc_energy je v log10(GeV)
    mc_energy = param.mc_energy     # TeV v novych filech
    max_impact = mc_header.max_scatter_range