Beispiel #1
0
 def __init__(self, filename, label_type):
     """ This class yields events from pregenerated MC file.
     Parameters:
         filename : str; filename to read
         table_name : str; name of the table to read
                      currently available BinClassHits and SegClassHits
     """
     self.filename = filename
     if not isinstance(label_type, LabelType):
         raise ValueError(f'{label_type} not recognized!')
     self.label_type = label_type
     self.events = load_dst(filename, 'DATASET', 'EventsInfo')
     self.bininfo = load_dst(filename, 'DATASET', 'BinsInfo')
def test_cut_time_evolution_multievents(folder_test_dst,
                                        test_dst_file ):
    dst          = load_dst(folder_test_dst+test_dst_file, "DST", "Events").iloc[:1000]
    dst_uniquevs = dst.drop_duplicates('event')
    #make sure that the dataframe repeated 3x gives the same results as the original one
    mask_S1_ue   = np.random.choice([True, False], len(dst_uniquevs))
    dst_multievs = dst_uniquevs.append([dst_uniquevs]*2, ignore_index=True)
    mask_S1_me   = np.tile(mask_S1_ue, 3)
    mask_cut_ue  = masks_container(s1   = mask_S1_ue,
                                   s2   = mask_S1_ue,
                                   band = mask_S1_ue)
    mask_cut_me  = masks_container(s1   = mask_S1_me,
                                   s2   = mask_S1_me,
                                   band = mask_S1_me)
    min_time        = dst_uniquevs.time.min()
    max_time        = dst_uniquevs.time.max()
    ts_ue, masks_ue = get_time_series_df(time_bins  = 1,
                                         time_range = (min_time, max_time),
                                         dst        = dst_uniquevs)
    ts_me, masks_me = get_time_series_df(time_bins  = 1,
                                         time_range = (min_time, max_time),
                                         dst        = dst_multievs)
    pars_ue      = pd.DataFrame({'ts'   : ts_ue})
    pars_me      = pd.DataFrame({'ts'   : ts_me})
    pars_out_ue  = cut_time_evolution(masks_ue, dst_uniquevs, mask_cut_ue, pars_ue)
    pars_out_me  = cut_time_evolution(masks_me, dst_multievs, mask_cut_me, pars_me)
    assert_dataframes_close(pars_out_ue, pars_out_me)
Beispiel #3
0
def runfo_from_hdf(filename):
    """ read the runinfo from a h5 file
    inputs:
        filename : (str)  the filename of the h5 data
    output:
        pmaps    : (DFPmap) the pmaps (s1, s2, s2i) dataframes
    """
    #try:
    #    hdf = pd.HDFStore(filename)
#   #     dat = [hdf['s1'], hdf['s2'], hdf['s2si'], hdf['s1pmt'], hdf['s2pmt']]
#        dat = (hdf['s1'], hdf['s2'], hdf['s2si'])
#        return DFPmap(*dat)
    #except:
    try:
        runinfo = load_dst(filename, 'Run', 'events')
        return runinfo
    except:
        try:
            hd = pd.HDFStore(filename)
            keys = hd.keys()
            ok = ('/runinfo' in keys)
            if (not ok):
                raise IOError
            runinfo = hd['runinfo']
            return runinfo
        except:
            raise IOError
Beispiel #4
0
def load_hits_skipping_NN(DST_file_name, evt_number):
    """Return the Hits as PD DataFrames."""

    dst = load_dst(DST_file_name,'RECO','Events')
    dst_size = len(dst)
    all_events = {}

    event = dst.event.values
    time  = dst.time .values
    npeak = dst.npeak.values
    X     = dst.X    .values
    Y     = dst.Y    .values
    Z     = dst.Z    .values
    Q     = dst.Q    .values
    E     = dst.E    .values

    for i in range(dst_size):
        if event[i] == evt_number:
            current_event = all_events.setdefault(event[i],
                                                  HitCollection(event[i], time[i] * 1e-3))
            hit = Hit(npeak[i],
                      Cluster(Q[i], xy(X[i], Y[i]), xy(0, 0),
                              0, Z[i], E[i]), Z[i], E[i], xy(0, 0))
            if(hit.Q != NN):
                current_event.hits.append(hit)

    good_events = {}
    for event, hitc in all_events.items():
        if len(hitc.hits) > 0:
            good_events[event] = hitc

    return good_events
