ripplegw


Nameripplegw JSON
Version 0.0.6 PyPI version JSON
download
home_pagehttps://ripple.readthedocs.io/en/latest/
SummaryA small jax package for differentiable and fast gravitational wave data analysis.
upload_time2024-05-08 21:39:23
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords gravitational waves jax
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Ripple :ocean:

A small `jax` package for differentiable and fast gravitational wave data analysis.

# Getting Started

### Installation

Both waveforms have been tested extensively and match `lalsuite` implementations to machine precision across all the parameter space. 

Ripple can be installed using 

```
pip3 install ripplegw
```

Note that by default we do not include enable float64 in `jax` since we want allow users to use float32 to improve performance.
If you require float64, please include the following code at the start of the script:

```
from jax import config
config.update("jax_enable_x64", True)
```

See https://jax.readthedocs.io/en/latest/notebooks/Common_Gotchas_in_JAX.html for other common `jax` gotchas.

### Supported waveforms

- IMRPhenomXAS (aligned spin)
- IMRPhenomD (aligned spin)
- IMRPhenomPv2 (Still finalizing sampling checks)
- TaylorF2 with tidal effects
- IMRPhenomD_NRTidalv2, verified for the low spin regime (chi1, chi2 < 0.05), further testing is required for higher spins

### Generating a waveform and its derivative

Generating a waveform is incredibly easy. Below is an example of calling the PhenomXAS waveform model
to get the h_+ and h_x polarizations of the waveform model

We start with some basic imports:

```python
import jax.numpy as jnp

from ripple.waveforms import IMRPhenomXAS
from ripple import ms_to_Mc_eta
```

And now we can just set the parameters and call the waveform!

```python
# Get a frequency domain waveform
# source parameters

m1_msun = 20.0 # In solar masses
m2_msun = 19.0
chi1 = 0.5 # Dimensionless spin
chi2 = -0.5
tc = 0.0 # Time of coalescence in seconds
phic = 0.0 # Time of coalescence
dist_mpc = 440 # Distance to source in Mpc
inclination = 0.0 # Inclination Angle

# The PhenomD waveform model is parameterized with the chirp mass and symmetric mass ratio
Mc, eta = ms_to_Mc_eta(jnp.array([m1_msun, m2_msun]))

# These are the parametrs that go into the waveform generator
# Note that JAX does not give index errors, so if you pass in the
# the wrong array it will behave strangely
theta_ripple = jnp.array([Mc, eta, chi1, chi2, dist_mpc, tc, phic, inclination])

# Now we need to generate the frequency grid
f_l = 24
f_u = 512
del_f = 0.01
fs = jnp.arange(f_l, f_u, del_f)
f_ref = f_l

# And finally lets generate the waveform!
hp_ripple, hc_ripple = IMRPhenomXAS.gen_IMRPhenomXAS_hphc(fs, theta_ripple, f_ref)

# Note that we have not internally jitted the functions since this would
# introduce an annoying overhead each time the user evaluated the function with a different length frequency array
# We therefore recommend that the user jit the function themselves to accelerate evaluations. For example:

import jax

@jax.jit
def waveform(theta):
    return IMRPhenomXAS.gen_IMRPhenomXAS_hphc(fs, theta)
```


### Citation

Please cite this paper if you've used `ripple` in your work! It's really helpful!

```bibtex
@article{Edwards:2023sak,
    author = "Edwards, Thomas D. P. and Wong, Kaze W. K. and Lam, Kelvin K. H. and Coogan, Adam and Foreman-Mackey, Daniel and Isi, Maximiliano and Zimmerman, Aaron",
    title = "{ripple: Differentiable and Hardware-Accelerated Waveforms for Gravitational Wave Data Analysis}",
    eprint = "2302.05329",
    archivePrefix = "arXiv",
    primaryClass = "astro-ph.IM",
    month = "2",
    year = "2023"
}
```

### Contributions

Contributions through pull requests are very welcome. Please also feel free to open new issues if there are missing features you'd like to see!

The only requirement for contributions to be considered is that they are run through the black code formatter. This ensures we have a coherent format and makes the code easier to review/read!

            

