Skip to content

Commit

Permalink
version on pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetanfacchinetti committed Mar 5, 2024
1 parent 1f5087d commit 2ba906e
Show file tree
Hide file tree
Showing 9 changed files with 347 additions and 280 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# HYREC-2

[![Build Status](https://github.com/gaetanfacchinetti/HYREC-2/actions/workflows/python-package.yml/badge.svg?branch=main)](https://github.com/gaetanfacchinetti/HYREC-2/actions/workflows/python-package.yml?query=branch%3Amain)
[![Build Status](https://github.com/gaetanfacchinetti/HYREC-2/actions/workflows/python-package.yml/badge.svg?branch=master)](https://github.com/gaetanfacchinetti/HYREC-2/actions/workflows/python-package.yml?query=branch%3Amaster)

[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyhyrec)](https://pypi.org/project/pyhyrec/)
[![PyPi Version](https://img.shields.io/pypi/v/pyhyrec.svg)](https://pypi.python.org/pypi/pyhyrec/)
[![License: GPL v3](https://img.shields.io/badge/license-GPLv3-green.svg)](https://www.gnu.org/licenses/gpl-3.0)

[![Static Badge](https://img.shields.io/badge/physics-cosmology-darkblue)](https://en.wikipedia.org/wiki/Cosmology)
[![Static Badge](https://img.shields.io/badge/physics-recombination-yellow)](https://en.wikipedia.org/wiki/Recombination_(cosmology))



A code for primordial hydrogen and helium recombination including radiative transfer. An updated version of HyRec with new computing mode.
Expand All @@ -19,10 +27,19 @@ In this fork we have implement a lightweight python wrapper for HYREC-2 using cy

### Installation

The main option for clonning the repo is
* The easiest option for installation is to use
```
pip install hyrec
```

## How to run HYREC-2

An example of notebook using the python wrapper is given [here](https://github.com/gaetanfacchinetti/HYREC-2/blob/master/example.ipynb).




## Classical C version
## Using the classical C version

### Installation

Expand Down
2 changes: 1 addition & 1 deletion example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"metadata": {},
"outputs": [],
"source": [
"# create a cosmo params and injection params object\n",
"# create a cosmo params and injection params object with Primordial Black Holes\n",
"inj_pbh = pyhy.HyRecInjectionParams({'fpbh' : 1.0, 'Mpbh': 1e+3})\n",
"\n",
"z_pbh, xe_pbh, Tm_pbh = pyhy.call_run_hyrec(cosmo(), inj_pbh())"
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ requires-python = ">=3.6"
dev = []

[project.urls]
Homepage = "https://github.com/gaetanfacchinetti/HYREC-2"
Homepage = "https://github.com/nanoomlee/HYREC-2"
PythonVersion = "https://github.com/gaetanfacchinetti/HYREC-2"

[tool.pytest.ini_options]
minversion = "6.0"
Expand Down
26 changes: 22 additions & 4 deletions src/pyhyrec.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,8 @@ License: GNU GENERAL PUBLIC LICENSE
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

Project-URL: Homepage, https://github.com/gaetanfacchinetti/HYREC-2
Project-URL: Homepage, https://github.com/nanoomlee/HYREC-2
Project-URL: PythonVersion, https://github.com/gaetanfacchinetti/HYREC-2
Keywords: physics,cosmology,recombination
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python
Expand All @@ -695,7 +696,15 @@ Provides-Extra: dev

# HYREC-2

[![Build Status](https://github.com/gaetanfacchinetti/HYREC-2/actions/workflows/python-package.yml/badge.svg?branch=main)](https://github.com/gaetanfacchinetti/HYREC-2/actions/workflows/python-package.yml?query=branch%3Amain)
[![Build Status](https://github.com/gaetanfacchinetti/HYREC-2/actions/workflows/python-package.yml/badge.svg?branch=master)](https://github.com/gaetanfacchinetti/HYREC-2/actions/workflows/python-package.yml?query=branch%3Amaster)

[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyhyrec)](https://pypi.org/project/pyhyrec/)
[![PyPi Version](https://img.shields.io/pypi/v/pyhyrec.svg)](https://pypi.python.org/pypi/pyhyrec/)
[![License: GPL v3](https://img.shields.io/badge/license-GPLv3-green.svg)](https://www.gnu.org/licenses/gpl-3.0)

[![Static Badge](https://img.shields.io/badge/physics-cosmology-darkblue)](https://en.wikipedia.org/wiki/Cosmology)
[![Static Badge](https://img.shields.io/badge/physics-recombination-yellow)](https://en.wikipedia.org/wiki/Recombination_(cosmology))



A code for primordial hydrogen and helium recombination including radiative transfer. An updated version of HyRec with new computing mode.
Expand All @@ -714,10 +723,19 @@ In this fork we have implement a lightweight python wrapper for HYREC-2 using cy

### Installation

The main option for clonning the repo is
* The easiest option for installation is to use
```
pip install hyrec
```

## How to run HYREC-2

An example of notebook using the python wrapper is given [here](https://github.com/gaetanfacchinetti/HYREC-2/blob/master/example.ipynb).




## Classical C version
## Using the classical C version

### Installation

Expand Down
1 change: 1 addition & 0 deletions src/pyhyrec.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ README.md
pyproject.toml
setup.py
./src/pyhyrec/wrapperhyrec.c
src/pyhyrec/.DS_Store
src/pyhyrec/__init__.py
src/pyhyrec/__main__.py
src/pyhyrec/params.py
Expand Down
Binary file added src/pyhyrec/.DS_Store
Binary file not shown.
32 changes: 32 additions & 0 deletions src/pyhyrec/src/energy_injection.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,38 @@ double dEdtdV_DM_ann(double z, INJ_PARAMS *params){

}


/***************************************************************************************
Effect of primordial magnetic fields
According to Chluba et al. 2015
***************************************************************************************/

// Energy injection rate due to turbulences
// H must be in 1/s for a result in eV / cm^3 / s
double gamma_turbulences(double z, double H, double B0, double nB)
{
double zi = 1088;

if (z > zi)
return 0;

double m = 2.0*(nB+3.0)/(nB + 5.0);
double kd = 286.91 * B0;
double titd = 14.8 / B0 / kd;
double rhoB = 9.5e-8 * square(B0) * 0.26 * pow(1+z, 4);

return 3.0*m/2.0 * pow(log(1+titd), m)/pow(log(1+titd) + 1.5 * log((1+zi)/(1+z)), m+1) * H * rhoB;
}


// Energy injection rate due to ambipolar diffusion
double gamma_ambipolar(double z, double xp, double B0, double nB)
{
return 0.0;
}



/***************************************************************************************
Effect of accreting primordial black holes
Since the accuracy is certainly not at the percent level,
Expand Down
Loading

0 comments on commit 2ba906e

Please sign in to comment.