Esempio n. 1
0
def pytest_funcarg__filled_sdcube(request):
    filename = 'myfile.hdf5'
    if os.path.exists(filename):
        os.remove(filename)
    filled_sdcube = SdCube('filled', filename, ['x', 'y', 'z'])
    filled_sdcube.create_dataset(
        {'x':[d('1'), d('2'), d('7.0')],
        'y':['a', 'b', 'c'],
        'z':[d('1.0'), d('2.0'), d('3.0')]})
    return filled_sdcube
Esempio n. 2
0
def pytest_funcarg__filled_complicated_sdcube(request):
    filename = 'myfile.hdf5'
    if os.path.exists(filename):
        os.remove(filename)
    filled_sdcube = SdCube('filled', filename, ['x', 'y'])
    filled_sdcube.create_dataset(
        {'x':[d('1'), d('2')],
        'y':['a', 'b', 'c']})
    filled_sdcube.set_data({'x':d('1'), 'y':'a'}, arange(2*3).reshape((2,3)))
    filled_sdcube.create_dataset(
        {'x':[d('3')],
        'y':['a', 'b', 'c']})
    filled_sdcube.set_data({'x':d('3'), 'y':'a',}, 7 +
            arange(1*3).reshape((1,3)))
    filled_sdcube.create_dataset(
        {'x':[d('3')],
        'y':['d', 'e', 'f']})
    filled_sdcube.set_data({'x':d('3'), 'y':'d'}, 11 +
            arange(1*3).reshape((1,3)))
    filled_sdcube.create_dataset(
        {'x':[d('1'), d('2'), d('5')],
        'y':['d', 'e']})
    filled_sdcube.set_data({'x':d('1'), 'y':'d'}, 15 +
            arange(3*2).reshape((3,2)))

    # And this is what it looks like
    # Note: the datasets are seperated
    #          y
    #     a  b  c  d  e  f #
    #----------------------#
    # |1| 0  1  2  15 16   #
    # |2| 3  4  5  17 18   #
    #x|3| 7  8  9  11 12 13#
    # |5|          19 20   #
    ########################

    return filled_sdcube