def test_cut_time_evolution_different_time_bins(folder_test_dst,
                                                test_dst_file ):
    dst                    = load_dst(folder_test_dst+test_dst_file, "DST", "Events")
    dst                    = dst.drop_duplicates('event')
    min_time               = dst.time.min()
    max_time               = dst.time.max()
    ts, masks_time         = get_time_series_df(time_bins  = 3,
                                                time_range = (min_time, max_time),
                                                dst        = dst)
    #set different probability of passing for different time bins, only for first mask
    probs_s1               = [0.9, 0.5, 0.1]

    mask_s1                = np.zeros(len(dst), dtype=bool)
    mask_s1[masks_time[0]] = np.random.choice([True, False], sum(masks_time[0]), p=(probs_s1[0], 1-probs_s1[0]))
    mask_s1[masks_time[1]] = np.random.choice([True, False], sum(masks_time[1]), p=(probs_s1[1], 1-probs_s1[1]))
    mask_s1[masks_time[2]] = np.random.choice([True, False], sum(masks_time[2]), p=(probs_s1[2], 1-probs_s1[2]))

    mask_cut               = masks_container(s1   = mask_s1,
                                             s2   = mask_s1,
                                             band = mask_s1)
    #the expected relative efficiencies for other cuts are 1 since the mask is repeated
    pars_expected          = pd.DataFrame({'ts':ts,
                                           'S1eff' : probs_s1,
                                           'S2eff': [1.]*3,
                                           'Bandeff':[1.]*3})
    pars                   = pd.DataFrame({'ts'   : ts})
    pars_out               = cut_time_evolution(masks_time, dst, mask_cut, pars)

    assert_dataframes_close(pars_expected, pars_out, atol=5e-2)
Beispiel #6
0
def load_map(filename,
             group  = "Radius",
             node   = "f100bins",
             x_name = 'PhiRms',
             y_name = 'Rpos',
             u_name = 'RposUncertainty'):
    dst = load_dst(filename, group, node)
    return Map((dst[x_name].values,),
                dst[y_name].values,
                dst[u_name].values)
Beispiel #7
0
def data(input_filename):

    try:
        hits = load_dst(input_filename, 'RECO', 'Events')
    except:
        print('Not able to load file : ', input_filename)
        raise IOError

    print('processing ', input_filename)

    return hits
def create_labels_data(list_filenames, en_range=(1.4,1.9)):
    full_csv = pd.DataFrame(columns=['filename', 'event', 'evt_energy', 'evt_ntrks', 'evt_r_max', 'evt_z_min', 'evt_z_max'])
    for filename in list_filenames:
        summary_df = load_dst(filename, 'Summary', 'Events')
        if summary_df is  None:
            print('skipping empty {}'.format(filename))
            continue
        summary_df = summary_df[['event', 'evt_energy', 'evt_ntrks', 'evt_r_max', 'evt_z_min', 'evt_z_max']][(summary_df.evt_energy>=en_range[0]) & (summary_df.evt_energy<=en_range[1])]
        summary_df.loc[:, 'filename'] = filename
        full_csv = pd.concat([full_csv, summary_df], ignore_index=True)
    #full_csv.to_csv(csv_files_name, index=False)                                                                                                                
    return full_csv
def test_correct_map_with_unsorted_dst(folder_test_dst, test_dst_file,
                                       output_maps_tmdir):
    """
    This test shuffles the input dst, and checks that the map is the same
    as the one created with the same sorted dst.
    """
    map_file_sort = os.path.join(output_maps_tmdir, 'test_out_map.h5')
    map_file_unsort = os.path.join(output_maps_tmdir, 'test_out_unsort.h5')
    histo_file_out = os.path.join(output_maps_tmdir, 'test_out_histo.h5')

    dst = load_dst(folder_test_dst + test_dst_file, 'DST', 'Events')
    if "index" in dst: del dst["index"]
    dst = dst.sort_values(by=['S2e'])
    tmp_unsorted_dst = 'unsorted_dst.h5'
    dst.to_hdf(output_maps_tmdir + tmp_unsorted_dst,
               key="DST",
               mode="w",
               format="table",
               data_columns=True,
               complib="zlib",
               complevel=4)
    with tb.open_file(output_maps_tmdir + tmp_unsorted_dst, "r+") as file:
        file.rename_node(file.root.DST.table, "Events")
        file.root.DST.Events.title = "Events"

    default_n_bins = 15
    run_number = 7517
    config = configure(
        'maps $ICARO/krcal/map_builder/config_LBphys.conf'.split())
    map_params_new = config.as_namespace.map_params
    map_params_new['nmin'] = 100
    map_params_new['z_range'] = (0, 10000)
    config.update(
        dict(folder=output_maps_tmdir,
             file_in=tmp_unsorted_dst,
             file_out_map=map_file_unsort,
             file_out_hists=histo_file_out,
             default_n_bins=default_n_bins,
             run_number=run_number,
             map_params=map_params_new))
    map_builder(config.as_namespace)
    unsorted_maps = read_maps(map_file_unsort)
    sorted_maps = read_maps(map_file_sort)

    assert_dataframes_close(unsorted_maps.e0, sorted_maps.e0, rtol=1e-5)
    assert_dataframes_close(unsorted_maps.e0u, sorted_maps.e0u, rtol=1e-5)
    assert_dataframes_close(unsorted_maps.lt, sorted_maps.lt, rtol=1e-5)
    assert_dataframes_close(unsorted_maps.ltu, sorted_maps.ltu, rtol=1e-5)
