-
Notifications
You must be signed in to change notification settings - Fork 353
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 detector class for calculating LISA projections and response function #4691
base: master
Are you sure you want to change the base?
Conversation
pycbc/detector.py
Outdated
# initialize whether to use gpu; FLR has handles if this cannot be done | ||
self.use_gpu = use_gpu | ||
|
||
def project_wf(self, hp, hc, lamb, beta, t0=None, use_gpu=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mimic the interface here used for the ground based detectors e.g. try to make them as similar as possible. Also, we want to be a little bit future proof as we'll likely have more than just the faslisa implementation and so will want to be able to switch between approximations / implementations of the response.
ab8a59f
to
331503a
Compare
The One pending issue regards the usage of |
@acorreia61201 You'll want to rebase this PR, get the unittest to pass with your PR, and then demonstrate how this compares to say calling BBHx directly. E.g. can you post an example that reproduces BBHx output but using this class and say starting from IMRPhenomD? |
@acorreia61201 Can you do this test: from the typical parameter space (prior) of SMBHB and stellar-mass BBH to compute the overlap between BBHx plugin and this PR? Let's do 1000 draw and plot histogram of overlap (not the match). |
c6c46f8
to
da48da3
Compare
6e43ce0
to
eb73c29
Compare
eb73c29
to
c1123ff
Compare
68b61c7
to
0988e18
Compare
…ixed bug where orbit file was truncated by default init params
…consistent with LIGO detector class
… most recent PyCBC patch (6/4/24)
…rbit file start time
…dit companion (temp pypmc fix, add FLR)
…le times conversion to be based on reference time
…that detector flag specifies code base (currently supports LDC, FLR)
…e detector class using ABC
26b2e7b
to
bfc0cc7
Compare
pycbc/detector.py
Outdated
|
||
Parameters | ||
---------- | ||
reference_time : float (optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@acorreia61201 For a base class, you want to make sure it really is the minimal set of things that all implementations must have to work. I think there are few things here that don't necessarily qualify. It might be worth going through and pruning a bit here.
A base class for example shouldn't have options just because a child class might have them. It's the child class's job to implement things that are specific to it.
pycbc/detector.py
Outdated
|
||
def get_gcrs_pos(self, location): | ||
""" Transforms ICRS frame to GCRS frame | ||
def preprocess(self, hp, hc, polarization=0, reference_time=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this routine mean for a truly generic implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both the FLR and LDC versions had some common routines that needed to be applied to the waveforms before inputting them into the response generation. Mainly, this function is making sure that the signals fit into the orbital data being supplied. The original intent was to circumvent errors both backends throw when the signal extends past the orbital data, but I think this could be a generic way to ensure the waveform can be projected given the orbits.
There are some other functions in here (e.g. polarization, padding, start/ref time caching) that I added just to prevent them from being copied for each implementation, although in the interest of making the base class as generic as possible I could move these to the backend classes.
An organizational comment, this might be a good time to turn the module into a package itself as the file is getting quite long. |
@acorreia61201 It's fine to have common functionality / methods between the LDC / flr methods, but that's somewhat different than what should be in the abstract base class. You could have them share methods by using an auxiliary class that they both inherit from or a simple function that they both can call. So avoiding code duplication is definitely good. For classes though we also want to make sure there is a clear interface of what must be defined so that people can build against it. |
@ahnitz When you say turn the module to a package, do you mean moving the space-based classes to a new file (say, |
@acorreia61201 I mean this https://docs.python.org/3/tutorial/modules.html#packages e.g. create a 'detector' folder rather than signle module we have now. Then split up the functions into separate files e.g. ground.py space.py etc. A package also has an init.py which can provide truly global / common functions and also preserve the expected namespace by importing things from the submodules so that nobody has to change their existing code and can still do say (pycbc.detector.Detector("H1")... Does that make sense? |
I think that makes sense; it seems simple enough looking at some of the other |
…ributes from base to child classes
…ased detectors/utils into different files
@ahnitz @WuShichao I've reworked the structure of the space classes and detector module as suggested. Are there any other checks or changes I should make once the unittests pass? |
No description provided.