Beispiel #1
0
def create_source_file():
    source = get_silicon_element()

    input_file_path = get_current_module_path(
        __file__, "../test_data/test_Element.hdf5")
    hdf5_file = write(input_file_path)

    source.write(hdf5_file)
Beispiel #2
0
    def write(self):
        hdf5_file = write(self.input_file_path)

        group = hdf5_file.require_group(GROUP_SIMULATION)
        group.attrs[ATTRIBUTE_VERSION] = self.version

        self.options.write(group)
        self.results.write(group)
Beispiel #3
0
def create_source_file():
    material = get_silicon_material()

    input_file_path = get_current_module_path(
        __file__, "../test_data/test_Material.hdf5")
    hdf5_file = write(input_file_path)

    material.write(hdf5_file)
Beispiel #4
0
def create_source_file():
    source = Source()
    source.position_nm = Point(-1, -2, -3)
    source.direction = Point(0.2, 0.4, 0.6)
    source.kinetic_energy_keV = 53.1156
    source.mass_amu = 68.93
    source.atomic_number = 31

    input_file_path = get_current_module_path(__file__,
                                              "../test_data/test_Source.hdf5")
    hdf5_file = write(input_file_path)

    source.write(hdf5_file)
Beispiel #5
0
def test_write(tmpdir):
    file_path = tmpdir.join("output.hdf5")
    point = Point(-1, -2, -3)

    hdf5_file = write(file_path)
    point.write(hdf5_file)
    hdf5_file.close()

    point = Point(1, 2, 3)
    hdf5_file = read(file_path)
    point.read(hdf5_file)
    assert point.x == -1
    assert point.y == -2
    assert point.z == -3
Beispiel #6
0
def test_write(tmpdir):
    file_path = tmpdir.join("output.hdf5")

    element = get_silicon_element()

    hdf5_file = write(file_path)
    element.write(hdf5_file)
    hdf5_file.close()

    element = Element()
    hdf5_file = read(file_path)
    element.read(hdf5_file)

    assert element != get_vacuum_element()
    assert element == get_silicon_element()
Beispiel #7
0
def test_write(tmpdir):
    file_path = tmpdir.join("output.hdf5")

    material = get_silicon_material()

    hdf5_file = write(file_path)
    material.write(hdf5_file)
    hdf5_file.close()

    material = Material()
    hdf5_file = read(file_path)
    material.read(hdf5_file)

    assert material != get_vacuum_material()
    material_si = get_silicon_material()
    assert material == material_si
Beispiel #8
0
def test_write_read(tmpdir):
    file_path = tmpdir.join("output.hdf5")

    hdf5_file = write(file_path)
    assert hdf5_file.filename == file_path
    assert hdf5_file.mode == "r+"
    assert hdf5_file.driver == "core"
    assert hdf5_file.userblock_size == 0

    hdf5_file.close()

    hdf5_file = read(file_path)
    assert hdf5_file.filename == file_path
    assert hdf5_file.mode == "r"
    assert hdf5_file.driver == "core"
    assert hdf5_file.userblock_size == 0
def test_write(tmpdir):
    file_path = tmpdir.join("output.hdf5")

    source = Source()
    source.position_nm = Point(-1, -2, -3)
    source.direction = Point(0.2, 0.4, 0.6)
    source.kinetic_energy_keV = 53.1156
    source.mass_amu = 68.93
    source.atomic_number = 31

    hdf5_file = write(file_path)
    source.write(hdf5_file)
    hdf5_file.close()

    source = Source()
    hdf5_file = read(file_path)
    source.read(hdf5_file)
    _compare_values(source)
Beispiel #10
0
def create_point_file():
    input_file_path = get_current_module_path(__file__, "test_Point.hdf5")
    hdf5_file = write(input_file_path)

    point = Point(1, 2, 3)
    point.write(hdf5_file)