Hi, I am new to pysph and installed it on my Windows 10.
My environment is configured as follows:
Python version :3.8.5
Cython version :0.29.21
mayavi :4.7.1
mako :1.1.0
I did not occupy these python files,but when I run "pysph test -v", I get the following error:
======================================================= ERRORS ========================================================
_______________________ ERROR at teardown of TestOutputNumpy.test_dump_and_load_with_constants ________________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpy testMethod=test_dump_and_load_with_constants>
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:56:
d:\miniconda3\lib\shutil.py:516: in rmtree
return _rmtree_unsafe(path, onerror)
d:\miniconda3\lib\shutil.py:400: in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
path = 'C:\Users\wsh\AppData\Local\Temp\tmpuxvqkv4s'
onerror = <function rmtree..onerror at 0x000002578062E318>
def _rmtree_unsafe(path, onerror):
try:
with os.scandir(path) as scandir_it:
entries = list(scandir_it)
except OSError:
onerror(os.scandir, path, sys.exc_info())
entries = []
for entry in entries:
fullname = entry.path
try:
is_dir = entry.is_dir(follow_symlinks=False)
except OSError:
is_dir = False
if is_dir:
try:
if entry.is_symlink():
# This can only happen if someone replaces
# a directory with a symlink after the call to
# os.scandir or entry.is_dir above.
raise OSError("Cannot call rmtree on a symbolic link")
except OSError:
onerror(os.path.islink, fullname, sys.exc_info())
continue
_rmtree_unsafe(fullname, onerror)
else:
try:
E PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\Users\wsh\AppData\Local\Temp\tmpuxvqkv4s\simple.npz'
d:\miniconda3\lib\shutil.py:398: PermissionError
___________________ ERROR at teardown of TestOutputNumpy.test_dump_and_load_with_partial_data_dump ____________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpy testMethod=test_dump_and_load_with_partial_data_dump>
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:56:
d:\miniconda3\lib\shutil.py:516: in rmtree
return _rmtree_unsafe(path, onerror)
d:\miniconda3\lib\shutil.py:400: in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
path = 'C:\Users\wsh\AppData\Local\Temp\tmppaaog6vf'
onerror = <function rmtree..onerror at 0x000002578062E288>
def _rmtree_unsafe(path, onerror):
try:
with os.scandir(path) as scandir_it:
entries = list(scandir_it)
except OSError:
onerror(os.scandir, path, sys.exc_info())
entries = []
for entry in entries:
fullname = entry.path
try:
is_dir = entry.is_dir(follow_symlinks=False)
except OSError:
is_dir = False
if is_dir:
try:
if entry.is_symlink():
# This can only happen if someone replaces
# a directory with a symlink after the call to
# os.scandir or entry.is_dir above.
raise OSError("Cannot call rmtree on a symbolic link")
except OSError:
onerror(os.path.islink, fullname, sys.exc_info())
continue
_rmtree_unsafe(fullname, onerror)
else:
try:
E PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\Users\wsh\AppData\Local\Temp\tmppaaog6vf\simple.npz'
d:\miniconda3\lib\shutil.py:398: PermissionError
______________________ ERROR at teardown of TestOutputNumpy.test_dump_and_load_works_by_default _______________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpy testMethod=test_dump_and_load_works_by_default>
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:56:
d:\miniconda3\lib\shutil.py:516: in rmtree
return _rmtree_unsafe(path, onerror)
d:\miniconda3\lib\shutil.py:400: in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
path = 'C:\Users\wsh\AppData\Local\Temp\tmp7zfuh7qv'
onerror = <function rmtree..onerror at 0x000002578062E1F8>
def _rmtree_unsafe(path, onerror):
try:
with os.scandir(path) as scandir_it:
entries = list(scandir_it)
except OSError:
onerror(os.scandir, path, sys.exc_info())
entries = []
for entry in entries:
fullname = entry.path
try:
is_dir = entry.is_dir(follow_symlinks=False)
except OSError:
is_dir = False
if is_dir:
try:
if entry.is_symlink():
# This can only happen if someone replaces
# a directory with a symlink after the call to
# os.scandir or entry.is_dir above.
raise OSError("Cannot call rmtree on a symbolic link")
except OSError:
onerror(os.path.islink, fullname, sys.exc_info())
continue
_rmtree_unsafe(fullname, onerror)
else:
try:
E PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\Users\wsh\AppData\Local\Temp\tmp7zfuh7qv\simple.npz'
d:\miniconda3\lib\shutil.py:398: PermissionError
_____________________ ERROR at teardown of TestOutputNumpy.test_dump_and_load_works_with_compress _____________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpy testMethod=test_dump_and_load_works_with_compress>
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:56:
d:\miniconda3\lib\shutil.py:516: in rmtree
return _rmtree_unsafe(path, onerror)
d:\miniconda3\lib\shutil.py:400: in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
path = 'C:\Users\wsh\AppData\Local\Temp\tmpbd4xv9li'
onerror = <function rmtree..onerror at 0x000002578062E9D8>
def _rmtree_unsafe(path, onerror):
try:
with os.scandir(path) as scandir_it:
entries = list(scandir_it)
except OSError:
onerror(os.scandir, path, sys.exc_info())
entries = []
for entry in entries:
fullname = entry.path
try:
is_dir = entry.is_dir(follow_symlinks=False)
except OSError:
is_dir = False
if is_dir:
try:
if entry.is_symlink():
# This can only happen if someone replaces
# a directory with a symlink after the call to
# os.scandir or entry.is_dir above.
raise OSError("Cannot call rmtree on a symbolic link")
except OSError:
onerror(os.path.islink, fullname, sys.exc_info())
continue
_rmtree_unsafe(fullname, onerror)
else:
try:
E PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\Users\wsh\AppData\Local\Temp\tmpbd4xv9li\simplez.npz'
d:\miniconda3\lib\shutil.py:398: PermissionError
__________________ ERROR at teardown of TestOutputNumpy.test_that_output_array_information_is_saved ___________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpy testMethod=test_that_output_array_information_is_saved>
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:56:
d:\miniconda3\lib\shutil.py:516: in rmtree
return _rmtree_unsafe(path, onerror)
d:\miniconda3\lib\shutil.py:400: in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
path = 'C:\Users\wsh\AppData\Local\Temp\tmplwpanhdu'
onerror = <function rmtree..onerror at 0x000002578062E4C8>
def _rmtree_unsafe(path, onerror):
try:
with os.scandir(path) as scandir_it:
entries = list(scandir_it)
except OSError:
onerror(os.scandir, path, sys.exc_info())
entries = []
for entry in entries:
fullname = entry.path
try:
is_dir = entry.is_dir(follow_symlinks=False)
except OSError:
is_dir = False
if is_dir:
try:
if entry.is_symlink():
# This can only happen if someone replaces
# a directory with a symlink after the call to
# os.scandir or entry.is_dir above.
raise OSError("Cannot call rmtree on a symbolic link")
except OSError:
onerror(os.path.islink, fullname, sys.exc_info())
continue
_rmtree_unsafe(fullname, onerror)
else:
try:
E PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\Users\wsh\AppData\Local\Temp\tmplwpanhdu\simple.npz'
d:\miniconda3\lib\shutil.py:398: PermissionError
______________________ ERROR at teardown of TestOutputNumpyV1.test_load_works_with_dump_version1 ______________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpyV1 testMethod=test_load_works_with_dump_version1>
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:170:
d:\miniconda3\lib\shutil.py:516: in rmtree
return _rmtree_unsafe(path, onerror)
d:\miniconda3\lib\shutil.py:400: in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
path = 'C:\Users\wsh\AppData\Local\Temp\tmpeoneh1mo'
onerror = <function rmtree..onerror at 0x000002578062E318>
def _rmtree_unsafe(path, onerror):
try:
with os.scandir(path) as scandir_it:
entries = list(scandir_it)
except OSError:
onerror(os.scandir, path, sys.exc_info())
entries = []
for entry in entries:
fullname = entry.path
try:
is_dir = entry.is_dir(follow_symlinks=False)
except OSError:
is_dir = False
if is_dir:
try:
if entry.is_symlink():
# This can only happen if someone replaces
# a directory with a symlink after the call to
# os.scandir or entry.is_dir above.
raise OSError("Cannot call rmtree on a symbolic link")
except OSError:
onerror(os.path.islink, fullname, sys.exc_info())
continue
_rmtree_unsafe(fullname, onerror)
else:
try:
E PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\Users\wsh\AppData\Local\Temp\tmpeoneh1mo\simple.npz'
d:\miniconda3\lib\shutil.py:398: PermissionError
====================================================== FAILURES =======================================================
_____________________________________ TestOctreeFor1DDataset.test_levels_in_tree ______________________________________
self = <pysph.base.tests.test_octree.TestOctreeFor1DDataset testMethod=test_levels_in_tree>
self.x = np.linspace(0, 1, num=N)
d:\miniconda3\lib\site-packages\pysph\base\tests\test_octree.py:192:
<array_function internals>:6: in linspace
???
start = 0, stop = 1, num = 100000.0, endpoint = True, retstep = False, dtype = None, axis = 0
@array_function_dispatch(_linspace_dispatcher)
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
axis=0):
"""
Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].
The endpoint of the interval can optionally be excluded.
.. versionchanged:: 1.16.0
Non-scalar `start` and `stop` are now supported.
Parameters
----------
start : array_like
The starting value of the sequence.
stop : array_like
The end value of the sequence, unless `endpoint` is set to False.
In that case, the sequence consists of all but the last of ``num + 1``
evenly spaced samples, so that `stop` is excluded. Note that the step
size changes when `endpoint` is False.
num : int, optional
Number of samples to generate. Default is 50. Must be non-negative.
endpoint : bool, optional
If True, `stop` is the last sample. Otherwise, it is not included.
Default is True.
retstep : bool, optional
If True, return (`samples`, `step`), where `step` is the spacing
between samples.
dtype : dtype, optional
The type of the output array. If `dtype` is not given, infer the data
type from the other input arguments.
.. versionadded:: 1.9.0
axis : int, optional
The axis in the result to store the samples. Relevant only if start
or stop are array-like. By default (0), the samples will be along a
new axis inserted at the beginning. Use -1 to get an axis at the end.
.. versionadded:: 1.16.0
Returns
-------
samples : ndarray
There are `num` equally spaced samples in the closed interval
``[start, stop]`` or the half-open interval ``[start, stop)``
(depending on whether `endpoint` is True or False).
step : float, optional
Only returned if `retstep` is True
Size of spacing between samples.
See Also
--------
arange : Similar to `linspace`, but uses a step size (instead of the
number of samples).
geomspace : Similar to `linspace`, but with numbers spaced evenly on a log
scale (a geometric progression).
logspace : Similar to `geomspace`, but with the end points specified as
logarithms.
Examples
--------
>>> np.linspace(2.0, 3.0, num=5)
array([2. , 2.25, 2.5 , 2.75, 3. ])
>>> np.linspace(2.0, 3.0, num=5, endpoint=False)
array([2. , 2.2, 2.4, 2.6, 2.8])
>>> np.linspace(2.0, 3.0, num=5, retstep=True)
(array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25)
Graphical illustration:
>>> import matplotlib.pyplot as plt
>>> N = 8
>>> y = np.zeros(N)
>>> x1 = np.linspace(0, 10, N, endpoint=True)
>>> x2 = np.linspace(0, 10, N, endpoint=False)
>>> plt.plot(x1, y, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.plot(x2, y + 0.5, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.ylim([-0.5, 1])
(-0.5, 1)
>>> plt.show()
"""
num = operator.index(num)
E TypeError: 'float' object cannot be interpreted as an integer
d:\miniconda3\lib\site-packages\numpy\core\function_base.py:113: TypeError
_____________________________________ TestOctreeFor1DDataset.test_parent_for_node _____________________________________
self = <pysph.base.tests.test_octree.TestOctreeFor1DDataset testMethod=test_parent_for_node>
self.x = np.linspace(0, 1, num=N)
d:\miniconda3\lib\site-packages\pysph\base\tests\test_octree.py:192:
<array_function internals>:6: in linspace
???
start = 0, stop = 1, num = 100000.0, endpoint = True, retstep = False, dtype = None, axis = 0
@array_function_dispatch(_linspace_dispatcher)
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
axis=0):
"""
Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].
The endpoint of the interval can optionally be excluded.
.. versionchanged:: 1.16.0
Non-scalar `start` and `stop` are now supported.
Parameters
----------
start : array_like
The starting value of the sequence.
stop : array_like
The end value of the sequence, unless `endpoint` is set to False.
In that case, the sequence consists of all but the last of ``num + 1``
evenly spaced samples, so that `stop` is excluded. Note that the step
size changes when `endpoint` is False.
num : int, optional
Number of samples to generate. Default is 50. Must be non-negative.
endpoint : bool, optional
If True, `stop` is the last sample. Otherwise, it is not included.
Default is True.
retstep : bool, optional
If True, return (`samples`, `step`), where `step` is the spacing
between samples.
dtype : dtype, optional
The type of the output array. If `dtype` is not given, infer the data
type from the other input arguments.
.. versionadded:: 1.9.0
axis : int, optional
The axis in the result to store the samples. Relevant only if start
or stop are array-like. By default (0), the samples will be along a
new axis inserted at the beginning. Use -1 to get an axis at the end.
.. versionadded:: 1.16.0
Returns
-------
samples : ndarray
There are `num` equally spaced samples in the closed interval
``[start, stop]`` or the half-open interval ``[start, stop)``
(depending on whether `endpoint` is True or False).
step : float, optional
Only returned if `retstep` is True
Size of spacing between samples.
See Also
--------
arange : Similar to `linspace`, but uses a step size (instead of the
number of samples).
geomspace : Similar to `linspace`, but with numbers spaced evenly on a log
scale (a geometric progression).
logspace : Similar to `geomspace`, but with the end points specified as
logarithms.
Examples
--------
>>> np.linspace(2.0, 3.0, num=5)
array([2. , 2.25, 2.5 , 2.75, 3. ])
>>> np.linspace(2.0, 3.0, num=5, endpoint=False)
array([2. , 2.2, 2.4, 2.6, 2.8])
>>> np.linspace(2.0, 3.0, num=5, retstep=True)
(array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25)
Graphical illustration:
>>> import matplotlib.pyplot as plt
>>> N = 8
>>> y = np.zeros(N)
>>> x1 = np.linspace(0, 10, N, endpoint=True)
>>> x2 = np.linspace(0, 10, N, endpoint=False)
>>> plt.plot(x1, y, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.plot(x2, y + 0.5, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.ylim([-0.5, 1])
(-0.5, 1)
>>> plt.show()
"""
num = operator.index(num)
E TypeError: 'float' object cannot be interpreted as an integer
d:\miniconda3\lib\site-packages\numpy\core\function_base.py:113: TypeError
________________________________________ TestOctreeFor1DDataset.test_plot_root ________________________________________
self = <pysph.base.tests.test_octree.TestOctreeFor1DDataset testMethod=test_plot_root>
self.x = np.linspace(0, 1, num=N)
d:\miniconda3\lib\site-packages\pysph\base\tests\test_octree.py:192:
<array_function internals>:6: in linspace
???
start = 0, stop = 1, num = 100000.0, endpoint = True, retstep = False, dtype = None, axis = 0
@array_function_dispatch(_linspace_dispatcher)
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
axis=0):
"""
Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].
The endpoint of the interval can optionally be excluded.
.. versionchanged:: 1.16.0
Non-scalar `start` and `stop` are now supported.
Parameters
----------
start : array_like
The starting value of the sequence.
stop : array_like
The end value of the sequence, unless `endpoint` is set to False.
In that case, the sequence consists of all but the last of ``num + 1``
evenly spaced samples, so that `stop` is excluded. Note that the step
size changes when `endpoint` is False.
num : int, optional
Number of samples to generate. Default is 50. Must be non-negative.
endpoint : bool, optional
If True, `stop` is the last sample. Otherwise, it is not included.
Default is True.
retstep : bool, optional
If True, return (`samples`, `step`), where `step` is the spacing
between samples.
dtype : dtype, optional
The type of the output array. If `dtype` is not given, infer the data
type from the other input arguments.
.. versionadded:: 1.9.0
axis : int, optional
The axis in the result to store the samples. Relevant only if start
or stop are array-like. By default (0), the samples will be along a
new axis inserted at the beginning. Use -1 to get an axis at the end.
.. versionadded:: 1.16.0
Returns
-------
samples : ndarray
There are `num` equally spaced samples in the closed interval
``[start, stop]`` or the half-open interval ``[start, stop)``
(depending on whether `endpoint` is True or False).
step : float, optional
Only returned if `retstep` is True
Size of spacing between samples.
See Also
--------
arange : Similar to `linspace`, but uses a step size (instead of the
number of samples).
geomspace : Similar to `linspace`, but with numbers spaced evenly on a log
scale (a geometric progression).
logspace : Similar to `geomspace`, but with the end points specified as
logarithms.
Examples
--------
>>> np.linspace(2.0, 3.0, num=5)
array([2. , 2.25, 2.5 , 2.75, 3. ])
>>> np.linspace(2.0, 3.0, num=5, endpoint=False)
array([2. , 2.2, 2.4, 2.6, 2.8])
>>> np.linspace(2.0, 3.0, num=5, retstep=True)
(array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25)
Graphical illustration:
>>> import matplotlib.pyplot as plt
>>> N = 8
>>> y = np.zeros(N)
>>> x1 = np.linspace(0, 10, N, endpoint=True)
>>> x2 = np.linspace(0, 10, N, endpoint=False)
>>> plt.plot(x1, y, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.plot(x2, y + 0.5, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.ylim([-0.5, 1])
(-0.5, 1)
>>> plt.show()
"""
num = operator.index(num)
E TypeError: 'float' object cannot be interpreted as an integer
d:\miniconda3\lib\site-packages\numpy\core\function_base.py:113: TypeError
_________________ TestOctreeFor1DDataset.test_sum_of_indices_lengths_equals_total_number_of_particles _________________
self = <pysph.base.tests.test_octree.TestOctreeFor1DDataset testMethod=test_sum_of_indices_lengths_equals_total_number_of_particles>
self.x = np.linspace(0, 1, num=N)
d:\miniconda3\lib\site-packages\pysph\base\tests\test_octree.py:192:
<array_function internals>:6: in linspace
???
start = 0, stop = 1, num = 100000.0, endpoint = True, retstep = False, dtype = None, axis = 0
@array_function_dispatch(_linspace_dispatcher)
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
axis=0):
"""
Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].
The endpoint of the interval can optionally be excluded.
.. versionchanged:: 1.16.0
Non-scalar `start` and `stop` are now supported.
Parameters
----------
start : array_like
The starting value of the sequence.
stop : array_like
The end value of the sequence, unless `endpoint` is set to False.
In that case, the sequence consists of all but the last of ``num + 1``
evenly spaced samples, so that `stop` is excluded. Note that the step
size changes when `endpoint` is False.
num : int, optional
Number of samples to generate. Default is 50. Must be non-negative.
endpoint : bool, optional
If True, `stop` is the last sample. Otherwise, it is not included.
Default is True.
retstep : bool, optional
If True, return (`samples`, `step`), where `step` is the spacing
between samples.
dtype : dtype, optional
The type of the output array. If `dtype` is not given, infer the data
type from the other input arguments.
.. versionadded:: 1.9.0
axis : int, optional
The axis in the result to store the samples. Relevant only if start
or stop are array-like. By default (0), the samples will be along a
new axis inserted at the beginning. Use -1 to get an axis at the end.
.. versionadded:: 1.16.0
Returns
-------
samples : ndarray
There are `num` equally spaced samples in the closed interval
``[start, stop]`` or the half-open interval ``[start, stop)``
(depending on whether `endpoint` is True or False).
step : float, optional
Only returned if `retstep` is True
Size of spacing between samples.
See Also
--------
arange : Similar to `linspace`, but uses a step size (instead of the
number of samples).
geomspace : Similar to `linspace`, but with numbers spaced evenly on a log
scale (a geometric progression).
logspace : Similar to `geomspace`, but with the end points specified as
logarithms.
Examples
--------
>>> np.linspace(2.0, 3.0, num=5)
array([2. , 2.25, 2.5 , 2.75, 3. ])
>>> np.linspace(2.0, 3.0, num=5, endpoint=False)
array([2. , 2.2, 2.4, 2.6, 2.8])
>>> np.linspace(2.0, 3.0, num=5, retstep=True)
(array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25)
Graphical illustration:
>>> import matplotlib.pyplot as plt
>>> N = 8
>>> y = np.zeros(N)
>>> x1 = np.linspace(0, 10, N, endpoint=True)
>>> x2 = np.linspace(0, 10, N, endpoint=False)
>>> plt.plot(x1, y, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.plot(x2, y + 0.5, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.ylim([-0.5, 1])
(-0.5, 1)
>>> plt.show()
"""
num = operator.index(num)
E TypeError: 'float' object cannot be interpreted as an integer
d:\miniconda3\lib\site-packages\numpy\core\function_base.py:113: TypeError
________________________________ TestCompressedOctreeFor1DDataset.test_levels_in_tree _________________________________
self = <pysph.base.tests.test_octree.TestCompressedOctreeFor1DDataset testMethod=test_levels_in_tree>
self.x = np.linspace(0, 1, num=N)
d:\miniconda3\lib\site-packages\pysph\base\tests\test_octree.py:238:
<array_function internals>:6: in linspace
???
start = 0, stop = 1, num = 100000.0, endpoint = True, retstep = False, dtype = None, axis = 0
@array_function_dispatch(_linspace_dispatcher)
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
axis=0):
"""
Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].
The endpoint of the interval can optionally be excluded.
.. versionchanged:: 1.16.0
Non-scalar `start` and `stop` are now supported.
Parameters
----------
start : array_like
The starting value of the sequence.
stop : array_like
The end value of the sequence, unless `endpoint` is set to False.
In that case, the sequence consists of all but the last of ``num + 1``
evenly spaced samples, so that `stop` is excluded. Note that the step
size changes when `endpoint` is False.
num : int, optional
Number of samples to generate. Default is 50. Must be non-negative.
endpoint : bool, optional
If True, `stop` is the last sample. Otherwise, it is not included.
Default is True.
retstep : bool, optional
If True, return (`samples`, `step`), where `step` is the spacing
between samples.
dtype : dtype, optional
The type of the output array. If `dtype` is not given, infer the data
type from the other input arguments.
.. versionadded:: 1.9.0
axis : int, optional
The axis in the result to store the samples. Relevant only if start
or stop are array-like. By default (0), the samples will be along a
new axis inserted at the beginning. Use -1 to get an axis at the end.
.. versionadded:: 1.16.0
Returns
-------
samples : ndarray
There are `num` equally spaced samples in the closed interval
``[start, stop]`` or the half-open interval ``[start, stop)``
(depending on whether `endpoint` is True or False).
step : float, optional
Only returned if `retstep` is True
Size of spacing between samples.
See Also
--------
arange : Similar to `linspace`, but uses a step size (instead of the
number of samples).
geomspace : Similar to `linspace`, but with numbers spaced evenly on a log
scale (a geometric progression).
logspace : Similar to `geomspace`, but with the end points specified as
logarithms.
Examples
--------
>>> np.linspace(2.0, 3.0, num=5)
array([2. , 2.25, 2.5 , 2.75, 3. ])
>>> np.linspace(2.0, 3.0, num=5, endpoint=False)
array([2. , 2.2, 2.4, 2.6, 2.8])
>>> np.linspace(2.0, 3.0, num=5, retstep=True)
(array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25)
Graphical illustration:
>>> import matplotlib.pyplot as plt
>>> N = 8
>>> y = np.zeros(N)
>>> x1 = np.linspace(0, 10, N, endpoint=True)
>>> x2 = np.linspace(0, 10, N, endpoint=False)
>>> plt.plot(x1, y, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.plot(x2, y + 0.5, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.ylim([-0.5, 1])
(-0.5, 1)
>>> plt.show()
"""
num = operator.index(num)
E TypeError: 'float' object cannot be interpreted as an integer
d:\miniconda3\lib\site-packages\numpy\core\function_base.py:113: TypeError
________________________________ TestCompressedOctreeFor1DDataset.test_parent_for_node ________________________________
self = <pysph.base.tests.test_octree.TestCompressedOctreeFor1DDataset testMethod=test_parent_for_node>
self.x = np.linspace(0, 1, num=N)
d:\miniconda3\lib\site-packages\pysph\base\tests\test_octree.py:238:
<array_function internals>:6: in linspace
???
start = 0, stop = 1, num = 100000.0, endpoint = True, retstep = False, dtype = None, axis = 0
@array_function_dispatch(_linspace_dispatcher)
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
axis=0):
"""
Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].
The endpoint of the interval can optionally be excluded.
.. versionchanged:: 1.16.0
Non-scalar `start` and `stop` are now supported.
Parameters
----------
start : array_like
The starting value of the sequence.
stop : array_like
The end value of the sequence, unless `endpoint` is set to False.
In that case, the sequence consists of all but the last of ``num + 1``
evenly spaced samples, so that `stop` is excluded. Note that the step
size changes when `endpoint` is False.
num : int, optional
Number of samples to generate. Default is 50. Must be non-negative.
endpoint : bool, optional
If True, `stop` is the last sample. Otherwise, it is not included.
Default is True.
retstep : bool, optional
If True, return (`samples`, `step`), where `step` is the spacing
between samples.
dtype : dtype, optional
The type of the output array. If `dtype` is not given, infer the data
type from the other input arguments.
.. versionadded:: 1.9.0
axis : int, optional
The axis in the result to store the samples. Relevant only if start
or stop are array-like. By default (0), the samples will be along a
new axis inserted at the beginning. Use -1 to get an axis at the end.
.. versionadded:: 1.16.0
Returns
-------
samples : ndarray
There are `num` equally spaced samples in the closed interval
``[start, stop]`` or the half-open interval ``[start, stop)``
(depending on whether `endpoint` is True or False).
step : float, optional
Only returned if `retstep` is True
Size of spacing between samples.
See Also
--------
arange : Similar to `linspace`, but uses a step size (instead of the
number of samples).
geomspace : Similar to `linspace`, but with numbers spaced evenly on a log
scale (a geometric progression).
logspace : Similar to `geomspace`, but with the end points specified as
logarithms.
Examples
--------
>>> np.linspace(2.0, 3.0, num=5)
array([2. , 2.25, 2.5 , 2.75, 3. ])
>>> np.linspace(2.0, 3.0, num=5, endpoint=False)
array([2. , 2.2, 2.4, 2.6, 2.8])
>>> np.linspace(2.0, 3.0, num=5, retstep=True)
(array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25)
Graphical illustration:
>>> import matplotlib.pyplot as plt
>>> N = 8
>>> y = np.zeros(N)
>>> x1 = np.linspace(0, 10, N, endpoint=True)
>>> x2 = np.linspace(0, 10, N, endpoint=False)
>>> plt.plot(x1, y, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.plot(x2, y + 0.5, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.ylim([-0.5, 1])
(-0.5, 1)
>>> plt.show()
"""
num = operator.index(num)
E TypeError: 'float' object cannot be interpreted as an integer
d:\miniconda3\lib\site-packages\numpy\core\function_base.py:113: TypeError
___________________________________ TestCompressedOctreeFor1DDataset.test_plot_root ___________________________________
self = <pysph.base.tests.test_octree.TestCompressedOctreeFor1DDataset testMethod=test_plot_root>
self.x = np.linspace(0, 1, num=N)
d:\miniconda3\lib\site-packages\pysph\base\tests\test_octree.py:238:
<array_function internals>:6: in linspace
???
start = 0, stop = 1, num = 100000.0, endpoint = True, retstep = False, dtype = None, axis = 0
@array_function_dispatch(_linspace_dispatcher)
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
axis=0):
"""
Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].
The endpoint of the interval can optionally be excluded.
.. versionchanged:: 1.16.0
Non-scalar `start` and `stop` are now supported.
Parameters
----------
start : array_like
The starting value of the sequence.
stop : array_like
The end value of the sequence, unless `endpoint` is set to False.
In that case, the sequence consists of all but the last of ``num + 1``
evenly spaced samples, so that `stop` is excluded. Note that the step
size changes when `endpoint` is False.
num : int, optional
Number of samples to generate. Default is 50. Must be non-negative.
endpoint : bool, optional
If True, `stop` is the last sample. Otherwise, it is not included.
Default is True.
retstep : bool, optional
If True, return (`samples`, `step`), where `step` is the spacing
between samples.
dtype : dtype, optional
The type of the output array. If `dtype` is not given, infer the data
type from the other input arguments.
.. versionadded:: 1.9.0
axis : int, optional
The axis in the result to store the samples. Relevant only if start
or stop are array-like. By default (0), the samples will be along a
new axis inserted at the beginning. Use -1 to get an axis at the end.
.. versionadded:: 1.16.0
Returns
-------
samples : ndarray
There are `num` equally spaced samples in the closed interval
``[start, stop]`` or the half-open interval ``[start, stop)``
(depending on whether `endpoint` is True or False).
step : float, optional
Only returned if `retstep` is True
Size of spacing between samples.
See Also
--------
arange : Similar to `linspace`, but uses a step size (instead of the
number of samples).
geomspace : Similar to `linspace`, but with numbers spaced evenly on a log
scale (a geometric progression).
logspace : Similar to `geomspace`, but with the end points specified as
logarithms.
Examples
--------
>>> np.linspace(2.0, 3.0, num=5)
array([2. , 2.25, 2.5 , 2.75, 3. ])
>>> np.linspace(2.0, 3.0, num=5, endpoint=False)
array([2. , 2.2, 2.4, 2.6, 2.8])
>>> np.linspace(2.0, 3.0, num=5, retstep=True)
(array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25)
Graphical illustration:
>>> import matplotlib.pyplot as plt
>>> N = 8
>>> y = np.zeros(N)
>>> x1 = np.linspace(0, 10, N, endpoint=True)
>>> x2 = np.linspace(0, 10, N, endpoint=False)
>>> plt.plot(x1, y, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.plot(x2, y + 0.5, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.ylim([-0.5, 1])
(-0.5, 1)
>>> plt.show()
"""
num = operator.index(num)
E TypeError: 'float' object cannot be interpreted as an integer
d:\miniconda3\lib\site-packages\numpy\core\function_base.py:113: TypeError
____________ TestCompressedOctreeFor1DDataset.test_sum_of_indices_lengths_equals_total_number_of_particles ____________
self = <pysph.base.tests.test_octree.TestCompressedOctreeFor1DDataset testMethod=test_sum_of_indices_lengths_equals_total_number_of_particles>
self.x = np.linspace(0, 1, num=N)
d:\miniconda3\lib\site-packages\pysph\base\tests\test_octree.py:238:
<array_function internals>:6: in linspace
???
start = 0, stop = 1, num = 100000.0, endpoint = True, retstep = False, dtype = None, axis = 0
@array_function_dispatch(_linspace_dispatcher)
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
axis=0):
"""
Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].
The endpoint of the interval can optionally be excluded.
.. versionchanged:: 1.16.0
Non-scalar `start` and `stop` are now supported.
Parameters
----------
start : array_like
The starting value of the sequence.
stop : array_like
The end value of the sequence, unless `endpoint` is set to False.
In that case, the sequence consists of all but the last of ``num + 1``
evenly spaced samples, so that `stop` is excluded. Note that the step
size changes when `endpoint` is False.
num : int, optional
Number of samples to generate. Default is 50. Must be non-negative.
endpoint : bool, optional
If True, `stop` is the last sample. Otherwise, it is not included.
Default is True.
retstep : bool, optional
If True, return (`samples`, `step`), where `step` is the spacing
between samples.
dtype : dtype, optional
The type of the output array. If `dtype` is not given, infer the data
type from the other input arguments.
.. versionadded:: 1.9.0
axis : int, optional
The axis in the result to store the samples. Relevant only if start
or stop are array-like. By default (0), the samples will be along a
new axis inserted at the beginning. Use -1 to get an axis at the end.
.. versionadded:: 1.16.0
Returns
-------
samples : ndarray
There are `num` equally spaced samples in the closed interval
``[start, stop]`` or the half-open interval ``[start, stop)``
(depending on whether `endpoint` is True or False).
step : float, optional
Only returned if `retstep` is True
Size of spacing between samples.
See Also
--------
arange : Similar to `linspace`, but uses a step size (instead of the
number of samples).
geomspace : Similar to `linspace`, but with numbers spaced evenly on a log
scale (a geometric progression).
logspace : Similar to `geomspace`, but with the end points specified as
logarithms.
Examples
--------
>>> np.linspace(2.0, 3.0, num=5)
array([2. , 2.25, 2.5 , 2.75, 3. ])
>>> np.linspace(2.0, 3.0, num=5, endpoint=False)
array([2. , 2.2, 2.4, 2.6, 2.8])
>>> np.linspace(2.0, 3.0, num=5, retstep=True)
(array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25)
Graphical illustration:
>>> import matplotlib.pyplot as plt
>>> N = 8
>>> y = np.zeros(N)
>>> x1 = np.linspace(0, 10, N, endpoint=True)
>>> x2 = np.linspace(0, 10, N, endpoint=False)
>>> plt.plot(x1, y, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.plot(x2, y + 0.5, 'o')
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.ylim([-0.5, 1])
(-0.5, 1)
>>> plt.show()
"""
num = operator.index(num)
E TypeError: 'float' object cannot be interpreted as an integer
d:\miniconda3\lib\site-packages\numpy\core\function_base.py:113: TypeError
______________________________________ TestOpenMPExamples.test_ldcavity_example _______________________________________
self = <pysph.parallel.tests.test_openmp.TestOpenMPExamples testMethod=test_ldcavity_example>
def test_ldcavity_example(self):
dt=1e-4; tf=200*dt
serial_kwargs = dict(timestep=dt, tf=tf, pfreq=500)
extra_parallel_kwargs = dict(openmp=None)
# Note that we set nprocs=1 here since we do not want
# to run this with mpirun.
self.run_example(
'cavity.py', nprocs=1, atol=1e-14,
serial_kwargs=serial_kwargs,
extra_parallel_kwargs=extra_parallel_kwargs
d:\miniconda3\lib\site-packages\pysph\parallel\tests\test_openmp.py:55:
d:\miniconda3\lib\site-packages\pysph\parallel\tests\example_test_case.py:128: in run_example
serial = load(file)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:298: in load
return output.load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:79: in load
return self._load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:135: in _load
solver_data = _get_dict_from_arrays(data["solver_data"])
d:\miniconda3\lib\site-packages\numpy\lib\npyio.py:255: in getitem
pickle_kwargs=self.pickle_kwargs)
fp = <zipfile.ZipExtFile name='solver_data.npy' mode='r'>, allow_pickle = False
pickle_kwargs = {'encoding': 'bytes', 'fix_imports': True}
def read_array(fp, allow_pickle=False, pickle_kwargs=None):
"""
Read an array from an NPY file.
Parameters
----------
fp : file_like object
If this is not a real file object, then this may take extra memory
and time.
allow_pickle : bool, optional
Whether to allow writing pickled data. Default: False
.. versionchanged:: 1.16.3
Made default False in response to CVE-2019-6446.
pickle_kwargs : dict
Additional keyword arguments to pass to pickle.load. These are only
useful when loading object arrays saved on Python 2 when using
Python 3.
Returns
-------
array : ndarray
The array from the data on disk.
Raises
------
ValueError
If the data is invalid, or allow_pickle=False and the file contains
an object array.
"""
version = read_magic(fp)
_check_version(version)
shape, fortran_order, dtype = _read_array_header(fp, version)
if len(shape) == 0:
count = 1
else:
count = numpy.multiply.reduce(shape, dtype=numpy.int64)
# Now read the actual data.
if dtype.hasobject:
# The array contained Python objects. We need to unpickle the data.
if not allow_pickle:
raise ValueError("Object arrays cannot be loaded when "
E ValueError: Object arrays cannot be loaded when allow_pickle=False
d:\miniconda3\lib\site-packages\numpy\lib\format.py:727: ValueError
------------------------------------------------ Captured stdout call -------------------------------------------------
running test: ['d:\miniconda3\python.exe', 'd:\miniconda3\lib\site-packages\pysph\parallel\tests\cavity.py', '--timestep=0.0001', '--tf=0.02', '--pfreq=500', '--fname=cavity', '--directory=C:\Users\wsh\AppData\Local\Temp\tmpfyiugtco']
running test: ['d:\miniconda3\python.exe', 'd:\miniconda3\lib\site-packages\pysph\parallel\tests\cavity.py', '--timestep=0.0001', '--tf=0.02', '--pfreq=500', '--openmp', '--fname=cavity', '--directory=C:\Users\wsh\AppData\Local\Temp\tmp9zml4pvp']
__________________________________ TestOutputNumpy.test_dump_and_load_with_constants __________________________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpy testMethod=test_dump_and_load_with_constants>
def test_dump_and_load_with_constants(self):
x = np.linspace(0, 1.0, 10)
y = x*2.0
pa = get_particle_array_wcsph(name='fluid', x=x, y=y,
constants={'c1': 1.0, 'c2': [2.0, 3.0]})
pa.add_property('A', data=2.0, stride=2)
pa.set_output_arrays(['x', 'y', 'A'])
fname = self._get_filename('simple')
dump(fname, [pa], solver_data={})
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:124:
d:\miniconda3\lib\site-packages\pysph\solver\output.py:298: in load
return output.load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:79: in load
return self._load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:135: in _load
solver_data = _get_dict_from_arrays(data["solver_data"])
d:\miniconda3\lib\site-packages\numpy\lib\npyio.py:255: in getitem
pickle_kwargs=self.pickle_kwargs)
fp = <zipfile.ZipExtFile name='solver_data.npy' mode='r'>, allow_pickle = False
pickle_kwargs = {'encoding': 'bytes', 'fix_imports': True}
def read_array(fp, allow_pickle=False, pickle_kwargs=None):
"""
Read an array from an NPY file.
Parameters
----------
fp : file_like object
If this is not a real file object, then this may take extra memory
and time.
allow_pickle : bool, optional
Whether to allow writing pickled data. Default: False
.. versionchanged:: 1.16.3
Made default False in response to CVE-2019-6446.
pickle_kwargs : dict
Additional keyword arguments to pass to pickle.load. These are only
useful when loading object arrays saved on Python 2 when using
Python 3.
Returns
-------
array : ndarray
The array from the data on disk.
Raises
------
ValueError
If the data is invalid, or allow_pickle=False and the file contains
an object array.
"""
version = read_magic(fp)
_check_version(version)
shape, fortran_order, dtype = _read_array_header(fp, version)
if len(shape) == 0:
count = 1
else:
count = numpy.multiply.reduce(shape, dtype=numpy.int64)
# Now read the actual data.
if dtype.hasobject:
# The array contained Python objects. We need to unpickle the data.
if not allow_pickle:
raise ValueError("Object arrays cannot be loaded when "
E ValueError: Object arrays cannot be loaded when allow_pickle=False
d:\miniconda3\lib\site-packages\numpy\lib\format.py:727: ValueError
______________________________ TestOutputNumpy.test_dump_and_load_with_partial_data_dump ______________________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpy testMethod=test_dump_and_load_with_partial_data_dump>
def test_dump_and_load_with_partial_data_dump(self):
x = np.linspace(0, 1.0, 10)
y = x*2.0
pa = get_particle_array_wcsph(name='fluid', x=x, y=y)
pa.set_output_arrays(['x', 'y'])
fname = self._get_filename('simple')
dump(fname, [pa], solver_data={})
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:107:
d:\miniconda3\lib\site-packages\pysph\solver\output.py:298: in load
return output.load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:79: in load
return self._load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:135: in _load
solver_data = _get_dict_from_arrays(data["solver_data"])
d:\miniconda3\lib\site-packages\numpy\lib\npyio.py:255: in getitem
pickle_kwargs=self.pickle_kwargs)
fp = <zipfile.ZipExtFile name='solver_data.npy' mode='r'>, allow_pickle = False
pickle_kwargs = {'encoding': 'bytes', 'fix_imports': True}
def read_array(fp, allow_pickle=False, pickle_kwargs=None):
"""
Read an array from an NPY file.
Parameters
----------
fp : file_like object
If this is not a real file object, then this may take extra memory
and time.
allow_pickle : bool, optional
Whether to allow writing pickled data. Default: False
.. versionchanged:: 1.16.3
Made default False in response to CVE-2019-6446.
pickle_kwargs : dict
Additional keyword arguments to pass to pickle.load. These are only
useful when loading object arrays saved on Python 2 when using
Python 3.
Returns
-------
array : ndarray
The array from the data on disk.
Raises
------
ValueError
If the data is invalid, or allow_pickle=False and the file contains
an object array.
"""
version = read_magic(fp)
_check_version(version)
shape, fortran_order, dtype = _read_array_header(fp, version)
if len(shape) == 0:
count = 1
else:
count = numpy.multiply.reduce(shape, dtype=numpy.int64)
# Now read the actual data.
if dtype.hasobject:
# The array contained Python objects. We need to unpickle the data.
if not allow_pickle:
raise ValueError("Object arrays cannot be loaded when "
E ValueError: Object arrays cannot be loaded when allow_pickle=False
d:\miniconda3\lib\site-packages\numpy\lib\format.py:727: ValueError
_________________________________ TestOutputNumpy.test_dump_and_load_works_by_default _________________________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpy testMethod=test_dump_and_load_works_by_default>
def test_dump_and_load_works_by_default(self):
x = np.linspace(0, 1.0, 10)
y = x*2.0
dt = 1.0
pa = get_particle_array(name='fluid', x=x, y=y)
fname = self._get_filename('simple')
dump(fname, [pa], solver_data={'dt': dt})
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:68:
d:\miniconda3\lib\site-packages\pysph\solver\output.py:298: in load
return output.load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:79: in load
return self._load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:135: in _load
solver_data = _get_dict_from_arrays(data["solver_data"])
d:\miniconda3\lib\site-packages\numpy\lib\npyio.py:255: in getitem
pickle_kwargs=self.pickle_kwargs)
fp = <zipfile.ZipExtFile name='solver_data.npy' mode='r'>, allow_pickle = False
pickle_kwargs = {'encoding': 'bytes', 'fix_imports': True}
def read_array(fp, allow_pickle=False, pickle_kwargs=None):
"""
Read an array from an NPY file.
Parameters
----------
fp : file_like object
If this is not a real file object, then this may take extra memory
and time.
allow_pickle : bool, optional
Whether to allow writing pickled data. Default: False
.. versionchanged:: 1.16.3
Made default False in response to CVE-2019-6446.
pickle_kwargs : dict
Additional keyword arguments to pass to pickle.load. These are only
useful when loading object arrays saved on Python 2 when using
Python 3.
Returns
-------
array : ndarray
The array from the data on disk.
Raises
------
ValueError
If the data is invalid, or allow_pickle=False and the file contains
an object array.
"""
version = read_magic(fp)
_check_version(version)
shape, fortran_order, dtype = _read_array_header(fp, version)
if len(shape) == 0:
count = 1
else:
count = numpy.multiply.reduce(shape, dtype=numpy.int64)
# Now read the actual data.
if dtype.hasobject:
# The array contained Python objects. We need to unpickle the data.
if not allow_pickle:
raise ValueError("Object arrays cannot be loaded when "
E ValueError: Object arrays cannot be loaded when allow_pickle=False
d:\miniconda3\lib\site-packages\numpy\lib\format.py:727: ValueError
_______________________________ TestOutputNumpy.test_dump_and_load_works_with_compress ________________________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpy testMethod=test_dump_and_load_works_with_compress>
def test_dump_and_load_works_with_compress(self):
x = np.linspace(0, 1.0, 10)
y = x*2.0
dt = 1.0
pa = get_particle_array(name='fluid', x=x, y=y)
fname = self._get_filename('simple')
dump(fname, [pa], solver_data={'dt': dt})
fnamez = self._get_filename('simplez')
dump(fnamez, [pa], solver_data={'dt': dt}, compress=True)
# Check that the file size is indeed smaller
self.assertTrue(os.stat(fnamez).st_size < os.stat(fname).st_size)
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:90:
d:\miniconda3\lib\site-packages\pysph\solver\output.py:298: in load
return output.load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:79: in load
return self._load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:135: in _load
solver_data = _get_dict_from_arrays(data["solver_data"])
d:\miniconda3\lib\site-packages\numpy\lib\npyio.py:255: in getitem
pickle_kwargs=self.pickle_kwargs)
fp = <zipfile.ZipExtFile name='solver_data.npy' mode='r' compress_type=deflate>, allow_pickle = False
pickle_kwargs = {'encoding': 'bytes', 'fix_imports': True}
def read_array(fp, allow_pickle=False, pickle_kwargs=None):
"""
Read an array from an NPY file.
Parameters
----------
fp : file_like object
If this is not a real file object, then this may take extra memory
and time.
allow_pickle : bool, optional
Whether to allow writing pickled data. Default: False
.. versionchanged:: 1.16.3
Made default False in response to CVE-2019-6446.
pickle_kwargs : dict
Additional keyword arguments to pass to pickle.load. These are only
useful when loading object arrays saved on Python 2 when using
Python 3.
Returns
-------
array : ndarray
The array from the data on disk.
Raises
------
ValueError
If the data is invalid, or allow_pickle=False and the file contains
an object array.
"""
version = read_magic(fp)
_check_version(version)
shape, fortran_order, dtype = _read_array_header(fp, version)
if len(shape) == 0:
count = 1
else:
count = numpy.multiply.reduce(shape, dtype=numpy.int64)
# Now read the actual data.
if dtype.hasobject:
# The array contained Python objects. We need to unpickle the data.
if not allow_pickle:
raise ValueError("Object arrays cannot be loaded when "
E ValueError: Object arrays cannot be loaded when allow_pickle=False
d:\miniconda3\lib\site-packages\numpy\lib\format.py:727: ValueError
_____________________________ TestOutputNumpy.test_that_output_array_information_is_saved _____________________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpy testMethod=test_that_output_array_information_is_saved>
def test_that_output_array_information_is_saved(self):
# Given
x = np.linspace(0, 1.0, 10)
y = x*2.0
pa = get_particle_array(name='fluid', x=x, y=y, u=3*x)
# When
output_arrays = ['x', 'y', 'u']
pa.set_output_arrays(output_arrays)
fname = self._get_filename('simple')
dump(fname, [pa], solver_data={})
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:148:
d:\miniconda3\lib\site-packages\pysph\solver\output.py:298: in load
return output.load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:79: in load
return self._load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:135: in _load
solver_data = _get_dict_from_arrays(data["solver_data"])
d:\miniconda3\lib\site-packages\numpy\lib\npyio.py:255: in getitem
pickle_kwargs=self.pickle_kwargs)
fp = <zipfile.ZipExtFile name='solver_data.npy' mode='r'>, allow_pickle = False
pickle_kwargs = {'encoding': 'bytes', 'fix_imports': True}
def read_array(fp, allow_pickle=False, pickle_kwargs=None):
"""
Read an array from an NPY file.
Parameters
----------
fp : file_like object
If this is not a real file object, then this may take extra memory
and time.
allow_pickle : bool, optional
Whether to allow writing pickled data. Default: False
.. versionchanged:: 1.16.3
Made default False in response to CVE-2019-6446.
pickle_kwargs : dict
Additional keyword arguments to pass to pickle.load. These are only
useful when loading object arrays saved on Python 2 when using
Python 3.
Returns
-------
array : ndarray
The array from the data on disk.
Raises
------
ValueError
If the data is invalid, or allow_pickle=False and the file contains
an object array.
"""
version = read_magic(fp)
_check_version(version)
shape, fortran_order, dtype = _read_array_header(fp, version)
if len(shape) == 0:
count = 1
else:
count = numpy.multiply.reduce(shape, dtype=numpy.int64)
# Now read the actual data.
if dtype.hasobject:
# The array contained Python objects. We need to unpickle the data.
if not allow_pickle:
raise ValueError("Object arrays cannot be loaded when "
E ValueError: Object arrays cannot be loaded when allow_pickle=False
d:\miniconda3\lib\site-packages\numpy\lib\format.py:727: ValueError
________________________________ TestOutputNumpyV1.test_load_works_with_dump_version1 _________________________________
self = <pysph.solver.tests.test_solver_utils.TestOutputNumpyV1 testMethod=test_load_works_with_dump_version1>
def test_load_works_with_dump_version1(self):
x = np.linspace(0, 1.0, 10)
y = x*2.0
pa = get_particle_array(name='fluid', x=x, y=y)
fname = self._get_filename('simple')
dump_v1(fname, [pa], solver_data={})
d:\miniconda3\lib\site-packages\pysph\solver\tests\test_solver_utils.py:181:
d:\miniconda3\lib\site-packages\pysph\solver\output.py:298: in load
return output.load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:79: in load
return self._load(fname)
d:\miniconda3\lib\site-packages\pysph\solver\output.py:135: in _load
solver_data = _get_dict_from_arrays(data["solver_data"])
d:\miniconda3\lib\site-packages\numpy\lib\npyio.py:255: in getitem
pickle_kwargs=self.pickle_kwargs)
fp = <zipfile.ZipExtFile name='solver_data.npy' mode='r'>, allow_pickle = False
pickle_kwargs = {'encoding': 'bytes', 'fix_imports': True}
def read_array(fp, allow_pickle=False, pickle_kwargs=None):
"""
Read an array from an NPY file.
Parameters
----------
fp : file_like object
If this is not a real file object, then this may take extra memory
and time.
allow_pickle : bool, optional
Whether to allow writing pickled data. Default: False
.. versionchanged:: 1.16.3
Made default False in response to CVE-2019-6446.
pickle_kwargs : dict
Additional keyword arguments to pass to pickle.load. These are only
useful when loading object arrays saved on Python 2 when using
Python 3.
Returns
-------
array : ndarray
The array from the data on disk.
Raises
------
ValueError
If the data is invalid, or allow_pickle=False and the file contains
an object array.
"""
version = read_magic(fp)
_check_version(version)
shape, fortran_order, dtype = _read_array_header(fp, version)
if len(shape) == 0:
count = 1
else:
count = numpy.multiply.reduce(shape, dtype=numpy.int64)
# Now read the actual data.
if dtype.hasobject:
# The array contained Python objects. We need to unpickle the data.
if not allow_pickle:
raise ValueError("Object arrays cannot be loaded when "
E ValueError: Object arrays cannot be loaded when allow_pickle=False
d:\miniconda3\lib\site-packages\numpy\lib\format.py:727: ValueError