Beispiel #10
0
def test_map_writer(config_tmpdir, map_toy_data, bins, pos):
    output_file = os.path.join(config_tmpdir, "test_map.h5")

    _, (xs, ys, us) = map_toy_data

    group = "Radius"
    name = f"f{bins}bins"

    with tb.open_file(output_file, 'w') as h5out:
        write = map_writer(h5out, group=group, table_name=name)
        for x, y, u in zip(xs[pos], ys[pos], us[pos]):
            write(x, y, u)

    dst = load_dst(output_file, group=group, node=name)

    assert_allclose(xs[pos], dst.PhiRms.values)
    assert_allclose(ys[pos], dst.Rpos.values)
    assert_allclose(us[pos], dst.RposUncertainty.values)
Beispiel #11
0
def load_corrections(filename, *,
                     group  = "Corrections",
                     node   = "XYcorrections",
                     x_name = 'X',
                     y_name = 'Y',
                     f_name = 'Factor',
                     u_name = 'Uncertainty',
                     n_name = 'NEvt',
                     **kwargs):

    dst  = load_dst(filename, group, node)
    x, y = np.unique(dst[x_name].values), np.unique(dst[y_name].values)
    f, u = dst[f_name].values, dst[u_name].values
    n    = dst[n_name].values

    return Map((x, y),
               f.reshape(x.size, y.size),
               u.reshape(x.size, y.size),
               **kwargs)
Beispiel #12
0
def fill_kdst_histos(in_path, config_dict):
    """
    Creates and returns an HistoManager object with the kdst histograms.

    Arguments:
    in_path     = String with the path to the file(s) to be monitored.
    config_dict = Dictionary with the configuration parameters (bins, labels)
    """
    var_bins, var_labels = kdst_bins(config_dict)

    histo_manager = histf.create_histomanager_from_dicts(var_bins, var_labels)

    for in_file in glob.glob(in_path):
        var = defaultdict(list)
        kdst = load_dst(in_file, 'DST', 'Events')

        fill_kdst_var_1d(kdst, var)
        fill_kdst_var_2d(var)

        histo_manager.fill_histograms(var)
    return histo_manager
Beispiel #13
0
def test_correction_writer(config_tmpdir, corr_toy_data):
    output_file = os.path.join(config_tmpdir, "test_corr.h5")

    _, (x, y, F, U, N) = corr_toy_data

    group = "Corrections"
    name = "XYcorrections"

    with tb.open_file(output_file, 'w') as h5out:
        write = correction_writer(h5out, group=group, table_name=name)
        write(x, y, F, U, N)

    x, y = np.repeat(x, y.size), np.tile(y, x.size)
    F, U, N = F.flatten(), U.flatten(), N.flatten()

    dst = load_dst(output_file, group=group, node=name)
    assert_allclose(x, dst.X.values)
    assert_allclose(y, dst.Y.values)
    assert_allclose(F, dst.Factor.values)
    assert_allclose(U, dst.Uncertainty.values)
    assert_allclose(N, dst.NEvt.values)
def load_and_sel_data(fname):
    kdst = load_dst(fname, 'DST', 'Events')
    kdst = kdst[(kdst.nS1 == 1) & (kdst.nS2 == 1) & (kdst.R <= 198)]
    maxZ = np.quantile(kdst.Z, 0.99)
    kdst = kdst[kdst.Z < maxZ]

    file_bootstrap_map = '$ICDIR/database/test_data/kr_emap_xy_100_100_r_6573_time.h5'
    file_bootstrap_map = os.path.expandvars(file_bootstrap_map)
    boot_map = read_maps(file_bootstrap_map)
    emaps = e0_xy_correction(boot_map, norm_strat=norm_strategy.max)
    E0 = kdst.S2e.values * emaps(kdst.X.values, kdst.Y.values)

    sel_krband, _, _, _, _ = selection_in_band(kdst.Z,
                                               E0,
                                               range_z=(10, maxZ),
                                               range_e=(10.0e+3, 14e+3),
                                               nbins_z=50,
                                               nbins_e=50,
                                               nsigma=3.5)

    kdst = kdst[sel_krband].reset_index(drop=True)
    return kdst
