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.

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 Gamma}(\alpha=2.0, \beta=1.0/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}(\alpha=3.0, \beta=2.0/p)$ 20.0
He_H_fwhm_ratio He/H FWHM line width ratio `` $\Delta V_{\rm He}/\Delta V_{\rm H} \sim {\rm Normal}(\mu=1.0, \sigma=p)$ 0.1
yplus He abundance by number `` $y^+ \sim {\rm Gamma}(\alpha=3.0, \beta=2.0/p)$ 0.1
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

ordered

An additional parameter to set_priors for these models is velocity. 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. This assumption can drastically improve sampling efficiency. 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 Trey Wenger

GNU General Public License v3 (GNU GPLv3)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

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.2.0.tar.gz (64.2 kB view details)

Uploaded Source

Built Distribution

bayes_yplus-1.2.0-py3-none-any.whl (31.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bayes_yplus-1.2.0.tar.gz
  • Upload date:
  • Size: 64.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for bayes_yplus-1.2.0.tar.gz
Algorithm Hash digest
SHA256 553e1a084714955fcb57d0597b2bdba2a540738faccc90a918c8be073310ef9b
MD5 db28f6019671927744b6b6d970c83edb
BLAKE2b-256 9e9d668547ed16cae98297f70ac24392b4d5e8f697d7fd452927842503ec2857

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bayes_yplus-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 31.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for bayes_yplus-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2d153618836d9c1aa9d06e13b16f941639be58b43734fc64d73cd5e54fd2b1a
MD5 91f11aa15d6fcc954224ad9401030483
BLAKE2b-256 dfa6dcbe1b716928f2d9ec3846ef38f8fcad1013f9cf9f07af741ce7722ed085

See more details on using hashes here.

Supported by

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