Incorrect argument's type for function numpy.linspace
When using Python 3.6.9
and numpy 1.18.4
, the code on sicor/sensors/RSImage.py#L181 leads to the following error:
Traceback (most recent call last):
File "/usr/local/python/.pyenv/versions/gts2_python_3.6.9/lib/python3.6/site-packages/sicor-0.14.2-py3.6.egg/sicor/sicor_ac.py", line 470, in ac
IO.write_results(s2img=s2img, options=options, logger=logger)
File "/usr/local/python/.pyenv/versions/gts2_python_3.6.9/lib/python3.6/site-packages/sicor-0.14.2-py3.6.egg/sicor/sicor.py", line 680, in write_results
IO.write_rgb_jpeg(s2img=s2img, opts=opts, logger=logger)
File "/usr/local/python/.pyenv/versions/gts2_python_3.6.9/lib/python3.6/site-packages/sicor-0.14.2-py3.6.egg/sicor/sicor.py", line 714, in write_rgb_jpeg
hist_chop_off_fraction=opts["hist_chop_off_fraction"])
File "/usr/local/python/.pyenv/versions/gts2_python_3.6.9/lib/python3.6/site-packages/sicor-0.14.2-py3.6.egg/sicor/sensors/RSImage.py", line 182, in image_to_rgb
bins = np.linspace(0.0, 1.0, 100 / 2.0)
File "<__array_function__ internals>", line 6, in linspace
File "/usr/local/python/.pyenv/versions/gts2_python_3.6.9/lib/python3.6/site-packages/numpy/core/function_base.py", line 121, in linspace
.format(type(num)))
A simple test can show that as well:
gts2@worker_ubuntu_gts2_acAC_Olke_rz-vm100:/$ python -c "import numpy as np; bins = np.linspace(0.0, 1.0, 100 / 2.0)"
Traceback (most recent call last):
File "/usr/local/python/.pyenv/versions/gts2_python_3.6.9/lib/python3.6/site-packages/numpy/core/function_base.py", line 117, in linspace
num = operator.index(num)
TypeError: 'float' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<__array_function__ internals>", line 6, in linspace
File "/usr/local/python/.pyenv/versions/gts2_python_3.6.9/lib/python3.6/site-packages/numpy/core/function_base.py", line 121, in linspace
.format(type(num)))
TypeError: object of type <class 'float'> cannot be safely interpreted as an integer.
gts2@worker_ubuntu_gts2_acAC_Olke_rz-vm100:/$
I am not sure why it has to be 100 / 2.0
and not simply 50
since the function in the numpy 1.18 and numpy 1.19 expects an Integer
for the number of samples. Maybe there was variable before in the old versions.
Edited by Romulo Pereira Goncalves