Ejemplo n.º 1
0
def test_distHistoReader_first_last():
    reader = postproc_io.distHistoReader(directory=out_directory,
                                         first=2,
                                         last=8,
                                         verbose=False)
    writer = postproc_io.DummyWriter(source=reader)
    writer.dump()
Ejemplo n.º 2
0
def test_average_filter_all():
    n_tot = 100
    n_bins = 1024
    reader = postproc_io.DummyReader(n_histogram_sets=n_tot,
                                     n_bins=n_bins,
                                     random=False)
    average = postproc_filter.Average(source=reader, n_avg='all')
    counter = FrameCounter(source=average)
    keeper = KeepLastFrame(source=counter)
    writer = postproc_io.DummyWriter(source=keeper)
    writer.dump()
    # consistency checks
    assert (counter.count == 1)
    # check the last processed frame
    frm = keeper.last_frame
    keys = frm.get_keys(base.loc_histograms, skip_keys='radii')
    for key in keys:
        histo = frm.get_data(base.loc_histograms + '/' + key)
        assert (np.sum(histo, dtype=np.int) == n_bins)
Ejemplo n.º 3
0
def test_average_filter():
    n_tot = 100
    n_avg = 10
    n_bins = 1024
    # create histograms filled with ones
    reader = postproc_io.DummyReader(n_histogram_sets=n_tot,
                                     n_bins=n_bins,
                                     random=False)
    average = postproc_filter.Average(source=reader, n_avg=n_avg)
    counter = FrameCounter(source=average)
    keeper = KeepLastFrame(source=counter)
    writer = postproc_io.DummyWriter(source=keeper)
    writer.dump()
    # consistency checks
    frame_indices_expected = np.arange(n_avg, n_tot + 1, n_avg)
    frame_indices_measured = np.array(counter.frames)
    assert (np.isclose(counter.count, n_tot / n_avg))
    assert np.allclose(frame_indices_measured, frame_indices_expected)
    # check the last processed frame
    frm = keeper.last_frame
    keys = frm.get_keys(base.loc_histograms, skip_keys='radii')
    for key in keys:
        histo = frm.get_data(base.loc_histograms + '/' + key)
        assert (np.sum(histo, dtype=np.int) == n_bins)
Ejemplo n.º 4
0
def test_H5Reader():
    reader = postproc_io.H5Reader(file=h5name, verbose=False)
    writer = postproc_io.DummyWriter(source=reader)
    writer.dump()
Ejemplo n.º 5
0
def test_distHistoReader_step():
    reader = postproc_io.distHistoReader(directory=out_directory,
                                         step=2,
                                         verbose=False)
    writer = postproc_io.DummyWriter(source=reader)
    writer.dump()
Ejemplo n.º 6
0
def test_DummyReader_DummyWriter():
    reader = postproc_io.DummyReader()
    writer = postproc_io.DummyWriter(source=reader)
    writer.dump()
Ejemplo n.º 7
0
def test_dummy_filter():
    reader = postproc_io.DummyReader()
    filtre = postproc_filter.Dummy(source=reader)
    writer = postproc_io.DummyWriter(source=filtre)
    writer.dump()