Skip to content

Waveform generation not working with the last commit #175

@lcopparoni

Description

@lcopparoni

Hello,
I have tried to install the latest commit.
When I try to execute a minimal script:

import numpy as np
import cupy as xp

from few.waveform import GenerateEMRIWaveform

td_gen = GenerateEMRIWaveform(
    "FastKerrEccentricEquatorialFlux",
    sum_kwargs=dict(pad_output=True, odd_len=True),
    return_list=False,
)

# define the injection parameters
m1 = 0.5e6  # central object mass (solar masses)
a = 0.9    # dimensionless spin parameter for the primary - will be ignored in Schwarzschild waveform
m2 = 10.0  # secondary object mass (solar masses)
p0 = 12.0  # initial dimensionless semi-latus rectum
e0 = 0.1   # eccentricity

x0 = 1.0         # initial cos(inclination) - will be ignored in Schwarzschild waveform
qK = np.pi / 3   # polar spin angle
phiK = np.pi / 3 # azimuthal viewing angle
qS = np.pi / 3   # polar sky angle
phiS = np.pi / 3 # azimuthal viewing angle
dist = 1.0       # luminosity distance (Gpc)

# initial phases
Phi_phi0 = np.pi / 3
Phi_theta0 = 0.0
Phi_r0 = np.pi / 3

Tobs = 0.5  # observation time (years)
dt = 5.0    # time interval (seconds)

wave = td_gen(m1, m2, a,  p0,  e0,  x0,  dist,  qS,  phiS,  qK,  phiK,  Phi_phi0, Phi_theta0, Phi_r0,T=Tobs, dt=dt)

I have the following error:


---------------------------------------------------------------------------
 wave = td_gen(*emri_injection_params,T=Tobs, dt=dt)

File ~/Software/FastEMRIWaveforms/src/few/waveform/waveform.py:334, in GenerateEMRIWaveform.__call__(self, m1, m2, a, p0, e0, x0, dist, qS, phiS, qK, phiK, Phi_phi0, Phi_theta0, Phi_r0, *add_args, **kwargs)
    330 args += add_args
    332 # get waveform
    333 h = (
--> 334     self.waveform_generator(*args, **{**initial_phases, **kwargs})
    335     / dist_dimensionless
    336 )
    338 # by definition of the source frame, need to rotate by pi
    339 if self.waveform_generator.frame == "source":

File ~/Software/FastEMRIWaveforms/src/few/waveform/waveform.py:499, in FastKerrEccentricEquatorialFlux.__call__(self, m1, m2, a, p0, e0, xI, theta, phi, *args, **kwargs)
    467 def __call__(
    468     self,
    469     m1: float,
   (...)    478     **kwargs: Optional[dict],
    479 ) -> np.ndarray:
    480     """
    481     Generate the waveform.
    482 
   (...)    497 
    498     """
--> 499     return self._generate_waveform(
    500         m1,
    501         m2,
    502         a,
    503         p0,
    504         e0,
    505         xI,
    506         theta,
    507         phi,
    508         *args,
    509         **kwargs,
    510     )

File ~/Software/FastEMRIWaveforms/src/few/waveform/base.py:290, in SphericalHarmonicWaveformBase._generate_waveform(self, m1, m2, a, p0, e0, xI0, theta, phi, dist, Phi_phi0, Phi_theta0, Phi_r0, dt, T, mode_selection_threshold, show_progress, batch_size, mode_selection, include_minus_mkn, *args, **kwargs)
    287 # get frequencies to pass to mode selection
    288 # TODO: write a method that just returns the derivatives at each spline knot (vectorises easier).
    289 if self.mode_selector.mode_selection != "all":
--> 290     freqs = self.inspiral_generator.inspiral_generator.eval_integrator_derivative_spline(t_temp, order=1)[:,3:6] / 2 / np.pi
    292     online_mode_selection_args = dict(
    293         f_phi = freqs[:,0],
    294         f_theta = freqs[:,1],
    295         f_r = freqs[:,2],
    296     )
    297 else:
    298     # handles slow waveform

File ~/Software/FastEMRIWaveforms/src/few/trajectory/integrate.py:555, in Integrate.eval_integrator_derivative_spline(self, t_new, order)
    544 """Evaluate integration derivatives at new time array.
    545 
    546 Args:
   (...)    552 
    553 """
    554 t_old = self.integrator_t_cache
--> 555 result = self.dopr.eval_derivative(
    556     t_new, t_old, self.integrator_spline_coeff, order=order
    557 )
    559 if not self.generating_trajectory:
    560     result[:, 3:6] /= self.massratio

File ~/Software/FastEMRIWaveforms/src/few/trajectory/dopr853.py:863, in DOPR853.eval_derivative(self, t_new, t_old, spline_coeffs, order)
    858 if not np.all((t_min <= t_new) & (t_new <= t_max)):
    859     raise ValueError(
    860         f"All t_new values must be between t_min ({t_min}) and t_max ({t_max})."
    861     )
--> 863 segments = np.searchsorted(t_old, t_new, side="right") - 1
    864 segments[t_new == t_max] = t_old.shape[0] - 2
    866 tmp_coeffs = spline_coeffs[segments]

File cupy/_core/core.pyx:1819, in cupy._core.core._ndarray_base.__array_function__()

File ~/miniconda3/envs/few_env/lib/python3.12/site-packages/cupy/_sorting/search.py:422, in searchsorted(a, v, side, sorter)
    393 def searchsorted(a, v, side='left', sorter=None):
    394     """Finds indices where elements should be inserted to maintain order.
    395 
    396     Find the indices into a sorted array ``a`` such that,
   (...)    420 
    421     """
--> 422     return _searchsorted(a, v, side, sorter, True)

File ~/miniconda3/envs/few_env/lib/python3.12/site-packages/cupy/_sorting/search.py:431, in _searchsorted(a, v, side, sorter, assume_increasing)
    426 """`assume_increasing` is used in the kernel to
    427 skip monotonically increasing or decreasing verification
    428 inside the cuda kernel.
    429 """
    430 if not isinstance(a, cupy.ndarray):
--> 431     raise NotImplementedError('Only int or ndarray are supported for a')
    433 if not isinstance(v, cupy.ndarray):
    434     raise NotImplementedError('Only int or ndarray are supported for v')

NotImplementedError: Only int or ndarray are supported for a

In the conda environment I have installed python 3.12, cuda12.2, cupy 13.6.0.
Do you happen to know what the reason for this error is?
Thanks in advance

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