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

scipy.special.jv not found? #99

Open
nbecker opened this issue Feb 11, 2024 · 0 comments
Open

scipy.special.jv not found? #99

nbecker opened this issue Feb 11, 2024 · 0 comments

Comments

@nbecker
Copy link

nbecker commented Feb 11, 2024

It would take some work to produce a minimal example, but maybe this will suffice?

import numpy as np
from scipy import constants
from numba import jit
import numba_scipy
import scipy.special as sp
...
@jit(nopython=True)
def circular_patch(a, h, L_op, er, theta, phi):
    # effective radius
    ae = a * np.sqrt(1 + (2 * h / (np.pi * a * er)) * (np.log(0.5 * np.pi * a / h) + 1.7726))
    k0 = 2 * np.pi / L_op
    sin_theta = np.sin(theta)
    bfn0 = sp.jv(0, k0 * ae * sin_theta)
    bfn2 = sp.jv(2, k0 * ae * sin_theta)
    Jp_02 = bfn0 - bfn2
    J_02 = bfn0 + bfn2

    # ((k0 * ae * exp(-1i*k0*r))/(2*r)) is a constant wrt theta & phi , so is
    # not included below.
    E_theta = np.abs(-1j * (np.cos(phi) * Jp_02))
    E_phi = np.abs(1j * (np.cos(theta) * np.sin(phi) * J_02))
    magEF = np.sqrt(E_theta * E_theta + E_phi * E_phi)

    return magEF
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<ufunc 'jv'>) found for signature:
 
 >>> jv(Literal[int](0), array(float64, 2d, C))
 
There are 2 candidate implementations:
   - Of which 2 did not match due to:
   Overload of function 'jv': File: numba_scipy/special/overloads.py: Line 9.
     With argument(s): '(int64, array(float64, 2d, C))':
    No match.

During: resolving callee type: Function(<ufunc 'jv'>)
During: typing of call at /home/nbecker/s-band/patch4.py (75)


File "patch4.py", line 75:
def circular_patch(a, h, L_op, er, theta, phi):
    <source elided>
    sin_theta = np.sin(theta)
    bfn0 = sp.jv(0, k0 * ae * sin_theta)
    ^

Did I use numba_scipy incorrectly?
I installed from git as:
pip install git+https://github.com/numba/numba-scipy.git
(normal pip install failed on python3.11 as others have reported before)

I have tried both sp.jv (0,...) and sp.jn (0,...) and both gave similar error.

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