Raw data

            {
    "_id": null,
    "home_page": "https://ripple.readthedocs.io/en/latest/",
    "name": "ripplegw",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "gravitational waves, jax",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/2d/bb/6591e6cd1252e5b996167090aa2bea007885b2558fb4ad806640e49e2211/ripplegw-0.0.6.tar.gz",
    "platform": null,
    "description": "# Ripple :ocean:\n\nA small `jax` package for differentiable and fast gravitational wave data analysis.\n\n# Getting Started\n\n### Installation\n\nBoth waveforms have been tested extensively and match `lalsuite` implementations to machine precision across all the parameter space. \n\nRipple can be installed using \n\n```\npip3 install ripplegw\n```\n\nNote that by default we do not include enable float64 in `jax` since we want allow users to use float32 to improve performance.\nIf you require float64, please include the following code at the start of the script:\n\n```\nfrom jax import config\nconfig.update(\"jax_enable_x64\", True)\n```\n\nSee https://jax.readthedocs.io/en/latest/notebooks/Common_Gotchas_in_JAX.html for other common `jax` gotchas.\n\n### Supported waveforms\n\n- IMRPhenomXAS (aligned spin)\n- IMRPhenomD (aligned spin)\n- IMRPhenomPv2 (Still finalizing sampling checks)\n- TaylorF2 with tidal effects\n- IMRPhenomD_NRTidalv2, verified for the low spin regime (chi1, chi2 < 0.05), further testing is required for higher spins\n\n### Generating a waveform and its derivative\n\nGenerating a waveform is incredibly easy. Below is an example of calling the PhenomXAS waveform model\nto get the h_+ and h_x polarizations of the waveform model\n\nWe start with some basic imports:\n\n```python\nimport jax.numpy as jnp\n\nfrom ripple.waveforms import IMRPhenomXAS\nfrom ripple import ms_to_Mc_eta\n```\n\nAnd now we can just set the parameters and call the waveform!\n\n```python\n# Get a frequency domain waveform\n# source parameters\n\nm1_msun = 20.0 # In solar masses\nm2_msun = 19.0\nchi1 = 0.5 # Dimensionless spin\nchi2 = -0.5\ntc = 0.0 # Time of coalescence in seconds\nphic = 0.0 # Time of coalescence\ndist_mpc = 440 # Distance to source in Mpc\ninclination = 0.0 # Inclination Angle\n\n# The PhenomD waveform model is parameterized with the chirp mass and symmetric mass ratio\nMc, eta = ms_to_Mc_eta(jnp.array([m1_msun, m2_msun]))\n\n# These are the parametrs that go into the waveform generator\n# Note that JAX does not give index errors, so if you pass in the\n# the wrong array it will behave strangely\ntheta_ripple = jnp.array([Mc, eta, chi1, chi2, dist_mpc, tc, phic, inclination])\n\n# Now we need to generate the frequency grid\nf_l = 24\nf_u = 512\ndel_f = 0.01\nfs = jnp.arange(f_l, f_u, del_f)\nf_ref = f_l\n\n# And finally lets generate the waveform!\nhp_ripple, hc_ripple = IMRPhenomXAS.gen_IMRPhenomXAS_hphc(fs, theta_ripple, f_ref)\n\n# Note that we have not internally jitted the functions since this would\n# introduce an annoying overhead each time the user evaluated the function with a different length frequency array\n# We therefore recommend that the user jit the function themselves to accelerate evaluations. For example:\n\nimport jax\n\n@jax.jit\ndef waveform(theta):\n    return IMRPhenomXAS.gen_IMRPhenomXAS_hphc(fs, theta)\n```\n\n\n### Citation\n\nPlease cite this paper if you've used `ripple` in your work! It's really helpful!\n\n```bibtex\n@article{Edwards:2023sak,\n    author = \"Edwards, Thomas D. P. and Wong, Kaze W. K. and Lam, Kelvin K. H. and Coogan, Adam and Foreman-Mackey, Daniel and Isi, Maximiliano and Zimmerman, Aaron\",\n    title = \"{ripple: Differentiable and Hardware-Accelerated Waveforms for Gravitational Wave Data Analysis}\",\n    eprint = \"2302.05329\",\n    archivePrefix = \"arXiv\",\n    primaryClass = \"astro-ph.IM\",\n    month = \"2\",\n    year = \"2023\"\n}\n```\n\n### Contributions\n\nContributions through pull requests are very welcome. Please also feel free to open new issues if there are missing features you'd like to see!\n\nThe only requirement for contributions to be considered is that they are run through the black code formatter. This ensures we have a coherent format and makes the code easier to review/read!\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A small jax package for differentiable and fast gravitational wave data analysis.",
    "version": "0.0.6",
    "project_urls": {
        "Bug Tracker": "https://github.com/tedwards2412/ripple",
        "Homepage": "https://ripple.readthedocs.io/en/latest/"
    },
    "split_keywords": [
        "gravitational waves",
        " jax"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ff7179039d6524dc19f48ff8c21c9345750b8ce70c284aebbe2a68b1ad8c61b5",
                "md5": "44a031162272416484114e0c7ffc32a5",
                "sha256": "e0372cdb5fa71969ba3712deed2cdbc95be893c23fae2c0a9171df809173735c"
            },
            "downloads": -1,
            "filename": "ripplegw-0.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "44a031162272416484114e0c7ffc32a5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 455729,
            "upload_time": "2024-05-08T21:39:35",
            "upload_time_iso_8601": "2024-05-08T21:39:35.284759Z",
            "url": "https://files.pythonhosted.org/packages/ff/71/79039d6524dc19f48ff8c21c9345750b8ce70c284aebbe2a68b1ad8c61b5/ripplegw-0.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2dbb6591e6cd1252e5b996167090aa2bea007885b2558fb4ad806640e49e2211",
                "md5": "913bdb57df75762b83617184398a49dc",
                "sha256": "b3efaadd05d9bb2a89cdb216f7351cbac17053a278ed619fe3ac620c198c7c91"
            },
            "downloads": -1,
            "filename": "ripplegw-0.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "913bdb57df75762b83617184398a49dc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 453641,
            "upload_time": "2024-05-08T21:39:23",
            "upload_time_iso_8601": "2024-05-08T21:39:23.868749Z",
            "url": "https://files.pythonhosted.org/packages/2d/bb/6591e6cd1252e5b996167090aa2bea007885b2558fb4ad806640e49e2211/ripplegw-0.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-08 21:39:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tedwards2412",
    "github_project": "ripple",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ripplegw"
}
        
Elapsed time: 0.26264s