Exemple #1
0
def xes(request):
    # warnings.filterwarnings("error")
    data = pd.DataFrame([
        dict(s1=56.,
             s2=2905.,
             drift_time=143465.,
             x=2.,
             y=0.4,
             z=-20,
             r=2.1,
             theta=0.1,
             event_time=1579784955000000000),
        dict(s1=23,
             s2=1080.,
             drift_time=445622.,
             x=1.12,
             y=0.35,
             z=-59.,
             r=1.,
             theta=0.3,
             event_time=1579784956000000000)
    ])
    if request.param == 'ER':
        x = fd.ERSource(data.copy(), batch_size=2, max_sigma=8)
    elif request.param == 'NR':
        x = fd.NRSource(data.copy(), batch_size=2, max_sigma=8)
    elif request.param == 'WIMP':
        x = fd.WIMPSource(data.copy(), batch_size=2, max_sigma=8)
    elif request.param == 'ER_spatial':
        nbins = 100
        r = np.linspace(0, 47.9, nbins + 1)
        z = np.linspace(-97.6, 0, nbins + 1)
        theta = np.linspace(0, 2 * np.pi, nbins + 1)

        # Construct PDF histogram
        h = Histdd(bins=[r, theta, z], axis_names=['r', 'theta', 'z'])
        h.histogram = np.ones((nbins, nbins, nbins))

        # Calculate bin volumes for cylindrical coords (r dr dtheta)
        r_c, _, _ = h.bin_centers()
        bin_volumes = h.bin_volumes() * r_c[:, np.newaxis, np.newaxis]

        # Convert to events per bin histogram
        h.histogram *= bin_volumes

        class ERSpatial(fd.ERSource):
            spatial_rate_hist = h
            spatial_rate_bin_volumes = bin_volumes

        x = ERSpatial(data.copy(), batch_size=2, max_sigma=8)
    return x
Exemple #2
0
def xes(request):
    # warnings.filterwarnings("error")
    data = pd.DataFrame([
        dict(s1=56.,
             s2=2905.,
             drift_time=143465.,
             x=2.,
             y=0.4,
             z=-20,
             r=2.1,
             theta=0.1,
             event_time=1483488000000000000),
        dict(s1=23,
             s2=1080.,
             drift_time=445622.,
             x=1.12,
             y=0.35,
             z=-59.,
             r=1.,
             theta=0.3,
             event_time=1483488000000000000)
    ])
    if request.param == 'ER':
        x = fd.ERSource(data.copy(), batch_size=2, max_sigma=8)
    elif request.param == 'NR':
        x = fd.NRSource(data.copy(), batch_size=2, max_sigma=8)
    elif request.param == 'WIMP':
        x = fd.WIMPSource(data.copy(), batch_size=2, max_sigma=8)
    elif request.param == 'ER_spatial':
        nbins = 100
        r = np.linspace(0, 47.9, nbins + 1)
        z = np.linspace(-97.6, 0, nbins + 1)
        theta = np.linspace(0, 2 * np.pi, nbins + 1)

        h = Histdd(bins=[r, theta, z], axis_names=['r', 'theta', 'z'])
        h.histogram = np.ones((nbins, nbins, nbins))

        class ERSpatial(fd.ERSource):
            spatial_hist = h

        x = ERSpatial(data.copy(), batch_size=2, max_sigma=8)
    return x