當前位置: 首頁>>代碼示例>>Python>>正文


Python biggus.ArrayStack類代碼示例

本文整理匯總了Python中biggus.ArrayStack的典型用法代碼示例。如果您正苦於以下問題:Python ArrayStack類的具體用法?Python ArrayStack怎麽用?Python ArrayStack使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ArrayStack類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_order_incorrect_order

 def test_order_incorrect_order(self):
     # Specifying an unknown order.
     array1 = fake_array(0)
     array2 = fake_array(0)
     with self.assertRaisesRegexp(TypeError, 'order not understood'):
         ArrayStack.multidim_array_stack([array1, array2], (1, 2),
                                         order='random')
開發者ID:corinnebosley,項目名稱:biggus,代碼行數:7,代碼來源:test_ArrayStack.py

示例2: test_multidim_stack_multidim

 def test_multidim_stack_multidim(self):
     # Multidim stack of arrays shape (4, 6)
     arrays = np.array([[ConstantArray((), i) for i in range(6)] for
                        i in range(4)])
     msg = 'multidimensional stacks not yet supported'
     with self.assertRaisesRegexp(ValueError, msg):
         ArrayStack.multidim_array_stack(arrays, (3, 2, 4))
開發者ID:gdementen,項目名稱:biggus,代碼行數:7,代碼來源:test_ArrayStack.py

示例3: test_stack_order_c_numpy_array_t2

 def test_stack_order_c_numpy_array_t2(self):
     # 1D stack of arrays shape (6,)
     # alternate shape
     res = ArrayStack.multidim_array_stack(self.arrays, (2, 3), order='C')
     arr = np.array([i for i in range(6)])
     target = np.reshape(arr, (2, 3), order='C')
     self.assertTrue(np.array_equal(res.ndarray(), target))
開發者ID:corinnebosley,項目名稱:biggus,代碼行數:7,代碼來源:test_ArrayStack.py

示例4: test_stack_order_fortran_t1

 def test_stack_order_fortran_t1(self):
     # Fortran index ordering
     # 1D stack of arrays shape (6,)
     res = ArrayStack.multidim_array_stack(self.arrays, (3, 2), order='F')
     arr = np.array([i for i in range(6)])
     target = np.reshape(arr, (3, 2), order='F')
     self.assertTrue(np.array_equal(res.ndarray(), target))
開發者ID:corinnebosley,項目名稱:biggus,代碼行數:7,代碼來源:test_ArrayStack.py

示例5: test_stack_order_default

 def test_stack_order_default(self):
     # 1D stack of arrays shape (6,)
     # Ensure that the default index ordering corresponds to C.
     res = ArrayStack.multidim_array_stack(self.arrays, (3, 2))
     arr = np.array([i for i in range(6)])
     target = np.reshape(arr, (3, 2), order='C')
     self.assertTrue(np.array_equal(res.ndarray(), target))
開發者ID:corinnebosley,項目名稱:biggus,代碼行數:7,代碼來源:test_ArrayStack.py

示例6: data

 def data(self):
     if not self._structure_calculated:
         self._calculate_structure()
     if self._data_cache is None:
         data_arrays = [f._data for f in self.fields]
         self._data_cache = ArrayStack.multidim_array_stack(data_arrays, self.vector_dims_shape)
     return self._data_cache
開發者ID:QuLogic,項目名稱:iris,代碼行數:7,代碼來源:_fast_load_structured_fields.py

示例7: test_stack_order_c_list

 def test_stack_order_c_list(self):
     # 1D stack of arrays length  6
     res = ArrayStack.multidim_array_stack(self.arrays.tolist(), (3, 2),
                                           order='C')
     arr = np.array([i for i in range(6)])
     target = np.reshape(arr, (3, 2), order='C')
     self.assertTrue(np.array_equal(res.ndarray(), target))
開發者ID:gdementen,項目名稱:biggus,代碼行數:7,代碼來源:test_ArrayStack.py

示例8: test_stack_order_c_multidim

 def test_stack_order_c_multidim(self):
     # 1D stack of 6 arrays each (4, 5)
     arrays = [NumpyArrayAdapter(np.arange(20).reshape(4, 5)) for
               i in range(6)]
     res = ArrayStack.multidim_array_stack(arrays, (2, 3), order='C')
     arr = np.arange(20).reshape(4, 5) * np.ones((6, 4, 5))
     target = np.reshape(arr, (2, 3, 4, 5), order='C')
     self.assertTrue(np.array_equal(res.ndarray(), target))
開發者ID:corinnebosley,項目名稱:biggus,代碼行數:8,代碼來源:test_ArrayStack.py

示例9: test_stack_order_fortran_t2

 def test_stack_order_fortran_t2(self):
     # Fortran index ordering
     # 1D stack of arrays shape (6,)
     # alternate shape
     res = ArrayStack.multidim_array_stack(self.arrays, (2, 3), order='F')
     arr = np.arange(6)
     target = np.reshape(arr, (2, 3), order='F')
     self.assertTrue(np.array_equal(res.ndarray(), target))
開發者ID:QuLogic,項目名稱:biggus,代碼行數:8,代碼來源:test_ArrayStack.py

示例10: test_incompatible_shape

 def test_incompatible_shape(self):
     # 1D stack of arrays shape (6,)
     # Specifying a stack shape that is not feasible.
     msg = 'total size of new array must be unchanged'
     with self.assertRaisesRegexp(ValueError, msg):
         ArrayStack.multidim_array_stack(self.arrays, (3, 1), order='C')
開發者ID:corinnebosley,項目名稱:biggus,代碼行數:6,代碼來源:test_ArrayStack.py

示例11: test_stack_order_c_numpy_array_t1

 def test_stack_order_c_numpy_array_t1(self):
     # 1D stack of arrays shape (6,)
     res = ArrayStack.multidim_array_stack(self.arrays, (3, 2), order='C')
     arr = np.arange(6)
     target = np.reshape(arr, (3, 2), order='C')
     self.assertTrue(np.array_equal(res.ndarray(), target))
開發者ID:QuLogic,項目名稱:biggus,代碼行數:6,代碼來源:test_ArrayStack.py


注:本文中的biggus.ArrayStack類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。