FEAT: add gwsignal waveform generator#877
Conversation
|
Thanks for doing things @ColmTalbot, it looks like a good start to me! I had a quick look and added some comments. |
|
Hi @ColmTalbot I also really like this idea! Just want to mention that for |
|
Thank you for the PR @ColmTalbot . I am all fine with any changes you make. |
That's a good question, it looks like it currently isn't possible. I see two options:
|
I guess this is the way to go, but I don't know if we can make this ready by the freeze end of March (according to your email).
For this, we would need a wrapper class that acts as a "factory" for the implementation suggested in the PR. I don't know how hard is it to get the change into |
|
Reminder for me that I need to add some tests. |
|
I noticed that the previous version was incompatible with parallelisation via multiprocessing due to a pickling issue. The current version will reconstruct the waveform generator every time it is pickled/unpickled. The way we handle multiprocessing, this means that the generator should only be set up once when the pool is created. @raffienficiaud do you think this will cause any issues for SEOBNR? |
For |
We do use them for both in bilby_pipe, but I think there's an assumption that the different stages in bilby_pipe use the same environment, so we should be safe there. |
As long as there is no code change between the two, then it should be fine. However, if there is any reference to these objects in the pickled files (eg. posteriors) then this may be an issue. I had a look at the code and now I am thinking that it is a bit of a pitty we would need to reinstanciate completely the generator for each subprocesses: there are some global objects that are being created the first time we load Do you have an intuition what is preventing the pickling? My guess is that there are some LAL objects laying around. |
|
There are two things that can't be simply pickled.
|
Yes, I guess just storing the class |
|
I ran some tests and added an example using the new generator. Everything seems to be working well, so I think this is ready for a final round of review. |
Excellent, thank you @ColmTalbot |
mj-will
left a comment
There was a problem hiding this comment.
This looks good to me. Just a couple of minor comments and questions.
ColmTalbot
left a comment
There was a problem hiding this comment.
Thanks for the comments, I'll address some of the longer ones later.
asb5468
left a comment
There was a problem hiding this comment.
I've left some in-line comments for things I don't understand, but I think I'm missing the bigger context here. Why does this require an entirely new waveform generator and not just modifications to the source function? I don't love the fact that the kind of waveform generator now needs to be specified when the code is being set up, rather than just changing the source function.
I'll start by saying that this is not a required change for users (unless they want to use eccentric waveform models without writing their own source functions) but the path that should require the least maintenance burden for supporting new waveform models. There are a few advantages (ideally) to this method:
There are a few reasons that this method may not be always the preferred method:
|
asb5468
left a comment
There was a problem hiding this comment.
I'm happy with the latest updates and explanations.
* FEAT: add gwsignal waveform generator * FMT: flake fixes * REFACTOR: simplify default parameter logic * BUG: cleanly handle none waveforms * BUG: make sure none waveform is propagated * BUG: fixes found in testing * TST: use the new generator in a likelihood test * TST: add tests for the new generator * TST: update waveform generator repr test * TYPO: formatting fixes * BUG: make gwsignal generator pickleable * FMT: remove unneeded line * EXAMPLE: make eccentric example use gwsignal generator * FMT: fix precommits * MAINT: Fix where the logger is imported from * DOC: update gwsignal generator docstring * DOC: force flake to ignore long link * FMT: precommit fix * Address Sylvia's comments
* FEAT: add gwsignal waveform generator * FMT: flake fixes * REFACTOR: simplify default parameter logic * BUG: cleanly handle none waveforms * BUG: make sure none waveform is propagated * BUG: fixes found in testing * TST: use the new generator in a likelihood test * TST: add tests for the new generator * TST: update waveform generator repr test * TYPO: formatting fixes * BUG: make gwsignal generator pickleable * FMT: remove unneeded line * EXAMPLE: make eccentric example use gwsignal generator * FMT: fix precommits * MAINT: Fix where the logger is imported from * DOC: update gwsignal generator docstring * DOC: force flake to ignore long link * FMT: precommit fix * Address Sylvia's comments
* FEAT: add gwsignal waveform generator * FMT: flake fixes * REFACTOR: simplify default parameter logic * BUG: cleanly handle none waveforms * BUG: make sure none waveform is propagated * BUG: fixes found in testing * TST: use the new generator in a likelihood test * TST: add tests for the new generator * TST: update waveform generator repr test * TYPO: formatting fixes * BUG: make gwsignal generator pickleable * FMT: remove unneeded line * EXAMPLE: make eccentric example use gwsignal generator * FMT: fix precommits * MAINT: Fix where the logger is imported from * DOC: update gwsignal generator docstring * DOC: force flake to ignore long link * FMT: precommit fix * Address Sylvia's comments
@raffienficiaud this is a quick version of how I had envisioned an extension to the gwsignal support. It doesn't require explicit enumeration of all of the different kinds of source models, users can just do something like
I'm sure there are improvements that could be made to the interface, but I'm hopeful that something like this can be fairly transparent to the underlying
gwsignalcapabilities and ideally not need a lot of modification as more features are added to that. Since you have more experience withgwsignalI'd be glad to hear any thoughts.Also @adivijaykumar @AntoniRamosBuades and @mj-will