Example #1
0
def test_export_hdf5():
    He = OpgMulti.open_file(BASE_DIR, reference_name, verbose=False)
    tmp_path = os.path.join(BASE_DIR, tmp_name + '.h5')
    He.write2hdf(tmp_path, Znum=[2])

    test = OpgHdf5.open_file(tmp_path, explicit_load=True)

    test.f.close()

    if os.path.exists(tmp_path):
        os.remove(tmp_path)
Example #2
0
def test_multi_read_write():
    He = OpgMulti.open_file(BASE_DIR, reference_name, verbose=False)
    tmp_file = os.path.join(BASE_DIR, 'tmp_name')

    try:
        He.write(tmp_file)

        # Open generated file to check there are no errors.
        He_new = OpgMulti.open_file(BASE_DIR, 'tmp_name', verbose=False)

        for key in He:
            yield assert_allclose, He[key], He_new[key]

    except:
        raise
    finally:
        for ext in ['opp', 'opr', 'opz', 'eps']:
            real_file = "{prefix}.{ext}.gz".format(prefix=tmp_file, ext=ext)
            if os.path.exists(real_file):
                os.remove(real_file)
Example #3
0
def test_export_hdf5():
    He = OpgMulti.open_file(BASE_DIR, reference_name, verbose=False)
    tmp_path = os.path.join(BASE_DIR, tmp_name+'.h5')
    He.write2hdf(tmp_path, Znum=[2])

    test = OpgHdf5.open_file(tmp_path, explicit_load=True)

    test.f.close()

    if os.path.exists(tmp_path):
        os.remove(tmp_path)
Example #4
0
def test_multi_read_write():
    He = OpgMulti.open_file(BASE_DIR, reference_name, verbose=False)
    tmp_file =  os.path.join(BASE_DIR, 'tmp_name')

    try:
        He.write(tmp_file)

        # Open generated file to check there are no errors.
        He_new = OpgMulti.open_file(BASE_DIR,  'tmp_name' , verbose=False)

        for key in He:
            yield assert_allclose, He[key] , He_new[key]

    except:
        raise
    finally:
        for ext in ['opp', 'opr', 'opz', 'eps']:
            real_file = "{prefix}.{ext}.gz".format(prefix=tmp_file, ext=ext)
            if os.path.exists(real_file):
                os.remove(real_file) 
Example #5
0
def test_multi_read():
    He = OpgMulti.open_file(BASE_DIR, reference_name, verbose=False)
Example #6
0
def test_multi_read():
    He = OpgMulti.open_file(BASE_DIR, reference_name, verbose=False)