Skip to main content

A Bayesian Model of Radio Recombination Line Emission

Project description

bayes_yplus

publish tests Documentation Status codecov

A Bayesian Model of Radio Recombination Line Emission

bayes_yplus implements models to infer the helium abundance (y+) from radio recombination line (RRL) observations.

Installation

Basic Installation

Install with pip in a conda virtual environment:

conda create --name bayes_yplus -c conda-forge pymc pip
conda activate bayes_yplus
pip install bayes_yplus

Development Installation

Alternatively, download and unpack the latest release, or fork the repository and contribute to the development of bayes_yplus!

Install in a conda virtual environment:

cd /path/to/bayes_yplus
conda env create -f environment.yml
conda activate bayes_yplus-dev
pip install -e .

Notes on Physics & Radiative Transfer

All models in bayes_yplus assume the emission is optically thin. The helium RRL is assumed to have a fixed centroid velocity -122.15 km/s from that of the hydrogen RRL.

Models

The models provided by bayes_yplus are implemented in the bayes_spec framework. bayes_spec assumes that the source of spectral line emission can be decomposed into a series of "clouds", each of which is defined by a set of model parameters. Here we define the models available in bayes_yplus.

Model Notes

  1. By default, the spectral RMS noise is not inferred, rather it is taken from the noise attribute of the passed SpecData datasets. If prior_rms is not None, then the spectral RMS noise of each dataset is inferred.

YPlusModel

The basic model is YPlusModel. The model assumes that the emission can be explained by hydrogen and helium RRL emission from discrete clouds. The following diagram demonstrates the relationship between the free parameters (empty ellipses), deterministic quantities (rectangles), model predictions (filled ellipses), and observations (filled, round rectangles). Many of the parameters are internally normalized (and thus have names like _norm). The subsequent tables describe the model parameters in more detail.

hfs model graph

Cloud Parameter
variable
Parameter Units Prior, where
($p_0, p_1, \dots$) = prior_{variable}
Default
prior_{variable}
H_area H RRL line area mK km s-1 $\int T_{B, \rm H} dV \sim {\rm HalfNormal}(\sigma=p)$ 1000.0
H_center H RRL center velocity km s-1 $V_{\rm LSR, H} \sim {\rm Normal}(\mu=p_0, \sigma=p_1)$ [0.0, 25.0]
H_fwhm H RRL FWHM line width km s-1 $\Delta V_{\rm H} \sim {\rm Gamma}(\mu=p_0, \sigma=p_1)$ [25.0, 10.0]
He_H_fwhm_ratio He/H FWHM line width ratio `` $\Delta V_{\rm He}/\Delta V_{\rm H} \sim {\rm Gamma}(\mu=p_0, \sigma=p_1)$ [1.0, 0.1]
yplus He$^+/$H$^+$ abundance by number `` $y^+ \sim {\rm HalfNormal}(\sigma=p)$ 0.05
Hyper Parameter
variable
Parameter Units Prior, where
($p_0, p_1, \dots$) = prior_{variable}
Default
prior_{variable}
rms Spectral rms noise mK ${\rm rms} \sim {\rm HalfNormal}(\sigma=p)$ 0.01
baseline_coeffs Normalized polynomial baseline coefficients `` $\beta_i \sim {\rm Normal}(\mu=0.0, \sigma=p_i)$ [1.0]*(baseline_degree + 1)

ordered

An additional parameter to set_priors for these models is ordered. By default, this parameter is False, in which case the order of the clouds is arbitrary. Sampling from these models can be challenging due to the labeling degeneracy: if the order of clouds does not matter (i.e., the emission is optically thin), then each Markov chain could decide on a different, equally-valid order of clouds.

If we assume that the emission is optically thin, then we can set ordered=True, in which case the order of clouds is restricted to be increasing with velocity. When ordered=True, the velocity prior is defined differently:

Cloud Parameter
variable
Parameter Units Prior, where
($p_0, p_1, \dots$) = prior_{variable}
Default
prior_{variable}
H_center H RRL center velocity km s-1 $V_i \sim p_0 + \sum_0^{i-1} V_i + {\rm Gamma}(\alpha=2, \beta=1.0/p_1)$ [0.0, 25.0]

Syntax & Examples

See the various notebooks under examples for demonstrations of these models.

Issues and Contributing

Anyone is welcome to submit issues or contribute to the development of this software via Github.

License and Copyright

Copyright(C) 2024-2025 by Trey V. Wenger

This code is licensed under MIT license (see LICENSE for details)

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

bayes_yplus-1.3.2.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

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

bayes_yplus-1.3.2-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file bayes_yplus-1.3.2.tar.gz.

File metadata

  • Download URL: bayes_yplus-1.3.2.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for bayes_yplus-1.3.2.tar.gz
Algorithm Hash digest
SHA256 f8dd7e62882a4d84edf1cd459bbcbc2322470152445411876bb1058ac0d83c85
MD5 0c9e3239b26ecff232b3f285cc76c050
BLAKE2b-256 230e8f3bc4d6652a1cbed6d9432708115c2308dd35726da478a47b0d21ec3694

See more details on using hashes here.

Provenance

The following attestation bundles were made for bayes_yplus-1.3.2.tar.gz:

Publisher: publish.yml on tvwenger/bayes_yplus

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

File details

Details for the file bayes_yplus-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: bayes_yplus-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for bayes_yplus-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 65662102fd9e947dc0ce6969f6538dbea29da495add56b8fb67ce26a6ce3fd9d
MD5 bb73770ff9534be26061089496ea7472
BLAKE2b-256 bd5b65b4d045ec5484f13004c9ded09d9ef70bbe8033d26c56a95dc2197c0aa4

See more details on using hashes here.

Provenance

The following attestation bundles were made for bayes_yplus-1.3.2-py3-none-any.whl:

Publisher: publish.yml on tvwenger/bayes_yplus

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