Skip to content

Conversation

@GarethCabournDavies
Copy link
Contributor

Use numpy / astropy constants instead of lal. Allow use of lal constants if a environment variable is set.

Standard information about the request

This is a change to the source of truth for certain values
This change affects: the offline search, the live search, inference, PyGRB (but shouldn't actually affect anything if values are the same)
This change changes: documentation, result presentation / plotting, scientific output (but shouldn't actually affect anything if values are the same)

This change: has appropriate unit tests, follows style guidelines (See e.g. PEP8), has been proposed using the contribution guidelines

Motivation

I am worried about bloat of the pycbc package, and removing lal dependency (when we will use it for non-LIGO searches in future) should make the package significantly smaller

Contents

  • add a new pycbc/constants.py module which sets constants according to numpy/astropy but can be changed for lal constants if wanted
  • add a test so that these can be compared

Links to any issues or associated PRs

This was part of #5217 but was getting to be hard to manage along with with the changes to the epoch

Testing performed

Testing according to the CI should pass. all constants are currently with np.isclose between numpy/astropy and lal

  • The author of this pull request confirms they will adhere to the code of conduct

Copilot AI review requested due to automatic review settings November 28, 2025 10:55
@GarethCabournDavies GarethCabournDavies marked this pull request as draft November 28, 2025 10:57
@GarethCabournDavies
Copy link
Contributor Author

ugh, I need to move some of the changes out of this branch again - there is some stuff to do with time conversions that should be a separate PR as well. I am converting to draft

This comment was marked as outdated.

GarethCabournDavies and others added 2 commits November 28, 2025 11:48
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

GarethCabournDavies and others added 4 commits November 28, 2025 16:06
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@spxiwh spxiwh left a comment

Choose a reason for hiding this comment

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

I think this mostly does what it says. I have a few questions, but mostly it looks good to me.

Are there no Cython codes doing c-imports of LAL constants? spa_tmplt_cpu.pyx does seem to import lal, but then uses libc.math for PI and doesn't use lal at all.

# You should have received a copy of the GNU General Public License
# along with with program; see the file COPYING. If not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for this module to still exist? PhenomC is now outdated, this is not how we do GPU waveforms for templates ...

Copy link
Contributor

Choose a reason for hiding this comment

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

(Doesn't need to be resolved here, just wondering out loud)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you did miss the same thing in SpinTaylorF2.py though ... Again though that one might well be better removed at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think I missed anything in SpinTaylorF2?

@GarethCabournDavies
Copy link
Contributor Author

Would you want me to update the libc.math usages? I was mainly focused on not using lalsuite

@GarethCabournDavies GarethCabournDavies merged commit 7d0c58c into gwastro:master Jan 5, 2026
28 checks passed
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.

2 participants