def test_cut_time_evolution_different_cuts(folder_test_dst,
                                           test_dst_file ):

    dst                = load_dst(folder_test_dst + test_dst_file, "DST", "Events")
    dst                = dst.drop_duplicates('event')
    mask_S1            = np.random.choice([True, False], len(dst    ))
    mask_S2            = np.zeros_like(mask_S1, dtype=bool)
    mask_band          = np.zeros_like(mask_S1, dtype=bool)
    mask_S2[mask_S1]   = np.random.choice([True, False], sum(mask_S1))
    mask_band[mask_S2] = np.random.choice([True, False], sum(mask_S2))
    mask_cut           = masks_container(s1   = mask_S1,
                                         s2   = mask_S2,
                                         band = mask_band)
    min_time           = dst.time.min()
    max_time           = dst.time.max()
    ts, masks_time     = get_time_series_df(time_bins  = 1,
                                            time_range = (min_time, max_time),
                                            dst        = dst)
    pars               = pd.DataFrame({'ts':ts})
    pars_out           = cut_time_evolution(masks_time, dst, mask_cut, pars)
    pars_expected      = pd.DataFrame({'ts':ts, 'S1eff':0.5, 'S2eff':0.5, 'Bandeff':0.5})
    assert_dataframes_close(pars_expected, pars_out, atol=5e-2)
