Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes when used with lists instead of numpy arrays #8

Open
kenogo opened this issue Nov 12, 2019 · 0 comments
Open

Crashes when used with lists instead of numpy arrays #8

kenogo opened this issue Nov 12, 2019 · 0 comments

Comments

@kenogo
Copy link

kenogo commented Nov 12, 2019

  • Pycorrelate version: 0.3
  • Python version: 3.6.4
  • Operating System: Windows

Description

When you want to use the correlation algorithms with pythonic lists instead of numpy arrays, the program crashes badly. This could easily be fixed with a check on whether the function arguments are lists, and calling np.array() in that case.

What I Did

from pycorrelate import pcorrelate
X = [1,2]
Y = [3,4]
edges = [1,2,3,4]
pcorrelate(X, Y, edges)

The resulting crash is:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\meassi\AppData\Local\Programs\Python\Python36\lib\site-packages\numba\dispatcher.py", line 401, in _compile_for_args
    error_rewrite(e, 'typing')
  File "C:\Users\meassi\AppData\Local\Programs\Python\Python36\lib\site-packages\numba\dispatcher.py", line 344, in error_rewrite
    reraise(type(e), e, None)
  File "C:\Users\meassi\AppData\Local\Programs\Python\Python36\lib\site-packages\numba\six.py", line 668, in reraise
    raise value.with_traceback(tb)
numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
�[1m�[1m�[1mInvalid use of Function(<function diff at 0x000001AD75F4C488>) with argument(s) of type(s): (reflected list(int64))
 * parameterized
�[1mIn definition 0:�[0m
�[1m    All templates rejected with literals.�[0m
�[1mIn definition 1:�[0m
�[1m    All templates rejected without literals.�[0m
�[1mThis error is usually caused by passing an argument of a type that is unsupported by the named function.�[0m�[0m
�[0m�[1m[1] During: resolving callee type: Function(<function diff at 0x000001AD75F4C488>)�[0m
�[0m�[1m[2] During: typing of call at C:\Users\meassi\AppData\Local\Programs\Python\Python36\lib\site-packages\pycorrelate\pycorrelate.py (111)
�[0m
�[1m
File "..\..\..\..\AppData\Local\Programs\Python\Python36\lib\site-packages\pycorrelate\pycorrelate.py", line 111:�[0m
�[1mdef pcorrelate(t, u, bins, normalize=False):
    <source elided>
        counts += imax - imin
�[1m    G = counts / np.diff(bins)
�[0m    �[1m^�[0m�[0m

This is not usually a problem with Numba itself but instead often caused by
the use of unsupported features or an issue in resolving types.

To see Python/NumPy features supported by the latest release of Numba visit:
http://numba.pydata.org/numba-doc/latest/reference/pysupported.html
and
http://numba.pydata.org/numba-doc/latest/reference/numpysupported.html

For more information about typing errors and how to debug them visit:
http://numba.pydata.org/numba-doc/latest/user/troubleshoot.html#my-code-doesn-t-compile

If you think your code should work with Numba, please report the error message
and traceback, along with a minimal reproducer at:
https://github.com/numba/numba/issues/new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant