(self)
| 44 | shape = (10, 20) |
| 45 | |
| 46 | def setUp(self): |
| 47 | super().setUp() |
| 48 | |
| 49 | # The expression |
| 50 | self.expr = "2 * a*b + c" |
| 51 | # Define the NumPy variables to be used in expression |
| 52 | N = np.prod(self.shape) |
| 53 | self.a = a = np.arange(0, N, dtype="int32").reshape(self.shape) |
| 54 | self.b = b = np.arange(N, 2 * N, dtype="int64").reshape(self.shape) |
| 55 | self.c = c = np.arange(2 * N, 3 * N, dtype="int32").reshape(self.shape) |
| 56 | self.r1 = r1 = np.empty(N, dtype="int64").reshape(self.shape) |
| 57 | self.npvars = { |
| 58 | "a": a, |
| 59 | "b": b, |
| 60 | "c": c, |
| 61 | } |
| 62 | # Define other variables, if needed |
| 63 | root = self.h5file.root |
| 64 | if self.kind == "Array": |
| 65 | self.a = self.h5file.create_array(root, "a", a) |
| 66 | self.b = self.h5file.create_array(root, "b", b) |
| 67 | self.c = self.h5file.create_array(root, "c", c) |
| 68 | self.r1 = self.h5file.create_array(root, "r1", r1) |
| 69 | elif self.kind == "CArray": |
| 70 | self.a = self.h5file.create_carray( |
| 71 | root, "a", atom=tb.Atom.from_dtype(a.dtype), shape=self.shape |
| 72 | ) |
| 73 | self.b = self.h5file.create_carray( |
| 74 | root, "b", atom=tb.Atom.from_dtype(b.dtype), shape=self.shape |
| 75 | ) |
| 76 | self.c = self.h5file.create_carray( |
| 77 | root, "c", atom=tb.Atom.from_dtype(c.dtype), shape=self.shape |
| 78 | ) |
| 79 | self.r1 = self.h5file.create_carray( |
| 80 | root, "r1", atom=tb.Atom.from_dtype(r1.dtype), shape=self.shape |
| 81 | ) |
| 82 | self.a[:] = a |
| 83 | self.b[:] = b |
| 84 | self.c[:] = c |
| 85 | elif self.kind == "EArray": |
| 86 | shape = list(self.shape) |
| 87 | shape[0] = 0 |
| 88 | self.a = self.h5file.create_earray( |
| 89 | root, "a", atom=tb.Atom.from_dtype(a.dtype), shape=shape |
| 90 | ) |
| 91 | self.b = self.h5file.create_earray( |
| 92 | root, "b", atom=tb.Atom.from_dtype(b.dtype), shape=shape |
| 93 | ) |
| 94 | self.c = self.h5file.create_earray( |
| 95 | root, "c", atom=tb.Atom.from_dtype(c.dtype), shape=shape |
| 96 | ) |
| 97 | self.r1 = self.h5file.create_earray( |
| 98 | root, "r1", atom=tb.Atom.from_dtype(r1.dtype), shape=shape |
| 99 | ) |
| 100 | self.a.append(a) |
| 101 | self.b.append(b) |
| 102 | self.c.append(c) |
| 103 | self.r1.append(r1) # Fill with uninitialized values |
nothing calls this directly
no test coverage detected