Beispiel #16
0
def KrMC_kdst(ICDATADIR):
    test_file = "Kr83_nexus_v5_03_00_ACTIVE_7bar_10evts_KDST.h5"
    test_file = os.path.join(ICDATADIR, test_file)

    wrong_file = "kdst_5881_map_lt.h5"
    wrong_file = os.path.join(ICDATADIR, wrong_file)

    group = "DST"
    node = "Events"

    configuration = dict(run_number=-4734,
                         drift_v=2 * units.mm / units.mus,
                         s1_nmin=1,
                         s1_nmax=1,
                         s1_emin=0 * units.pes,
                         s1_emax=30 * units.pes,
                         s1_wmin=100 * units.ns,
                         s1_wmax=500 * units.ns,
                         s1_hmin=0.5 * units.pes,
                         s1_hmax=10 * units.pes,
                         s1_ethr=0.37 * units.pes,
                         s2_nmin=1,
                         s2_nmax=2,
                         s2_emin=1e3 * units.pes,
                         s2_emax=1e8 * units.pes,
                         s2_wmin=1 * units.mus,
                         s2_wmax=20 * units.mus,
                         s2_hmin=500 * units.pes,
                         s2_hmax=1e5 * units.pes,
                         s2_ethr=1 * units.pes,
                         s2_nsipmmin=2,
                         s2_nsipmmax=1000,
                         global_reco_params=dict(Qthr=1 * units.pes,
                                                 Qlm=0 * units.pes,
                                                 lm_radius=-1 * units.mm,
                                                 new_lm_radius=-1 * units.mm,
                                                 msipm=1))

    event = [0, 1, 2, 3, 4, 5, 6, 7, 9]
    time = [0, 0, 0, 0, 0, 0, 0, 0, 0]
    s1_peak = [0, 0, 0, 0, 0, 0, 0, 0, 0]
    nS1 = [1, 1, 1, 1, 1, 1, 1, 1, 1]
    s2_peak = [0, 0, 0, 0, 0, 0, 0, 0, 0]
    nS2 = [1, 1, 1, 1, 1, 1, 1, 1, 1]

    S1w = [200., 200., 175., 175., 200., 175., 175., 250., 200.]
    S1h = [
        2.20967579, 4.76641989, 2.19646263, 2.28649235, 2.10444999, 2.80842876,
        1.66933489, 2.51325226, 1.45906901
    ]
    S1e = [
        11.79215431, 24.58425140, 11.20991993, 10.81333828, 10.09474468,
        15.06069851, 7.42862463, 18.16711235, 9.39478493
    ]
    S1t = [
        100225, 100100, 100150, 100125, 100100, 100150, 100150, 100175, 100150
    ]

    S2w = [8.300, 8.775, 9.575, 8.550, 11.175, 8.175, 6.800, 11.025, 6.600]
    S2h = [
        709.73730469, 746.38555908, 717.25158691, 1004.44152832, 972.86987305,
        1064.57861328, 1101.23962402, 532.64318848, 1389.43591309
    ]
    S2e = [
        3333.79321289, 3684.11181641, 3815.17578125, 4563.97412109,
        4995.36083984, 4556.64892578, 4572.18945313, 3301.98510742,
        5057.96923828
    ]
    S2q = [
        502.42642212, 520.74383545, 507.32211304, 607.92211914, 585.70526123,
        578.10437012, 595.45251465, 479.56573486, 633.57226563
    ]
    S2t = [
        424476.3, 495500.0, 542483.1, 392466.5, 277481.8, 373512.6, 322489.5,
        562502.9, 263483.5
    ]
    Nsipm = [13, 14, 15, 13, 12, 14, 14, 16, 12]

    DT = [
        324.25134277, 395.40005493, 442.33322144, 292.34155273, 177.38185120,
        273.36264038, 222.33953857, 462.32797241, 163.33348083
    ]
    Z = [
        648.50268555, 790.80010986, 884.66644287, 584.68310547, 354.76370239,
        546.72528076, 444.67907715, 924.65594482, 326.66696167
    ]
    Zrms = [
        1.71384448, 1.79561206, 1.95215662, 1.69040076, 2.67407129, 1.57506763,
        1.39490784, 2.27981592, 1.25179053
    ]
    X = [
        137.83250525, -137.61807146, 98.89289503, 45.59115903, -55.56241288,
        108.79125729, -65.40441501, 146.19707698, 111.82481626
    ]
    Y = [
        124.29040384, -99.36910382, 97.30389804, -136.05131238, -91.45151520,
        56.89100575, 130.07815715, 85.99513413, -43.18583024
    ]
    R = [
        185.59607752, 169.74378453, 138.73663273, 143.48697984, 107.00729581,
        122.76857985, 145.59555099, 169.61352662, 119.87412342
    ]
    Phi = [
        0.733780880, -2.51621137, 0.77729934, -1.24745421, -2.11675716,
        0.481828610, 2.03668828, 0.53170808, -0.36854640
    ]
    Xrms = [
        7.46121721, 8.06076669, 7.81822080, 7.57937056, 6.37266772,
        15.45983120, 7.42686347, 8.19314573, 7.17110860
    ]
    Yrms = [
        7.32118281, 7.63813330, 8.35199371, 6.93334565, 7.22325362, 7.49551110,
        7.32949621, 8.06191793, 6.26888356
    ]

    df_true = DataFrame({
        "event": event,
        "time": time,
        "nS1": nS1,
        "s1_peak": s1_peak,
        "nS2": nS2,
        "s2_peak": s2_peak,
        "S1w": S1w,
        "S1h": S1h,
        "S1e": S1e,
        "S1t": S1t,
        "S2w": S2w,
        "S2h": S2h,
        "S2e": S2e,
        "S2q": S2q,
        "S2t": S2t,
        "Nsipm": Nsipm,
        "DT": DT,
        "Z": Z,
        "Zrms": Zrms,
        "X": X,
        "Y": Y,
        "R": R,
        "Phi": Phi,
        "Xrms": Xrms,
        "Yrms": Yrms
    })

    df_read = load_dst(test_file, group=group, node=node)

    return dst_data(tbl_data(test_file, group, node), configuration, df_read,
                    df_true), tbl_data(wrong_file, group, node)
Beispiel #17
0
def load_rpos(filename, group="Radius", node="f100bins"):
    dst = load_dst(filename, group, node)
    return Correction((dst.RmsPhi.values, ), dst.Rpos.values,
                      dst.Uncertainty.values)
Beispiel #18
0
evt_number = int(sys.argv[3])
mc = int(sys.argv[4])
radius = int(sys.argv[5])

corrections    = "/Users/paola/Software/ic_data/corrections/corrections_run6352.h5"
time_evolution = "/Users/paola/Software/ic_data/corrections/Time_evolution_6352.h5"
LTcorrection = dstf.load_lifetime_xy_corrections(corrections,
                                                 group="XYcorrections",
                                                 node="Elifetime")
XYcorrection  = dstf.load_xy_corrections(corrections,
                                    group = "XYcorrections",
                                    node = f"Egeometry",
                                    norm_strategy = "index",
                                    norm_opts = {"index": (40,40)})

dv_dst  = load_dst(time_evolution, group="parameters", node="test")
dvs = dv_dst.dv.values
drift_velocity = dvs.mean()

