halofactory


Namehalofactory JSON
Version 0.0.2 PyPI version JSON
download
home_page
SummarySemi-analytical dark matter halo generator for astrophysics
upload_time2023-08-18 17:37:35
maintainer
docs_urlNone
author
requires_python>=3.9
license
keywords
VCS
bugtrack_url
requirements pyhipp scipy numpy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # HaloFactory - Semi-analytical dark matter halo generators

[![Last commit](https://img.shields.io/github/last-commit/ChenYangyao/halofactory/master)](https://github.com/ChenYangyao/halofactory/commits/master)
[![Workflow Status](https://img.shields.io/github/actions/workflow/status/ChenYangyao/halofactory/python-package.yml)](https://github.com/ChenYangyao/halofactory/actions/workflows/python-package.yml)
[![MIT License](https://img.shields.io/badge/License-MIT-blue)](https://github.com/ChenYangyao/halofactory/blob/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/halofactory)](https://pypi.org/project/halofactory/)

In astrophysics, it is known that dark matter halos building blocks of the Universe's large-scale structures. 
Given their significance in theoretical and numerical studies of galaxy formation, 
it is imperative to generate halo catalogs not only following closely to 
structure formation theory but also being efficient in computation. 

This repository presents a comprehensive collection of semi-analytical methods 
that facilitate the generation of halo catalogs and their corresponding merger trees. 
These methods are either purely theoretical or calibrate by numerical simulations.
Building upon this repository, we intend to publish another repository dedicated 
to "semi-analytical galaxy formation models", which will utilize the 
halo-to-galaxy connection to populate halos with galaxies.

It is important to note that this package is currently in the process of being 
developed and is subject to structural modifications and functional expansions. 
The documentation is currently empty, and the testing does not encompass the 
entire source tree. We will continue to work towards completing these aspects.

Dependencies:
- Python>=3.9.
- [pyhipp](https://github.com/ChenYangyao/pyhipp)>=0.0.2, scipy, numpy.

To install `halofactory` and automatically handle the dependencies, use `PyPI`:
```bash
pip install halofactory
```

## Interesting Features

**Halo Density Profile**. HaloFactory predefines a set of density profiles for 
halos. For example, the following codes defines an NFW profile instance:
```py
>>> from halofactory.profile import NFWProfile
>>> profile = NFWProfile(mass = 1.0e2, rs = 10.0)
>>> profile

{'type': 'NFWProfile',
 '_meta': {'mass': 100.0, 'rin': 0.0001, 'xin': 1e-05, 'rvir': 150.0, ... },
 '_us': {'u_l': '3.085677581491367e+19 m', 'u_t': '3.085677581491367e+16 s',
         'u_m': '1.988409870698051e+40 kg', ...}}
```
The printed message includes the metainfo (mass, virial radius, etc.) of the halo, 
as well as the unit system in use.

To find information of the profile at given radii, for example, the density, write:
```py
>>> profile.rho([1., 2., 3.])

array([0.03583832, 0.01505707, 0.00855313])
```

To sample from the profile and thus create a set of particles used as input for 
N-body simulation, define a sampler such as the Eddington Inversion sampler:
```py
>>> from halofactory.initial_condition import EddInv
>>> sampler = EddInv(profile)
>>> sampler

{'type': 'EddInv',
 '_profile': {'type': 'NFWProfile', ...},
 '_rng': <pyhipp.stats.random.Rng object at 0x15092bc90>,
 '_meta': {'mass': 100.00000000000001, 'Et': 0.0, 'm_hi': 1.0, ...}}
```
The message indicates the method of the sampler, the input profile, the random 
number generator, and various of metadata.

To generate a sample, e.g., 1000 particles, write:
```py
>>> sample = sampler.get(1000)
>>> sample.pos, sample.vel, sample.mass

(array([[-27.04020173,  60.70242802,  -6.84922322], ...]),
 array([[  12.7955374 , -114.31584255,   30.89851955],...]),
 0.10000000000000002)
```
The returned `sample` instance contains positions, velocities and mass of the sampled 
particles.

**More is coming ...**

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "halofactory",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "Yangyao Chen <yangyaochen.astro@foxmail.com>, Kai Wang <wkcosmology@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/08/46/1d3b95b92ff1f1a2cc94246d7e500005ae673e4cfa8534b6d217b627ce91/halofactory-0.0.2.tar.gz",
    "platform": null,
    "description": "# HaloFactory - Semi-analytical dark matter halo generators\n\n[![Last commit](https://img.shields.io/github/last-commit/ChenYangyao/halofactory/master)](https://github.com/ChenYangyao/halofactory/commits/master)\n[![Workflow Status](https://img.shields.io/github/actions/workflow/status/ChenYangyao/halofactory/python-package.yml)](https://github.com/ChenYangyao/halofactory/actions/workflows/python-package.yml)\n[![MIT License](https://img.shields.io/badge/License-MIT-blue)](https://github.com/ChenYangyao/halofactory/blob/master/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/halofactory)](https://pypi.org/project/halofactory/)\n\nIn astrophysics, it is known that dark matter halos building blocks of the Universe's large-scale structures. \nGiven their significance in theoretical and numerical studies of galaxy formation, \nit is imperative to generate halo catalogs not only following closely to \nstructure formation theory but also being efficient in computation. \n\nThis repository presents a comprehensive collection of semi-analytical methods \nthat facilitate the generation of halo catalogs and their corresponding merger trees. \nThese methods are either purely theoretical or calibrate by numerical simulations.\nBuilding upon this repository, we intend to publish another repository dedicated \nto \"semi-analytical galaxy formation models\", which will utilize the \nhalo-to-galaxy connection to populate halos with galaxies.\n\nIt is important to note that this package is currently in the process of being \ndeveloped and is subject to structural modifications and functional expansions. \nThe documentation is currently empty, and the testing does not encompass the \nentire source tree. We will continue to work towards completing these aspects.\n\nDependencies:\n- Python>=3.9.\n- [pyhipp](https://github.com/ChenYangyao/pyhipp)>=0.0.2, scipy, numpy.\n\nTo install `halofactory` and automatically handle the dependencies, use `PyPI`:\n```bash\npip install halofactory\n```\n\n## Interesting Features\n\n**Halo Density Profile**. HaloFactory predefines a set of density profiles for \nhalos. For example, the following codes defines an NFW profile instance:\n```py\n>>> from halofactory.profile import NFWProfile\n>>> profile = NFWProfile(mass = 1.0e2, rs = 10.0)\n>>> profile\n\n{'type': 'NFWProfile',\n '_meta': {'mass': 100.0, 'rin': 0.0001, 'xin': 1e-05, 'rvir': 150.0, ... },\n '_us': {'u_l': '3.085677581491367e+19 m', 'u_t': '3.085677581491367e+16 s',\n         'u_m': '1.988409870698051e+40 kg', ...}}\n```\nThe printed message includes the metainfo (mass, virial radius, etc.) of the halo, \nas well as the unit system in use.\n\nTo find information of the profile at given radii, for example, the density, write:\n```py\n>>> profile.rho([1., 2., 3.])\n\narray([0.03583832, 0.01505707, 0.00855313])\n```\n\nTo sample from the profile and thus create a set of particles used as input for \nN-body simulation, define a sampler such as the Eddington Inversion sampler:\n```py\n>>> from halofactory.initial_condition import EddInv\n>>> sampler = EddInv(profile)\n>>> sampler\n\n{'type': 'EddInv',\n '_profile': {'type': 'NFWProfile', ...},\n '_rng': <pyhipp.stats.random.Rng object at 0x15092bc90>,\n '_meta': {'mass': 100.00000000000001, 'Et': 0.0, 'm_hi': 1.0, ...}}\n```\nThe message indicates the method of the sampler, the input profile, the random \nnumber generator, and various of metadata.\n\nTo generate a sample, e.g., 1000 particles, write:\n```py\n>>> sample = sampler.get(1000)\n>>> sample.pos, sample.vel, sample.mass\n\n(array([[-27.04020173,  60.70242802,  -6.84922322], ...]),\n array([[  12.7955374 , -114.31584255,   30.89851955],...]),\n 0.10000000000000002)\n```\nThe returned `sample` instance contains positions, velocities and mass of the sampled \nparticles.\n\n**More is coming ...**\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Semi-analytical dark matter halo generator for astrophysics",
    "version": "0.0.2",
    "project_urls": {
        "Repository": "https://github.com/ChenYangyao/halofactory.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a07be393459fd7488dadf4a7ef6044f218111d933957579a362a428880dd4764",
                "md5": "3d03f473cf6dc2edd470e6644233a253",
                "sha256": "d2b72a1e5fdc4ddf0ef7efe0f78782484608128cb1733cbda076302d50b7ccac"
            },
            "downloads": -1,
            "filename": "halofactory-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3d03f473cf6dc2edd470e6644233a253",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9776,
            "upload_time": "2023-08-18T17:37:33",
            "upload_time_iso_8601": "2023-08-18T17:37:33.146655Z",
            "url": "https://files.pythonhosted.org/packages/a0/7b/e393459fd7488dadf4a7ef6044f218111d933957579a362a428880dd4764/halofactory-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08461d3b95b92ff1f1a2cc94246d7e500005ae673e4cfa8534b6d217b627ce91",
                "md5": "5e95f8e35608c3b466515ac9fe5de618",
                "sha256": "d7d07c16acc72ff40079c5e1e5d568edd93e19093ad6db7111ff480c5dd96a89"
            },
            "downloads": -1,
            "filename": "halofactory-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "5e95f8e35608c3b466515ac9fe5de618",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 10933,
            "upload_time": "2023-08-18T17:37:35",
            "upload_time_iso_8601": "2023-08-18T17:37:35.665439Z",
            "url": "https://files.pythonhosted.org/packages/08/46/1d3b95b92ff1f1a2cc94246d7e500005ae673e4cfa8534b6d217b627ce91/halofactory-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-18 17:37:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ChenYangyao",
    "github_project": "halofactory",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pyhipp",
            "specs": [
                [
                    ">=",
                    "0.0.3"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        }
    ],
    "lcname": "halofactory"
}
        
Elapsed time: 0.19322s