Skip to main content

Normalizing flows for gravitational-wave analyses

Project description

gwflow

Normalizing flows for gravitational-wave analyses.

gwflow builds on zuko and implements normalizing flows with problem-specific modifications.

Installation

gwflow is currently only available from source:

pip install git+git@github.com:mj-will/gwflow.git

Flows

GWCalFlow

This flow is designed for use in analyses where there are large number of (simple) calibration parameters with approximately Gaussian distributions.

It approximates the distribution over the calibration parameters separately to the main GW parameters. It supports two options for handling the calibration parameters:

  • calibration_model='gaussian': fit a Gaussian with a diagonal covariance matrix
  • calibration_model='nn': fit a neural network that estimates the per-parameter mean and variance for of a diagonal Gaussian

Usage

GWCalFlow supports three different ways of specifying which parameters are 'GW' parameters and which are calibration parameters.

We provided a factory class than can be used to instantiate the flow using various different methods:

from gwflow import GWClaFlow

Then, assuming data lies in an n-dimensional space with parameters that described the signal (GW parameters) and calibration parameters. The objects returned in each support the same functionality as standard flows from zuko.

In all cases, additional keyword arguments can be passed when instantiating the class and these will be used to configure e.g. the normalizing flow.

Parameters names

Using a list of parameter names and regex:

flow = GWCalFlow(
    parameters=["chirp_mass", "mass_ratio", ..., "recalib_H1_amplitude_0", ...],
    calib_regex=".*calib.*",
)

Indices

Using the indices for GW and calibration parameters

flow = GWCalFlow(
    gw_idx=[0, 1, 3],
    cal_idx=[2, 5]
)

Slices

Using slices, assuming the GW parameters are first

flow = GWCalFlow(
    gw_dim=15,
    cal_dim=20,
)

Basic usage

Flows are used in the same way as zuko flows:

flow = GWFlowClas(gw_dim=15, cal_dim=20, context=4, transforms=3)

x = flow().sample((10,))

log_prob = flow().log_prob(x)

# If the flow is conditional
x = flow(c).sample((10,))

For more details, see the zuko documentation

Note: since the transform only applies to a subset of the parameter space, the flow does not expose this attribute.

Citation

If you use gwflow in your work, please cite our DOI (to be added) and zuko.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gwflow-0.1.0a1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gwflow-0.1.0a1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file gwflow-0.1.0a1.tar.gz.

File metadata

  • Download URL: gwflow-0.1.0a1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gwflow-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 2cf0bc0c1a783c030823acfb1df2078ab674c53fa2bb333bb1229b1e236a64c4
MD5 240f4310a36b7349628931271981dd78
BLAKE2b-256 968a6791edb061937bb0337ccc38151d08ef3b46c06c882da94dc90f23a489d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for gwflow-0.1.0a1.tar.gz:

Publisher: publish.yml on mj-will/gwflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gwflow-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: gwflow-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gwflow-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 2da3691ae94f7c5c8c44de6a856ebbe7425b6d6d1d7e6aec86026b0c5e297dbb
MD5 352fe88a890f7e51a5734b044375e887
BLAKE2b-256 ec41ac87a76f72aa9cf3752cea620dff274dec31b55da6e2cf3f5b3523a25a2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for gwflow-0.1.0a1-py3-none-any.whl:

Publisher: publish.yml on mj-will/gwflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page