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

Adding time-domain LAL waveforms, replacing functions by classes #55

Merged
merged 23 commits into from
Feb 20, 2023

Conversation

bvgoncharov
Copy link
Collaborator

@bvgoncharov bvgoncharov commented Feb 6, 2023

I added the following modifications:

  1. Now, it is possible to call time-domain LAL waveforms in modules/waveforms.py. To facilitate this, function lal_caller() is replaced with classes. There is a new basic waveform class, Waveform(object). Time-domain LAL waveforms are either Fourier-transformed into frequency domain in LALSimulation (class LALFD_Waveform(Waveform)) or returned in time-domain and Fourier transformed in GWFish (class LALTD_Waveform(LALFD_Waveform)) before calculating the Fisher matrix.
  2. In modules/fishermatrix.py, derivative and Fisher matrix functions are also replaced by classes.

There are also a few minor cosmetic changes.

Notes:

  • Only uniform frequency vectors are supported for time-domain models;

GWFish/modules/fishermatrix.py Outdated Show resolved Hide resolved
GWFish/modules/fishermatrix.py Outdated Show resolved Hide resolved
GWFish/modules/fft.py Outdated Show resolved Hide resolved
GWFish/modules/fishermatrix.py Outdated Show resolved Hide resolved
GWFish/modules/fishermatrix.py Outdated Show resolved Hide resolved
@jacopok
Copy link
Collaborator

jacopok commented Feb 7, 2023

Let me say that the things I'm mentioning are minor and overall I think this is a great addition!

@janosch314
Copy link
Owner

janosch314 commented Feb 8, 2023

I agree that these are good changes, but I don't think that all of Jacopo's comments are minor. For example, the way the roll-off is done here might not be safe, and in fact, this is one of the issues we found with time-domain waveforms in the past, which can have important impact on PE. This needs to be tested carefully on signals with varying masses.

@bvgoncharov
Copy link
Collaborator Author

Thanks for reviewing the code, @janosch314 and @jacopok ! As for the roll_off argument in the fft function, the function is not actually used anywhere at the moment, and I will remove it to avoid any confusion. The data is conditioned in LAL, so I do not foresee any problems with tapering.

@bvgoncharov
Copy link
Collaborator Author

Ok, I think I addressed all the comments, @jacopok and @janosch314 . Unless there are any objections from you and also @u-dupletsa , I could merge this PR within a few days.

As a bonus, I now added citation information to README.md, you can see how it looks here: https://github.com/bvgoncharov/GWFish . I think it looks good, but let me know if you would like to change/remove it.

@u-dupletsa
Copy link
Collaborator

u-dupletsa commented Feb 8, 2023 via email

@bvgoncharov
Copy link
Collaborator Author

Hi Ulyana, thanks for looking into the changes! Good point identifying the change in reference frequency, I forgot about it. I introduced it when debugging time-domain waveforms. I considered the following when setting f_ref = f_low:

  • As discussed here, some time-domain waveforms require f_ref = f_low.
  • You can also see in LAL docs for SimInspiralTD here: "If calling with precessing time-domain approximants for which the reference frequency is the starting frequency, or if calling with NR_hdf5 approximant, the starting frequency is not altered".
  • Reference frequency was set to low frequency in our PBH work.
  • From what I remember, the waveform looked smoother with f_ref = f_low, which I expected could introduce less trouble when FFT'ing time-domain waveforms. Empirically, I ran a quick test now, and I see more consistency between mass parameter errors in PhenomXPHM and PhenomTPHM when setting f_ref = f_low, compared to setting e.g. f_ref = 50 # Hz.
  • I also changed the frequency range a lot and got tired of changing f_ref by hand :)

README.md Show resolved Hide resolved
GWFish/modules/waveforms.py Outdated Show resolved Hide resolved
GWFish/modules/waveforms.py Show resolved Hide resolved
GWFish/modules/waveforms.py Outdated Show resolved Hide resolved
GWFish/modules/waveforms.py Show resolved Hide resolved
GWFish/modules/waveforms.py Outdated Show resolved Hide resolved
@jacopok
Copy link
Collaborator

jacopok commented Feb 8, 2023

Hi, sorry for the extra N corrections, I hadn't properly looked through the waveforms module before.
I think the t_of_f is the most important one potentially - at the moment, all waveforms are computed in January 1980!

The warning spam is a bit annoying but not a big deal, I hope.

@bvgoncharov
Copy link
Collaborator Author

bvgoncharov commented Feb 17, 2023

Hi All,

I went through the code again, put back the default reference frequency of 50 Hz in CBC_Simulation.py following a discussion with @u-dupletsa , addressed @jacopok 's comments. Thanks to both of you for the review!

I also removed function hphc_caller because there are many useful internal parameters in waveform objects that would be useful to access in the main script, e.g. CBC_Simulation.py. Loading waveforms through hphc_caller only provided access to the end result. And implementing new waveform would require also changing hphc_caller, which is extra work. Instead, a user can now directly choose a waveform class, and load the waveform through it. To achieve this, I also made GWFish-intrinsic waveforms TaylorF2 and PhenomD as classes. The goal was only to make the code functional, so I did not change anything within these waveforms, e.g. I did not break them into different methods, etc.

As usual, if there are no more comments, I could do a merge in a few days. Tagging @janosch314 , FYI.

Removing comments, docstring updates
@jacopok
Copy link
Collaborator

jacopok commented Feb 19, 2023

Looks good! As written at the moment it breaks the horizon module (since it's importing hphc_amplitudes), but I think this PR can be merged as-is and I can update it to the new syntax quickly thereafter.

bvgoncharov and others added 2 commits February 20, 2023 18:04
…r code in accordance with the recent changes
Removing obsolete function hphc_amplitudes() from horizon.py and other code
@bvgoncharov
Copy link
Collaborator Author

@jacopok , thank you, that was not too hard and I fixed it. Also, for CBC_Background.py, docs/source/figures/SNR_function_of_distance.py, tests/test_waveforms.py. In case we find something else, we can create ad-hoc pull requests. It looks like the main issues are resolved, so I am merging this PR!

@bvgoncharov bvgoncharov merged commit 8e37ebe into janosch314:main Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants