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.0a2.tar.gz (11.8 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.0a2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gwflow-0.1.0a2.tar.gz
  • Upload date:
  • Size: 11.8 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.0a2.tar.gz
Algorithm Hash digest
SHA256 c1c101e14bcad6bb646b19af9651a25d072bc857dbfdcb789f4752869eb3fd9e
MD5 f30e0a964d188d011ac402306b648c08
BLAKE2b-256 91800b378901ec3ee4e1f36f70979e172bef44bdaa7e5368b09fa143c705f781

See more details on using hashes here.

Provenance

The following attestation bundles were made for gwflow-0.1.0a2.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.0a2-py3-none-any.whl.

File metadata

  • Download URL: gwflow-0.1.0a2-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.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 2af88692dea52ae2ce79515048e67fdcfff5b56cd50c9f0fa98d465b2906c5a5
MD5 9d2449523f13e17007f78146dbf6a73f
BLAKE2b-256 64eb1ca1d2443c541f313817ef5473e6035bba02a714a9551329c71e01147f57

See more details on using hashes here.

Provenance

The following attestation bundles were made for gwflow-0.1.0a2-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