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

IMRPhenomPv2 fix #176

Merged
merged 8 commits into from
Dec 29, 2024
Merged

IMRPhenomPv2 fix #176

merged 8 commits into from
Dec 29, 2024

Conversation

ravioli1369
Copy link
Member

No description provided.

@ravioli1369 ravioli1369 requested review from EthanMarx and deepchatterjeeligo and removed request for deepchatterjeeligo and EthanMarx December 29, 2024 03:55
ml4gw/waveforms/cbc/phenom_d.py Show resolved Hide resolved
alpha1 = self.alpha1Fit(eta, eta2, xi)
alpha2 = self.alpha2Fit(eta, eta2, xi)
alpha3 = self.alpha3Fit(eta, eta2, xi)
alpha4 = self.alpha4Fit(eta, eta2, xi)
alpha5 = self.alpha5Fit(eta, eta2, xi)

# merger ringdown
fRD, fDM = self.fring_fdamp(eta, eta2, chi1, chi2)
if (fRD is None) or (fDM is None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For completeness, throw a RuntimeError if only one of fRD or fDM is not none.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be better to make the or into an and?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but check the behavior. It's better to be explicit and to raise the error for unexpected combinations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea I did that in the latest commit, could you take a look?

@ravioli1369 ravioli1369 merged commit 047aaba into ML4GW:dev Dec 29, 2024
6 checks passed
@@ -409,14 +434,14 @@ def test_phenom_p():
hc_lal_data = hc_lal.data.data[lal_mask]

assert np.allclose(
1e21 * hp_lal_data.real, 1e21 * hp_ml4gw.real.numpy(), atol=2e-3
1e21 * hp_lal_data.real, 1e21 * hp_ml4gw.real.numpy(), atol=1e-2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was it necessary to increase the tolerance? Do we agree less closely with lalsim after these changes? Or are we testing a wider range of parameter space?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous version of the waveform didn't match at all with lalsim when the tests were expanded to a larger parameter space. Now we match well in the full space, but certain parameters cause differences larger than ~6e-3, so I made it 1e-2.

EthanMarx pushed a commit that referenced this pull request Jan 4, 2025
* bug fix for xy spins

* run pre-commit

* pass fRD and fDM through to phenom_d phase and amp functions

* switch to relative imports

* use chirp mass to mass ratio conversion function

* create tests for phenom_p

* lower tolerance for phenom_p

* comments and additional checks for fRD and fDM
# ).view(-1, 1)
# interpolate at x = 1, as thats the same as f = fRD
diffRDphase = -self.interpolate(
torch.tensor([1]), x[1:-1], diffRDphase

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The x[1:-1] and diffRDphase will have different shapes when the batch size is not one.
Probably need to let x[1:-1] follow the shape of diffRDphase so the function can correctly interpolate.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ravioli1369 can you look into this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add to the tests a test that uses batched inputs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this is a good catch. They TaylorF2 and PhenomD tests had the same parameters repeated along the batch dimension. I think that is the easiest extension to the tests to ensure the plumbing is working as expected.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the oversight during the review.

EthanMarx pushed a commit that referenced this pull request Jan 9, 2025
* bug fix for xy spins

* run pre-commit

* pass fRD and fDM through to phenom_d phase and amp functions

* switch to relative imports

* use chirp mass to mass ratio conversion function

* create tests for phenom_p

* lower tolerance for phenom_p

* comments and additional checks for fRD and fDM
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.

5 participants