Пример #1
0
def test_snk_active(fname):
    # test data
    np.random.seed(0)
    edges = np.linspace(0, 1, 100)
    vals = np.random.rand(100)
    # write to disk
    sn = csv_dist_sink(fname)
    sn.write_dist(edges, vals)
def test_snk_active(fname):
    # test data
    np.random.seed(0)
    edges = np.linspace(0, 1, 100)
    vals = np.random.rand(100)
    # write to disk
    sn = csv_dist_sink(fname)
    sn.write_dist(edges, vals)
Пример #3
0
def test_round_trip_int_nr(fname):
    # test data
    np.random.seed(0)
    edges = np.arange(100)
    vals = np.arange(100)
    # write to disk
    sn = csv_dist_sink(fname)
    sn.activate()
    sn.write_dist(edges, vals)
    sn.deactivate()
    # read from disk
    sr = csv_dist_source(fname)
    sr.activate()
    bin_edges = sr.bin_edges()
    read_vals = sr.values()
    sr.deactivate()

    assert_almost_equal(read_vals, vals)
    assert_almost_equal(bin_edges, edges)
def test_round_trip_int_nr(fname):
    # test data
    np.random.seed(0)
    edges = np.arange(100)
    vals = np.arange(100)
    # write to disk
    sn = csv_dist_sink(fname)
    sn.activate()
    sn.write_dist(edges, vals)
    sn.deactivate()
    # read from disk
    sr = csv_dist_source(fname)
    sr.activate()
    bin_edges = sr.bin_edges()
    read_vals = sr.values()
    sr.deactivate()

    assert_almost_equal(read_vals, vals)
    assert_almost_equal(bin_edges, edges)
Пример #5
0
def test_snk_pickle(fname):
    sn = csv_dist_sink(fname)
    ck = pickle.dumps(sn)
    pickle.loads(ck)
def test_snk_pickle(fname):
    sn = csv_dist_sink(fname)
    ck = pickle.dumps(sn)
    pickle.loads(ck)