When i running "./travis-run-tests.sh" app give me this error

18 views
Skip to first unread message

Emil Memmedzade

unread,
Feb 5, 2023, 1:13:46 PM2/5/23
to PyNE
Testing test_openmc_utils.py:

travis-run-tests.sh: 8: [: test_openmc_utils.py: unexpected operator
/home/emil/.local/lib/python3.8/site-packages/pyne/openmc_utils.py:39: UserWarning: The openmc (OpenMC Python API) could not be imported. Some aspects of the openmc module may be incomplete.
  warn(
......ES.SS
======================================================================
ERROR: test_openmc_utils.test_calc_structured_coords
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/emil/.local/lib/python3.8/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/emil/pyne/tests/test_openmc_utils.py", line 148, in test_calc_structured_coords
    exp_structured_coords = np.array(
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.

----------------------------------------------------------------------
Ran 11 tests in 0.006s

FAILED (SKIP=3, errors=1)
Testing failed on test_openmc_utils.py

Ahnaf Tahmid

unread,
Feb 14, 2023, 2:48:21 AM2/14/23
to PyNE
This error occurs because the numpy array is not uniform in shape. Specifically, the second row has one more element than the other rows. To fix this, remove the numpy array method. 

Change this line:

exp_structured_coords = np.array([[0.0, 0.5, 1.0], [0.0, 0.5, 1.0, 1.5, 2.0], [0.0, 0.6, 1.2, 1.8, 2.4, 3.0]])

To:

exp_structured_coords = [[0.0, 0.5, 1.0], [0.0, 0.5, 1.0, 1.5, 2.0], [0.0, 0.6, 1.2, 1.8, 2.4, 3.0]]

However, I have created a pull request to solve this issue.
Reply all
Reply to author
Forward
0 new messages