"""A set of unit tests of the Capriqorn preprocessor HDF5 IO code. """ from builtins import range from six.moves import range import cadishi.base as base import cadishi.util as util import capriqorn.preproc.io as preproc_io import capriqorn.preproc.filter as preproc_filter from capriqorn.testing import reader do_cleanup = True h5name = util.scratch_dir() + "test_preproc_io_hdf5.h5" h5tmp = util.scratch_dir() + "test_preproc_io_hdf5_tmp.h5" # --- tests below --- def test_H5Writer(): reader = preproc_io.DummyReader(n_frames=5, n_elems=7, n_atoms=2048) writer = preproc_io.H5Writer(h5name, source=reader) writer.dump() def test_H5Reader(): reader = preproc_io.H5Reader(h5name) writer = preproc_io.DummyWriter(source=reader)
def test_final_cleanup(): util.rmrf(util.scratch_dir())
# Copyright (c) Juergen Koefinger, Klaus Reuter, and contributors. # See the file AUTHORS.rst for the full list of contributors. # # Released under the GNU Public Licence, v2 or any higher version, see the file LICENSE.txt. """A set of unit tests of the Capriqorn post-processing IO code. """ import sys import os import glob import cadishi.util as util from capriqorn.postproc import io as postproc_io from capriqorn.postproc import filter as postproc_filter do_cleanup = True out_directory = util.scratch_dir() h5name = out_directory + "histograms.h5" def test_DummyReader_DummyWriter(): reader = postproc_io.DummyReader() writer = postproc_io.DummyWriter(source=reader) writer.dump() def test_distHistoWriter(): reader = postproc_io.DummyReader() writer = postproc_io.distHistoWriter(source=reader, directory=out_directory, write_txt=True, verbose=False)
# Copyright (c) Juergen Koefinger, Klaus Reuter, and contributors. # See the file AUTHORS.rst for the full list of contributors. # # Released under the GNU Public Licence, v2 or any higher version, see the file LICENSE.txt. """Unit tests to test cadishi.io.hdf5. Located within Capriqorn due to the depencency of the dummy reader. """ from cadishi import base from cadishi import util from cadishi.io import hdf5 from capriqorn.preproc.io import dummy do_cleanup = True h5file = util.scratch_dir() + "test_cadishi_io_hdf5.h5" def test_h5writer(): reader = dummy.DummyReader(verbose=True) writer = hdf5.H5Writer(source=reader, file=h5file, verbose=True) writer.dump() def test_h5reader(): reader = hdf5.H5Reader(file=h5file, verbose=True) writer = dummy.DummyWriter(source=reader, verbose=True) writer.dump() def test_h5reader_file_list():
def test_xyz_pipeline(): reader = preproc_io.DummyReader() filtre = preproc_filter.XYZ(source=reader, output_directory=util.scratch_dir()) writer = preproc_io.DummyWriter(source=filtre) writer.dump()
# Copyright (c) Juergen Koefinger, Klaus Reuter, and contributors. # See the file AUTHORS.rst for the full list of contributors. # # Released under the GNU Public Licence, v2 or any higher version, see the file LICENSE.txt. """A set of unit tests of the Capriqorn preprocessor pipeline code. """ import numpy as np import cadishi.base as base import cadishi.util as util import capriqorn.preproc.io as preproc_io import capriqorn.preproc.filter as preproc_filter from capriqorn.testing import reader do_cleanup = True h5name = util.scratch_dir() + "test_preproc_pipeline.h5" def test_simple_pipeline(): reader = preproc_io.DummyReader() filtre = preproc_filter.Dummy(source=reader) writer = preproc_io.DummyWriter(source=filtre) writer.dump() def test_xyz_pipeline(): reader = preproc_io.DummyReader() filtre = preproc_filter.XYZ(source=reader, output_directory=util.scratch_dir()) writer = preproc_io.DummyWriter(source=filtre) writer.dump()
import sys import os import glob import cadishi.util as util import capriqorn.preproc.io as preproc_io import capriqorn.preproc.filter as preproc_filter from capriqorn.testing import reader # output to HDF5, the default ("False") is to output to ASCII files use_hdf5 = True # unlink any output files in the end do_clean = True out_suffix = util.scratch_dir() + "capriqorn_" # --- for convenience, wrap the writer of choice if use_hdf5: class wrap_writer(preproc_io.H5Writer): def __init__(self, filename, source): preproc_io.H5Writer.__init__( self, file=filename + ".h5", source=source) else: class wrap_writer(preproc_io.ASCIIWriter): pass # --- unit test routines below --- def test_virtual_particles_basic(reader):
def test_final_cleanup(): for file in glob.glob(tmpfile + '*'): util.rmrf(util.scratch_dir())
# Released under the GNU Public Licence, v2 or any higher version, see the file LICENSE.txt. """Unit tests to test cadishi.base.container and cadishi.pickel. Even though this file tests some functionality of Cadishi, it is packaged with capriqorn because it requires dummy.DummyReader() to have a source for test data. """ import glob from cadishi import base from cadishi import util from cadishi.io import pickel from capriqorn.preproc.io import dummy do_cleanup = True tmpfile = util.scratch_dir() + "test_cadishi_io_pickle_" def test_picklewriter(): reader = dummy.DummyReader(verbose=True, n_frames=3) writer = pickel.PickleWriter(source=reader, file=tmpfile, verbose=True) writer.dump() def test_picklereader(): reader = pickel.PickleReader(file=tmpfile, first=1, last=3, verbose=True) writer = dummy.DummyWriter(source=reader, verbose=True) writer.dump() if do_cleanup: