A Bayesian Model of Radio Recombination Line Emission
Project description
bayes_yplus
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
- Notes on Physics & Radiative Transfer
- Models
- Syntax & Examples
- Issues and Contributing
- License and Copyright
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
- The
velocityof a cloud can be challenging to identify when spectral lines are narrow and widely separated. We overcome this limitation by modeling the line profiles as a "pseudo-Voight" profile, which is a linear combination of a Gaussian and Lorentzian profile. The parameterfwhm_Lis a latent hyper-parameter (shared among all clouds) that characterizes the width of the Lorentzian part of the line profile. Whenfwhm_Lis zero, the line is perfectly Gaussian. This parameter produces line profile wings that may not be physical but nonetheless enable the optimization algorithms (i.e, MCMC) to converge more reliably and efficiently. Model solutions withfwhm_Lmuch larger than the channel size should be scrutinized carefully. - By default, the spectral RMS noise is not inferred, rather it is taken from the
noiseattribute of the passedSpecDatadatasets. Ifprior_rmsis 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.
Cloud Parametervariable |
Parameter | Units | Prior, where ($p_0, p_1, \dots$) = prior_{variable} |
Defaultprior_{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 Parametervariable |
Parameter | Units | Prior, where ($p_0, p_1, \dots$) = prior_{variable} |
Defaultprior_{variable} |
|---|---|---|---|---|
fwhm_L |
Lorentzian FWHM line width | km s-1 |
$\Delta V_{L} \sim {\rm HalfNormal}(\sigma=p)$ | 1.0 |
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 Parametervariable |
Parameter | Units | Prior, where ($p_0, p_1, \dots$) = prior_{variable} |
Defaultprior_{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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bayes_yplus-1.3.1.tar.gz.
File metadata
- Download URL: bayes_yplus-1.3.1.tar.gz
- Upload date:
- Size: 31.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
788724fbc3205ef16b5a1186027edbab804deaede783b4004c47ec12da45651c
|
|
| MD5 |
1565f32f82a718c8eb201ed861b15881
|
|
| BLAKE2b-256 |
5fdb8f1602a81bb0bfddcd22db61bd2f843c46b5a94835e000638ed7265a84a4
|
Provenance
The following attestation bundles were made for bayes_yplus-1.3.1.tar.gz:
Publisher:
publish.yml on tvwenger/bayes_yplus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bayes_yplus-1.3.1.tar.gz -
Subject digest:
788724fbc3205ef16b5a1186027edbab804deaede783b4004c47ec12da45651c - Sigstore transparency entry: 160819026
- Sigstore integration time:
-
Permalink:
tvwenger/bayes_yplus@b4f2b7d42e35b1a3ed126dedae788326083ca711 -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/tvwenger
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b4f2b7d42e35b1a3ed126dedae788326083ca711 -
Trigger Event:
release
-
Statement type:
File details
Details for the file bayes_yplus-1.3.1-py3-none-any.whl.
File metadata
- Download URL: bayes_yplus-1.3.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c4dc476b2efb90738f88c6c50a855b94c6ab403fd5d0559ec5fa727b230fb2f
|
|
| MD5 |
d070a849ab2873e7929a232f97443c30
|
|
| BLAKE2b-256 |
8c11862816041f46e24b97f3b231103e042d58387e99bf5776b554b577192132
|
Provenance
The following attestation bundles were made for bayes_yplus-1.3.1-py3-none-any.whl:
Publisher:
publish.yml on tvwenger/bayes_yplus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bayes_yplus-1.3.1-py3-none-any.whl -
Subject digest:
7c4dc476b2efb90738f88c6c50a855b94c6ab403fd5d0559ec5fa727b230fb2f - Sigstore transparency entry: 160819029
- Sigstore integration time:
-
Permalink:
tvwenger/bayes_yplus@b4f2b7d42e35b1a3ed126dedae788326083ca711 -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/tvwenger
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b4f2b7d42e35b1a3ed126dedae788326083ca711 -
Trigger Event:
release
-
Statement type: