Halotools

Halotools: A New Release Adding Intrinsic Alignments to Halo-Based Methods - Published in JOSS (2025)

https://github.com/nvanalfen/halotools

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
    17 of 53 committers (32.1%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords from Contributors

astronomy mcmc astropy sunpy mcmc-sampler probabilistic-data-analysis sun physics solar-physics solar

Scientific Fields

Mathematics Computer Science - 34% confidence
Last synced: 6 months ago · JSON representation

Repository

Python package for studying large scale structure, cosmology, and galaxy evolution using N-body simulations and halo models

Basic Info
  • Host: GitHub
  • Owner: nvanalfen
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: master
  • Homepage: http://halotools.rtfd.org
  • Size: 12.9 MB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • Open Issues: 1
  • Releases: 1
Fork of astropy/halotools
Created about 3 years ago · Last pushed 12 months ago
Metadata Files
Readme Changelog License

README.rst

=========
Halotools
=========

Halotools is a specialized python package for building and testing models of the galaxy-halo connection, and analyzing catalogs of dark matter halos.
The core feature of Halotools is a modular platform for creating mock universes of galaxies starting from a catalog of dark matter halos obtained from a cosmological simulation. Functionality of the package includes:

* Fast generation of synthetic galaxy populations using HODs, abundance matching, and related methods
* Efficient algorithms for calculating galaxy clustering, lensing, z-space distortions, and other astronomical statistics
* A modular, object-oriented framework for designing your own galaxy evolution model
* End-to-end support for downloading publicly-available halo catalogs and reducing them to fast-loading hdf5 files

The code is publicly available at https://github.com/astropy/halotools.

Installation
-------------
The simplest and most reliable way to install the latest release of the code is with conda-forge::

    conda install -c conda-forge halotools

Pip installation is not recommended because the conda-forge dependency solver is much more robust.
However, users who prefer pip can install via::

    		pip install halotools

You can find detailed installation instructions `halotools.readthedocs.io `_.

After installing the package, you should navigate to the *Quickstart Guides and Tutorials*
section and follow the *Getting started with Halotools* 10-minute tutorial.
This will get you set up with the default halo catalog so that you can quickly get started with creating mock galaxy populations.

Documentation
-------------
The latest build of the documentation can be found at http://halotools.readthedocs.io. The documentation includes installation instructions, quickstart guides and step-by-step tutorials. The *Basic features* section below gives an overview of the primary functionality of the package.


Basic features
--------------
Once you have installed the code and downloaded the default halo catalog (see the Getting Started guide in the documentation), you can use Halotools models to populate mock galaxy populations.

.. code-block:: python

    # Select a model
    from halotools.empirical_models import PrebuiltHodModelFactory
    model = PrebuiltHodModelFactory('zheng07')

    # Select a halo catalog
    from halotools.sim_manager import CachedHaloCatalog
    halocat = CachedHaloCatalog(simname='bolshoi', redshift=0, halo_finder='rockstar')

    # populate the catalog with the model
    model.populate_mock(halocat)

After calling *populate_mock*, your model will have a *mock* attribute storing your synthetic galaxy population. All Halotools models have a *populate_mock* method that works in this way, regardless of the features of the model. There are no restrictions on the simulation or halo-finder with which you can use the populate_mock method.

Creating alternate mocks
------------------------

All Halotools models have a **param_dict** that controls the behavior of the model. By changing the parameters in this dictionary, you can create alternative versions of your mock universe by re-populating the halo catalog as follows.

.. code-block:: python

    model.param_dict['logMmin'] = 12.1
    model.mock.populate()

Note how much faster the call to **mock.populate** is relative to **model.populate_mock(halocat)**. This is due to a large amount of one-time-only pre-processing that is carried out upon creation of the first mock universe. The process of varying *param_dict* values and repeatedly calling *model.mock.populate()* is part of a typical workflow in an MCMC-type analysis conducted with Halotools.


Modeling the galaxy-halo connection
-----------------------------------

The pre-built model factories give you a wide range of models to choose from, each based on an existing publication. Alternatively, you can use the Halotools factories to design a customized model of your own creation, such as models for stellar mass, color, size, morphology, or any property of your choosing. The modular design of the **empirical_models** sub-package allows you to mix-and-match an arbitrary number or kind of features to create your own composite model of the full galaxy population. You can choose from component models provided by Halotools, components exclusively written by you, or anywhere in between. Whatever science features you choose, any Halotools model can populate any Halotools-formatted halo catalog with the same syntax shown above.

Making mock observations
------------------------

The **mock_observables** sub-package contains a wide variety of optimized functions that you can use to study your mock galaxy population. For example, you can calculate projected clustering via the **wp** function, identify friends-of-friends groups with **FoFGroups**, or compute galaxy-galaxy lensing with **mean_delta_sigma**.

.. code-block:: python

    from halotools.mock_observables import wp
    from halotools.mock_observables import FoFGroups
    from halotools.mock_observables import mean_delta_sigma


There are many other functions provided by the **mock_observables** package, such as RSD multipoles, pairwise velocities, generalized marked correlation functions, customizable isolation criteria, void statistics, and more.

Managing simulation data
------------------------

Halotools provides end-to-end support for downloading simulation data, reducing it to a fast-loading hdf5 file with metadata to help with the bookkeeping, and creating a persistent memory of where your data is stored on disk. This functionality is handled by the **sim_manager** sub-package:

.. code-block:: python

    from halotools import sim_manager

The **sim_manager** package comes with a memory-efficient **TabularAsciiReader** designed to handle the very large file sizes that are typical of contemporary cosmological simulations. There are 20 halo catalogs available for download from the Halotools website using the **download_additional_halocat script.py**, including simulations run with different volumes, resolutions and cosmologies, and also catalogs identified using different halo-finders and at different redshift. Any simulation you store in cache can be loaded into memory in the same way, and all such catalogs have a **halo_table** attribute storing the actual data.

.. code-block:: python

    from halotools.sim_manager import CachedHaloCatalog
    halocat = CachedHaloCatalog(simname=any_simname, redshift=any_redshift, halo_finder=any_halo_finder)
    print(halocat.halo_table[0:10])

You are not limited to use the halo catalogs pre-processed by Halotools. The **UserSuppliedHaloCatalog** allows you to use your own simulation data and transform it into a Halotools-formatted catalog in a simple way.

.. code-block:: python

    from halotools.sim_manager import UserSuppliedHaloCatalog

Although the **sim_manager** provides an object-oriented framework for creating a persistent memory of where you store your halo catalogs, your cache is stored in a simple, human-readable ASCII log in the following location:

**$HOME/.astropy/cache/halotools/halo_table_cache_log.txt**


Project status
--------------

Halotools is a fully open-source package with contributing scientists spread across many universities. The latest stable release of the package, v0.9, is now available on pip and conda-forge. You can also install the development version of the package by cloning the master branch on GitHub and locally building the source code, as described in the installation instructions.


## Asking questions and staying up-to-date

You can contact Andrew Hearin directly by email at ahearin-at-anl-dot-gov, or by tagging @aphearin on GitHub.


Citing Halotools
----------------
If you use Halotools modules to support your science publication, please cite `Hearin et al. (2017) `_, ideally taking note of the version of the code you used, e.g., v0.8::

    @ARTICLE{halotools,
           author = {{Hearin}, Andrew P. and {Campbell}, Duncan and {Tollerud}, Erik and {Behroozi}, Peter and {Diemer}, Benedikt and {Goldbaum}, Nathan J. and {Jennings}, Elise and {Leauthaud}, Alexie and {Mao}, Yao-Yuan and {More}, Surhud and {Parejko}, John and {Sinha}, Manodeep and {Sip{\"o}cz}, Brigitta and {Zentner}, Andrew},
            title = "{Forward Modeling of Large-scale Structure: An Open-source Approach with Halotools}",
          journal = {The Astronomical Journal},
         keywords = {cosmology: theory, galaxies: halos, galaxies: statistics, large-scale structure of universe, Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Cosmology and Nongalactic Astrophysics, Astrophysics - Astrophysics of Galaxies},
             year = 2017,
            month = nov,
           volume = {154},
           number = {5},
              eid = {190},
            pages = {190},
              doi = {10.3847/1538-3881/aa859f},
    archivePrefix = {arXiv},
           eprint = {1606.04106},
     primaryClass = {astro-ph.IM},
           adsurl = {https://ui.adsabs.harvard.edu/abs/2017AJ....154..190H},
          adsnote = {Provided by the SAO/NASA Astrophysics Data System}
    }

License
-------

Halotools is licensed by Argonne National Lab under a 3-clause BSD style license - see the licenses/LICENSE.rst file.

Owner

  • Name: Nick Van Alfen
  • Login: nvanalfen
  • Kind: user

PhD Student in Physics at Northeastern University

JOSS Publication

Halotools: A New Release Adding Intrinsic Alignments to Halo-Based Methods
Published
March 11, 2025
Volume 10, Issue 107, Page 7421
Authors
Nicholas Van Alfen ORCID
Department of Physics, Northeastern University, Boston, MA 02115, USA
Duncan Campbell ORCID
McWilliams Center for Cosmology, Department of Physics, Carnegie Mellon University, Pittsburgh, PA 15213, USA
Andrew Hearin ORCID
Argonne National Laboratory, Lemont, IL 60439, USA
Jonathan Blazek ORCID
Department of Physics, Northeastern University, Boston, MA 02115, USA
Editor
Ivelina Momcheva ORCID
Tags
cosmology weak gravitational lensing intrinsic alignments

GitHub Events

Total
  • Issues event: 1
  • Issue comment event: 10
  • Push event: 14
  • Pull request event: 6
  • Fork event: 1
  • Create event: 1
Last Year
  • Issues event: 1
  • Issue comment event: 10
  • Push event: 14
  • Pull request event: 6
  • Fork event: 1
  • Create event: 1

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 4,783
  • Total Committers: 53
  • Avg Commits per committer: 90.245
  • Development Distribution Score (DDS): 0.243
Past Year
  • Commits: 70
  • Committers: 7
  • Avg Commits per committer: 10.0
  • Development Distribution Score (DDS): 0.3
Top Committers
Name Email Commits
Andrew Hearin a****n@y****u 3,619
Duncan Campbell d****l@g****m 384
Andrew Hearin a****n@a****v 301
Erik Tollerud e****d@g****m 72
Brigitta Sipocz b****z@g****m 50
Christopher Bradshaw c****b@g****m 47
Nick Van Alfen n****2@g****m 43
Thomas Robitaille t****e@g****m 42
Duncan Campbell d****l@y****u 18
Duncan Campbell d****n@d****l 14
Michael Droettboom m****m@g****m 14
Andrew Zentner z****r@p****u 13
Johannes Lange j****e@y****u 12
Sean McLaughlin m****4@g****m 12
P. L. Lim 2****m 11
Erik M. Bray e****y@s****u 10
Duncan Campbell d****n@m****u 8
Duncan Campbell d****n@d****n 7
Duncan Campbell d****n@d****e 7
EiffL f****l@g****m 7
Yu Feng r****n@g****m 7
dependabot[bot] 4****] 7
Matthew Craig m****g@g****m 6
Alan Pearl a****3@g****m 6
Larry Bradley l****y@g****m 5
Yao-Yuan Mao y****o@g****m 5
Duncan Campbell d****c@a****u 5
Kyle Barbary k****y@g****m 4
Surhud More s****e@i****p 4
Benedikt Diemer b****r@o****u 3
and 23 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1
  • Total pull requests: 11
  • Average time to close issues: N/A
  • Average time to close pull requests: about 12 hours
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 11.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 days
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 11.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • cmlamman (1)
Pull Request Authors
  • nvanalfen (7)
  • warrickball (6)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/ci_tests.yaml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • actions/setup-python 42375524e23c412d93fb67b49958b491fce71c38 composite
.github/workflows/cron_tests.yaml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • actions/setup-python 42375524e23c412d93fb67b49958b491fce71c38 composite
.github/workflows/wheels.yaml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • actions/setup-python 42375524e23c412d93fb67b49958b491fce71c38 composite
  • actions/upload-artifact 4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 composite
pyproject.toml pypi
requirements.txt pypi
  • astropy *
  • beautifulsoup4 *
  • cython *
  • h5py *
  • numpy *
  • requests *
  • scipy *
  • setuptools *
setup.py pypi