Skip to main content

No project description provided

Project description

aspire-bilby

Interface between aspire and bilby.

Installation

aspire-bilby is available via pypi:

pip install aspire-bilby

Usage in bilby

aspire can be used just like any other sampler in bilby and supports multiprocessing via the n_pool keyword argument.

bilby.run_sampler(
    sampler="aspire",
    n_samples=1000,
    n_final_samples=None,  # Optional, final number of samples to produce
    sample_kwargs=dict(
        sampler="smc"
    ),
    fit_kwargs=dict(
        n_epochs=100,
    ),
    n_pool=4,
)

Using a set of samples

from aspire.samples import Samples

initial_samples = Samples(...)  # Define initial samples

bilby.run_sampler(
    sampler="aspire",
    initial_samples=initial_samples,
    ...
)

Using a bilby result file

bilby.run_sampler(
    sampler="aspire",
    initial_result_file="<path to bilby result file>"
    ...,
)

Sampling from the prior

bilby.run_sampler(
    sampler="aspire",
    n_initial_samples=5000,  # Number of samples to draw from the prior, defaults to 10,000 if not specified
    ...,
)

Using bilby objects with aspire

aspire-bilby also provides functions for converting bilby likelihood and prior objects into

import bilby
from aspire import Aspire
from aspire_bilby.utils import samples_from_bilby_result, get_aspire_functions

likelihood = ...    # Define bilby likelihood
priors = ...        # Define bilby priors

result = bilby.core.utils.read_in_result(...)    # Read in bilby result

functions = get_aspire_functions(
    likelihood,
    priors,
    parameters=priors.non_fixed_keys,
)

initial_samples = samples_from_bilby_result(result)

aspire = Aspire(
    log_likelihood=functions.log_likelihood,
    log_prior=functions.log_prior,
    dims=len(initial_samples.parameters),
)

history = aspire.fit(initial_samples)

Usage in bilby_pipe

aspire can be used with bilby_pipe as you would any other sampler:

sampler = "aspire"
sampler_kwargs = {
    "initial_result_file": "path_to_file",
    "sample_kwargs": {...},
    "fit_kwargs": {...},
}

If using transfer files, you may also need to add the initial result file to the additional-transfer-paths.

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

aspire_bilby-0.1.0a4.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

aspire_bilby-0.1.0a4-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file aspire_bilby-0.1.0a4.tar.gz.

File metadata

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

File hashes

Hashes for aspire_bilby-0.1.0a4.tar.gz
Algorithm Hash digest
SHA256 18feca27990f9e382bf4b98c5793989ba64eebc9a12fb0c4fa316d10088fc0ec
MD5 1ea62e78be83c1a25caa27bc041a3a01
BLAKE2b-256 7dde23d53545a1be7995a750c171dbbd1d8ec264bfe3e9a793c3bdacb4d0bf1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for aspire_bilby-0.1.0a4.tar.gz:

Publisher: publish.yml on mj-will/aspire-bilby

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

File details

Details for the file aspire_bilby-0.1.0a4-py3-none-any.whl.

File metadata

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

File hashes

Hashes for aspire_bilby-0.1.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 7ecf34c99e2ebeeda97c676c823c222ec9eac91f2f0033c662fb81799e39d472
MD5 0f26c66c935484255ff4e6fa9621e28a
BLAKE2b-256 0cb2518bc1052a51083d61bea7afdc4f0cd487bd170ab20261c2fae0f7d735d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for aspire_bilby-0.1.0a4-py3-none-any.whl:

Publisher: publish.yml on mj-will/aspire-bilby

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