Skip to main content

hih2

Atomic-to-molecular hydrogen transition models for astrophysical simulations.

To install:

cd ~

git clone https://github.com/avapolzin/hih2.git

cd hih2

pip install .

or

pip install hih2

Included models are:

Volumetric models are in hih2.vol and projected models are in hih2.proj. All syntax is the same between those modules. It's very simple, so the docstrings are largely sufficient and limited documentation follows here:

All models take as arguments nh (hydrogen number density if hih2.vol -- cm-3 by default -- or hydrogen column density if hih2.proj -- cm-2 by default) and met (solar-scaled metallicity). gk11(), k13(), s14(), and p24() require uv (UV field strength). hih2.proj.gd14() and p24() also require an scale argument, which is the size of the grid cells (by default in pc). hih2.vol.gd14(), kmt09b, k13, and s14 also take a scale argument, which follows the convention of hih2.proj.

Both k13() and s14() functions also take a clumping factor argument, fc, and k13() additionally takes rho_sd (density of stars and dark matter, by default in M☉ pc-3), iterate (toggles whether values are computed iteratively), and niter (if iterate = True, sets number of interations).

All functions take dens_unit, which takes astropy.units objects to set the units in which nh is reported. k13() has an equivalent for rho_sd called sddens_unit. All of the functions that require scale take a scale_unit argument.

Each function returns the molecular hydrogen fraction (defined as H2/(HI + H2)) for the input gas density, metallicity, and UV field strength. The implicit assumption of these models is that all gas is neutral and that any ionized component is negligible.

Required arguments are summarized in the tables below.

Why is this a package? Good question. It's very easy to implement these HI-H2 models yourself either from the literature or from code examples (see compare_models.py for functions on their own), but some people may prefer a quick install/import. See the Appendix in Polzin et al. (2024a) for details of how the models included here are implemented.

Summary of required and optional parameters in models included in hih2.vol

Model nH metallicity UV field scale fc ρSD
kmt09b ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$
gk11 ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$
k13 ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$ $\color{yellow}{\textit{Default = 1}}$ $\color{yellow}{\textit{Default = 0.01}}$
s14 ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$ $\color{yellow}{\textit{Default = 1}}$
gd14 ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$
p24 ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$

Summary of required and optional parameters in models included in hih2.proj

Model NH metallicity UV field scale fc ρSD
kmt09b ${\color{red}Required}$ ${\color{red}Required}$
gk11 ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$
k13 ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$ $\color{yellow}{\textit{Default = 1}}$ $\color{yellow}{\textit{Default = 0.01}}$
s14 ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$ $\color{yellow}{\textit{Default = 1}}$
gd14 ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$
p24 ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$ ${\color{red}Required}$

How can I access the models in a simple script? Just like hih2, compare_models.py includes functions for each of the models on a cell-by-cell basis and projected on different scales; models are stored for use in Python.

I will add C/C++ code in the near future. As always, the idea is for these functions to be easily callable. One can always refer to the original papers to examine the details of the different HI-H2 models.

Do you want to see a model added? Feel free to open a PR including a new model or open an issue requesting one. In each case, please include a link to the paper in which the model is published.

Metadata

Release files for hih2 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hih2 1.0
File Size Uploaded
hih2-1.0.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hih2 1.0
File Interpreter ABI Platform
hih2-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / hih2-1.0.tar.gz

Download URL hih2-1.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b99373dc5080f4adbfa5efbb0ca5cf70fad1c72c6a71b64e5e899c3165308ab1
BLAKE2b-256 checksum
How to use checksums
74f4e4e33a6829fdb5d0369a9f0a7b8677cee51b1ac526252703f8cc36923648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.12

Release files / hih2-1.0-py3-none-any.whl

Download URL hih2-1.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69364c1aa77754ed1b14ec8220ad19b9c1f51b053b6672cd26c9efe8ba7a1508
BLAKE2b-256 checksum
How to use checksums
2573fad5d4e55352f3fc48e88f9951fe0daf6e5f7de38384aaf4eda98cdae93d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.12

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page