if mc:
    correctionsLT   = "/Users/paola/Software/ic_data/corrections/corrections_run6198.h5"
    correctionsXY = "/Users/paola/Software/ic_data/corrections/corrections_MC_4734.h5"
    LTcorrection = dstf.load_lifetime_xy_corrections(correctionsLT,
                                                 group="XYcorrections",
                                                 node="Elifetime")

    XYcorrection  = dstf.load_xy_corrections(correctionsXY,
                                         group="XYcorrections",
                                         node="GeometryE_6.7mm",
                                         norm_strategy = "index",
                                         norm_opts = {"index": (40, 40)})
get_file_number = lambda filename: int(
    filename.split("/")[-1].split("_")[1].split(".")[0])


def get_pdata(filenames: list,
              nevents: int,
              /,
              background: str = None,
              region: str = None):

    np.random.shuffle(filenames)

    dsts = []
    selected = 0
    for filename in filenames:
        dst = load_dst(filename, "tracks", "events")
        in_file = dst.event.nunique()

        dst.loc[:, "nfile"] = get_file_number(filename)

        if background:
            dst.loc[:, "background"] = background
        if region:
            dst.loc[:, "region"] = region

        if (selected + in_file) < nevents:
            dsts.append(dst)
            selected += in_file
        elif (selected + in_file) >= nevents:
            n = nevents - selected
            events = np.random.choice(dst["event"].unique(),
Beispiel #20
0
def test_get_time_series_df_pandas(folder_test_dst, test_dst_file, n):
    kdst = load_dst(folder_test_dst + test_dst_file, 'DST', 'Events')
    time_indx = pd.cut(kdst.time, n, labels=np.arange(n))
    ts, masks = get_time_series_df(n, (kdst.time.min(), kdst.time.max()), kdst)
    for i, mask in enumerate(masks):
        assert_dataframes_equal(kdst[mask], kdst[time_indx == i])
Beispiel #21
0
def KrMC_hdst(ICDATADIR):
    test_file = "Kr83_nexus_v5_03_00_ACTIVE_7bar_10evts_HDST.h5"
    test_file = os.path.join(ICDATADIR, test_file)

    ZANODE = -9.425 * units.mm

    group = "RECO"
    node = "Events"

    configuration = dict(run_number=-4734,
                         rebin=2,
                         drift_v=2 * units.mm / units.mus,
                         s1_nmin=1,
                         s1_nmax=1,
                         s1_emin=0 * units.pes,
                         s1_emax=30 * units.pes,
                         s1_wmin=100 * units.ns,
                         s1_wmax=500 * units.ns,
                         s1_hmin=0.5 * units.pes,
                         s1_hmax=10 * units.pes,
                         s1_ethr=0.37 * units.pes,
                         s2_nmin=1,
                         s2_nmax=2,
                         s2_emin=1e3 * units.pes,
                         s2_emax=1e8 * units.pes,
                         s2_wmin=1 * units.mus,
                         s2_wmax=20 * units.mus,
                         s2_hmin=500 * units.pes,
                         s2_hmax=1e5 * units.pes,
                         s2_ethr=1 * units.pes,
                         s2_nsipmmin=2,
                         s2_nsipmmax=1000,
                         global_reco_params=dict(Qthr=1 * units.pes,
                                                 Qlm=0 * units.pes,
                                                 lm_radius=-1 * units.mm,
                                                 new_lm_radius=-1 * units.mm,
                                                 msipm=1),
                         slice_reco_params=dict(Qthr=2 * units.pes,
                                                Qlm=5 * units.pes,
                                                lm_radius=0 * units.mm,
                                                new_lm_radius=15 * units.mm,
                                                msipm=1))

    event = [0] * 7 + [1] * 10 + [2] * 8 + [3] * 5 + [4] * 8 + [5] * 9 + [
        6
    ] * 7 + [7] * 7 + [9] * 6
    time = [0] * 67
    peak = [0] * 67
    nsipm = [
        8, 9, 2, 9, 7, 1, 0, 7, 2, 8, 2, 9, 1, 2, 8, 1, 0, 5, 9, 2, 2, 9, 2, 8,
        4, 8, 9, 9, 7, 0, 7, 9, 3, 7, 7, 2, 9, 0, 5, 9, 2, 8, 3, 7, 2, 1, 0, 8,
        2, 9, 3, 1, 9, 3, 6, 9, 9, 8, 2, 8, 0, 7, 9, 2, 7, 2, 4
    ]

    X = [
        137.02335083, 136.05361214, 155, 137.50739563, 139.44340629, 135, 0.,
        -136.91523372, -138.31812254, -137.40236334, -139.36096871,
        -136.614188, -135., -155., -137.13894421, -135., 0., 96.69981723,
        97.48205345, 96.84759934, 115., 96.87320369, 115., 101.92102321,
        97.29559249, 43.04750178, 46.37438754, 45.18567591, 45.30916066, 0,
        -56.51582522, -56.16605278, -54.00613888, -55.77326839, -54.43059006,
        -52.08436199, -54.76790039, 0., 106.9129152, 108.02149081, 125.,
        111.23591207, 95., 109.36687514, 125., -35., 0, -66.81829731,
        -60.99443543, -65.21616666, -56.82709265, -85., -66.38902019,
        -67.16981495, 146.62612941, 145.98052086, 144.56275403, 146.57670316,
        165., 143.75471749, 0., 112.68567761, 113.05236723, 95., 112.18326138,
        95., 111.13948562
    ]

    Y = [
        123.3554201, 124.21305414, 130.32028088, 125.13468301, 125.723091,
        105., 0., -102.20454509, -85., -101.19527484, -85., -98.18372292,
        -115., -97.50736874, -97.65435292, -115., 0., 97.83535504, 96.71162732,
        115., 99.94110169, 96.96828871, 91.9964654, 96.47442012, 97.41483565,
        -135.46032693, -135.78741482, -135.45706672, -136.84192389, 0,
        -91.93474203, -92.22587474, -75., -91.79293263, -92.05845326, -75.,
        -93.17777252, 0, 60.37973152, 55.49979777, 58.7016448, 56.05515802,
        52.82336998, 57.04430991, 61.02136179, 65., 0., 131.35172348, 115.,
        131.55083652, 116.93600131, 125., 131.38450477, 127.55032531,
        86.4185202, 85.50276576, 85.08681108, 85.63406367, 92.12569852,
        87.37079899, 0., -41.26775923, -43.95642973, -42.01248503, -43.6128179,
        -39.43319563, -41.83429664
    ]

    Xrms = [
        6.82943353, 6.54561049, 0., 6.57516493, 6.10884172, 0., 0., 6.34641453,
        4.70863974, 6.99252219, 4.95899577, 6.99286177, 0., 0., 7.31434091, 0.,
        0., 5.46065169, 6.95289236, 3.88102693, 0., 7.08872666, 0., 6.12004979,
        4.20549403, 6.50762165, 6.53200551, 6.72634463, 6.63232452, 0.,
        6.01927117, 6.15010511, 7.21567172, 6.18867493, 6.68684705, 4.54482509,
        6.49772479, 0, 6.93471034, 6.73472262, 0., 6.23230238, 0., 6.60554616,
        0., 0., 0., 6.5619163, 4.90011206, 6.62430967, 7.32479932, 0.,
        6.44742043, 4.12189915, 5.39988073, 6.60345367, 6.72834925, 6.74313437,
        0., 7.29624974, 0., 6.91160248, 6.11943089, 0., 5.61844221, 0.,
        4.86842608
    ]

    Yrms = [
        7.53561556, 6.7267195, 4.98973147, 6.66971537, 6.72639992, 0., 0,
        7.6755039, 0., 6.32848615, 0., 6.5346365, 0., 4.33437301, 6.08928588,
        0., 0, 4.50714013, 7.16164783, 0., 4.99965309, 6.85733991, 4.5841167,
        6.9783623, 4.27982772, 6.75410279, 6.79005446, 6.72968451, 6.11981085,
        0, 5.70842513, 6.38557803, 0., 5.52636093, 5.17674174, 0., 6.9095478,
        0., 4.98555954, 6.83197289, 4.82848566, 6.69411227, 6.65765325,
        7.0682494, 4.89457047, 0., 0, 6.26325683, 0., 6.33195824, 3.95119122,
        0., 6.41624414, 4.35879501, 5.88461762, 7.49736328, 6.59322568,
        6.52422553, 4.52563872, 6.98159176, 0., 5.49357201, 6.10943873,
        4.57710651, 5.55130713, 4.9677694, 4.65138214
    ]

    Z = [
        642.291, 645.7665, 645.7665, 649.3726875, 653.05675, 653.05675,
        656.1485, 784.297, 784.297, 788.0405, 788.0405, 791.746, 791.746,
        791.746, 795.323, 795.323, 798.587875, 876.165125, 879.974125,
        879.974125, 879.974125, 883.695, 883.695, 887.402625, 891.02675,
        578.47125, 582.0140625, 585.5928125, 589.239125, 592.4990625, 350.6575,
        353.8748125, 353.8748125, 357.335875, 361.9025, 361.9025, 365.6785,
        368.9885, 540.8020625, 544.093625, 544.093625, 547.667375, 547.667375,
        551.231625, 551.231625, 551.231625, 554.582, 440.6051875, 440.6051875,
        443.814375, 443.814375, 443.814375, 447.4028125, 450.6166875, 916.4715,
        919.979, 923.716, 927.529125, 927.529125, 931.291125, 935.062625,
        320.8508125, 324.0374375, 324.0374375, 327.4530625, 327.4530625,
        330.653625
    ]

    Q = [
        6.21135249e+01, 1.93207452e+02, 1.17878785e+01, 1.52947767e+02,
        5.92023814e+01, 5.98997307e+00, NN, 5.11176143e+01, 7.79754877e+00,
        1.74522912e+02, 1.52560458e+01, 1.51785870e+02, 9.12431908e+00,
        1.20135555e+01, 6.86140332e+01, 5.19579268e+00, NN, 38.49134254,
        130.57549524, 12.6504097, 12.36747885, 158.67850065, 13.2809248,
        80.46449661, 18.56184649, 7.04285767e+01, 2.03529454e+02,
        2.23206003e+02, 7.24489250e+01, NN, 8.47140183e+01, 2.18426581e+02,
        1.07217135e+01, 8.33113148e+01, 6.86556058e+01, 8.63394284e+00,
        7.88299217e+01, NN, 2.79961238e+01, 1.58822554e+02, 1.55958052e+01,
        2.37206266e+02, 1.47270021e+01, 7.56110237e+01, 1.20107818e+01,
        5.01965523e+00, NN, 119.14831066, 13.13961554, 247.54202271,
        26.03989458, 6.0433917, 145.98711324, 21.32093287, 3.22954066e+01,
        7.83973203e+01, 1.35020741e+02, 1.22896467e+02, 7.75498104e+00,
        4.41479754e+01, NN, 61.85911345, 297.65047169, 14.66699696,
        208.5009613, 15.51440573, 14.46035504
    ]

    Ql = [-1] * len(Q)

    Qc = [-1] * len(Q)

    E = [
        300.67897224, 1031.45098773, 62.93038282, 1264.9021225, 574.87652458,
        58.16480385, 40.7894727, 261.72873756, 39.92444923, 1007.64861959,
        88.08432872, 1275.08688025, 76.64942446, 100.92063957, 663.7729013,
        50.26415467, 120.03185987, 255.05263805, 751.72643276, 72.82872899,
        71.19988891, 1293.0319564, 108.22297982, 1000.51422119, 262.59910393,
        358.72694397, 1477.87328339, 1833.91390991, 799.69952011, 93.7603054,
        435.34708595, 1719.97730608, 84.42701369, 1209.82822418, 439.89744612,
        55.32031015, 815.31221771, 235.25139713, 129.01727104, 988.40456541,
        97.05778352, 1980.85363294, 122.98172472, 876.96921053, 139.30621875,
        58.22012279, 163.83844948, 434.5464781, 47.92156618, 1774.64676229,
        186.6818979, 43.32551461, 1761.74893188, 323.31822968, 127.10046768,
        485.85840988, 1011.98860931, 919.25156787, 58.00637433, 525.53125763,
        174.24835968, 230.65227795, 1978.67551363, 97.50103056, 2193.99010015,
        163.2532165, 393.89710426
    ]

    El = [-1] * len(E)

    Ec = [-1] * len(E)

    Zc = [ZANODE] * len(E)

    Xpeak = [137.83250525] * 7 + [-137.61807157] * 10 + [98.89289499] * 8 + [
        45.59115902
    ] * 5 + [-55.56241282] * 8 + [108.79125728] * 9 + [-65.40441505] * 7 + [
        146.19707713
    ] * 7 + [111.82481627] * 6

    Ypeak = [124.29040397] * 7 + [-99.36910381] * 10 + [97.3038981] * 8 + [
        -136.05131239
    ] * 5 + [-91.45151521] * 8 + [56.89100565] * 9 + [130.07815717] * 7 + [
        85.995134
    ] * 7 + [-43.18583022] * 6

    df_true = DataFrame({
        "event": event,
        "time": time,
        "npeak": peak,
        "Xpeak": Xpeak,
        "Ypeak": Ypeak,
        "nsipm": nsipm,
        "X": X,
        "Y": Y,
        "Xrms": Xrms,
        "Yrms": Yrms,
        "Z": Z,
        "Q": Q,
        "E": E,
        "Ql": Ql,
        "El": El,
        "Qc": Qc,
        "Ec": Ec,
        "Zc": Zc
    })

    df_read = load_dst(test_file, group=group, node=node)

    return dst_data(tbl_data(test_file, group, node), configuration, df_read,
                    df_true)