Open JonathanMushkin opened 2 days ago
Hi Jonathan, thanks for reporting this.
I don't have a very good idea of how to fix this. I also wasn't able to get multiprocessing
and IMRPhenomXODE
to work together although I didn't get the same error as you; in my case it hanged up forever. I just used 1 core and manually disabled multiprocessing to get around this.
A hint given your error message is that the cogwheel.waveform.APPROXIMANTS['IMRPhenomXODE']
key should be populated when cogwheel.waveform_models.xode
is imported.
Maybe multiprocessing
is somehow resetting waveform.APPROXIMANTS
to its original state and not reimporting xode
for every task or worker?
That's how far I got though, and the few things I've tried to solve this have not worked.
Error description:
In
cogwheel/validation/example.py
, changeAPPROXIMANT
value toIMRPhenomXODE
Run cells in1-generate_injections.ipynb
, starting from the top, until I reach the cell:generate_injections.generate_injections_from_config(config, n_cores=8)
See full error output below.
The issue disappears if I keep the approximant at
'IMRPhenomXPHM'
, or if I changen_cores
to 1. I guess the issue is between IMRPhenomXODE and multiprocessing.#############################################################################
Setup: Machine: MacBook Pro 32GB Sequoia 15.0 MacOs. main branch COGWHEEL, and performing setup required to use IMRPhenomXODE.
###########################################################################
Full error message:
{ "name": "KeyError", "message": "'IMRPhenomXODE'", "stack": "--------------------------------------------------------------------------- RemoteTraceback Traceback (most recent call last) RemoteTraceback: \"\"\" Traceback (most recent call last): File \"/Users/jonatahm/miniconda3/envs/gwias/lib/python3.12/multiprocessing/pool.py\", line 125, in worker result = (True, func(*args, **kwds)) ^^^^^^^^^^^^^^^^^^^ File \"/Users/jonatahm/miniconda3/envs/gwias/lib/python3.12/multiprocessing/pool.py\", line 51, in starmapstar return list(itertools.starmap(args[0], args[1])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File \"/Users/jonatahm/Work/GW/cogwheel/cogwheel/validation/../../cogwheel/validation/generate_injections.py\", line 174, in _get_h_h_rb return np.sum(likelihood._get_dh_hh_no_asd_drift(par_dic)[1]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File \"/Users/jonatahm/Work/GW/cogwheel/cogwheel/validation/../../cogwheel/likelihood/relative_binning.py\", line 530, in _get_dh_hh_no_asd_drift d_h, h_h = self._get_dh_hh_complex_no_asd_drift(par_dic) # mpd, mpPd ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File \"/Users/jonatahm/Work/GW/cogwheel/cogwheel/validation/../../cogwheel/likelihood/relative_binning.py\", line 553, in _get_dh_hh_complex_no_asd_drift d_h_mpd, h_h_mpd = self._get_dh_hh_by_m_polarization_detector( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File \"/Users/jonatahm/Work/GW/cogwheel/cogwheel/validation/../../cogwheel/likelihood/relative_binning.py\", line 602, in _get_dh_hh_by_m_polarization_detector = self.waveform_generator.get_hplus_hcross_at_detectors( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File \"/Users/jonatahm/Work/GW/cogwheel/cogwheel/validation/../../cogwheel/waveform.py\", line 431, in get_hplus_hcross_at_detectors hplus_hcross = self.get_hplus_hcross(f, waveform_par_dic, by_m) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File \"/Users/jonatahm/Work/GW/cogwheel/cogwheel/validation/../../cogwheel/waveform.py\", line 493, in get_hplus_hcross = APPROXIMANTS[self.approximant].hplus_hcross_by_mode_func(