-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenerate_test_data.py
More file actions
31 lines (21 loc) · 850 Bytes
/
generate_test_data.py
File metadata and controls
31 lines (21 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
import h5py
import numpy
import logging
def gen_async_data():
logging.info("Generating async_example_data")
# first we want a test case that's of the shape (4, 128, 64, 64)
shape = (4, 128, 64, 64)
with h5py.File("tests/async_example_data") as data:
# clear all of the information from the file first
data.clear()
# now add the information
info = numpy.ones(shape)
refine = numpy.ones(shape[0])
coords = numpy.ones((shape[0], 3))
data.create_dataset("data", shape=shape, data=info)
data.create_dataset("refine level", shape=(shape[0],), data=refine)
data.create_dataset("coordinates", shape=(shape[0], 3), data=coords)
if __name__ == '__main__':
logging.basicConfig(format="[%(levelname)s] %(message)s")
gen_async_data()