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

Cannot compute qtransform for BBHx waveform #4745

Open
mj-will opened this issue May 14, 2024 · 0 comments
Open

Cannot compute qtransform for BBHx waveform #4745

mj-will opened this issue May 14, 2024 · 0 comments
Assignees

Comments

@mj-will
Copy link
Contributor

mj-will commented May 14, 2024

Trying to call qtransform for a TimeSeries containing a LISA-like waveform from BBHx raises an error.

Error

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[14], line 30
     28 wf_fd = get_fd_det_waveform(**params)["LISA_A"]
     29 wf_td = wf_fd.to_timeseries()
---> 30 times, freqs, power = wf_td.qtransform(
     31     delta_t=wf_td.delta_t,
     32     delta_f=wf_td.delta_f,
     33     frange=(1e-4, 1e-1),
     34 )

File ~/git_repos/pycbc_worktrees/lisa_ew/pycbc/types/timeseries.py:754, in TimeSeries.qtransform(self, delta_t, delta_f, logfsteps, frange, qrange, mismatch, return_complex)
    751     frange = (30, int(self.sample_rate / 2 * 8))
    753 q_base = qtiling(self, qrange, frange, mismatch)
--> 754 _, times, freqs, q_plane = qplane(q_base, self.to_frequencyseries(),
    755                                   return_complex=return_complex)
    756 if logfsteps and delta_f:
    757     raise ValueError("Provide only one (or none) of delta_f and logfsteps")

File ~/git_repos/pycbc_worktrees/lisa_ew/pycbc/filter/qtransform.py:69, in qplane(qplane_tile_dict, fseries, return_complex)
     67 energies = []
     68 for f0 in qplane_tile_dict[q]:
---> 69     energy = qseries(fseries, q, f0, return_complex=return_complex)
     70     menergy = abs(energy).max()
     71     energies.append(energy)

File ~/git_repos/pycbc_worktrees/lisa_ew/pycbc/filter/qtransform.py:213, in qseries(fseries, Q, f0, return_complex)
    210 end = int(start + window_size)
    211 center = (start + end) // 2
--> 213 windowed = fseries[start:end] * (1 - xfrequencies ** 2) ** 2 * norm
    215 tlen = (len(fseries)-1) * 2
    216 windowed.resize(tlen)

File ~/git_repos/pycbc_worktrees/lisa_ew/pycbc/types/array.py:217, in Array.__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
    215 def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
    216     inputs = [i.numpy() if isinstance(i, Array) else i for i in inputs]
--> 217     ret = getattr(ufunc, method)(*inputs, **kwargs)
    218     if hasattr(ret, 'shape') and ret.shape == self.shape:
    219         ret = self._return(ret)

ValueError: operands could not be broadcast together with shapes (2315721,) (2374927,) 

Code to reproduce

Note: this requires having BBHx and the PyCBC BBHx plugin installed.

import numpy as np
from pycbc.waveform import get_fd_det_waveform

params = {}
params["ifos"] = "LISA_A"
params["ref_frame"] = "LISA"
params["approximant"] = "BBHX_PhenomD"
params["coa_phase"] = 0.0
params["tdi"] = 1.5
params["mass1"] = 1e6
params["mass2"] = 8e5
params["spin1z"] = 0.0
params["spin2z"] = 0.0
params["distance"] = 410
params["inclination"] = np.pi / 2
params["t_obs_start"] = 31536000
params["delta_f"] = 1.0 / params["t_obs_start"]
params["f_lower"] = 1e-4
params["f_ref"] = 8e-4
params["f_final"] = 0.1
params["delta_t"] = 1 / 0.2
params["t_offset"] = 9206958.120016199
params["tc"] = 4799624.274911478
params["eclipticlongitude"] = 0.5
params["eclipticlatitude"] = 0.23
params["polarization"] = 0.1

wf_fd = get_fd_det_waveform(**params)["LISA_A"]
wf_td = wf_fd.to_timeseries()
times, freqs, power = wf_td.qtransform(
    delta_t=wf_td.delta_t,
    delta_f=wf_td.delta_f,
    frange=(1e-4, 1e-1),
)
@WuShichao WuShichao self-assigned this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants