Skip to content

scipy.special.jv not found? #99

Open
@nbecker

Description

@nbecker

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions