You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In GitLab by @git.ligo:aditya.vijaykumar on Jul 7, 2023, 20:46
@git.ligo:ish.gupta recently found out that adding a lal_waveform_dictionary to the waveform_arguments works fine while sampling, but fails to save to file at the end of sampling with the following error traceback.
File "/Users/aytida/work/rough/bilby/bilby/core/result.py", line 795, in save_to_file
json.dump(dictionary, file, indent=2, cls=BilbyJsonEncoder)
File "/Users/aytida/miniconda3/envs/bilby2/lib/python3.11/json/__init__.py", line 179, in dump
for chunk in iterable:
File "/Users/aytida/miniconda3/envs/bilby2/lib/python3.11/json/encoder.py", line 432, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/Users/aytida/miniconda3/envs/bilby2/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict
yield from chunks
File "/Users/aytida/miniconda3/envs/bilby2/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict
yield from chunks
File "/Users/aytida/miniconda3/envs/bilby2/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict
yield from chunks
File "/Users/aytida/miniconda3/envs/bilby2/lib/python3.11/json/encoder.py", line 439, in _iterencode
o = _default(o)
^^^^^^^^^^^
File "/Users/aytida/work/rough/bilby/bilby/core/utils/io.py", line 87, in default
return json.JSONEncoder.default(self, obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aytida/miniconda3/envs/bilby2/lib/python3.11/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Dict is not JSON serializable
<more stuff>
TypeError: cannot pickle 'lal.Dict' object
I created a patch that resolves this issue by ignoring the lal_waveform_dictionary altogether while saving the file, but I guess that isn't the nicest way to fix this. Happy to start an MR with any suggestions!
The text was updated successfully, but these errors were encountered:
In GitLab by @git.ligo:aditya.vijaykumar on Nov 20, 2023, 16:45
Thanks Colm. I do think the proposed solution in point 1 makes more sense, but I am finding that it is non-trivial to do that. To start with, do you know how to loop over items inside a LAL dict?
If there is no easy way, I will just resort to implementing solution 2, and keeping this issue open so that it can be dealt with at a later date.
In GitLab by @git.ligo:aditya.vijaykumar on Jul 7, 2023, 20:46
@git.ligo:ish.gupta recently found out that adding a lal_waveform_dictionary to the waveform_arguments works fine while sampling, but fails to save to file at the end of sampling with the following error traceback.
I created a patch that resolves this issue by ignoring the
lal_waveform_dictionary
altogether while saving the file, but I guess that isn't the nicest way to fix this. Happy to start an MR with any suggestions!The text was updated successfully, but these errors were encountered: