Skip to main content

No project description provided

Project description

Template PyPI Read the Docs Tests Status Coverage Status

A package to count galaxy pairs at light speed and estimate 2-point correlation functions of large galaxy samples or mock catalogs, that works with angular, projected and redshift-space coordinates. Its main features are:

  • Speed
    By calling Fortran routines that implement efficient skip-list/linked-list algorithms, it can be extremely fast
  • Parallel
    Employs the OpenMP framework to make use of multi-core CPUs
  • User-defined Weights and Error Estimates
    Accepts weighted pair counts defined by the user and can also estimate statistical boostrap errors with minimal overhead
  • User-friendly and Flexible
    By carefully wrapping Fortran code in a suitable Python framework, it is very easy to use and extend its functionality by both novice and seasoned users
  • Bonus Track
    Lots of auxiliary and plotting functions to produce nice, paper-ready plots for 1D/2D correlations, complete with ratios, labels and even power-law fits

Getting Started

Input data consists of astropy tables (see Astropy Tables), which provides an excellent I/O framework for a variety of formats (ASCII, VOTable, FITS tables, etc.)

Gundam also employs special dictionaries (see Munch) to pack multiple parameters or output fields at once. Such dictionaries have attribute-like access with dot notation. If you are used to ipython's dot+tab completion you will love this.

A typical usage workflow consists of:

  1. Read data into astropy tables, usually one table for the "data" sample and another one for the "random" sample.
  2. Create and customize a dictionary for input parameters (e.g. to set binning, cosmology, estimator, etc.)
  3. Calculate the statistic (correlation function or simply the pair counts for a given geometry)
import gundam as gun
from astropy.table import Table

gals = Table.read('red_gals.fits')   # Read data
rans = Table.read('red_rans.fits')   # Read randoms
gals['wei'] = 1.                     # If there are no weights, just fill with 1's
rans['wei'] = 1.                     # If there are no weights, just fill with 1's

par = gun.packpars(kind='pcf')       # Get defaults for a proj. corr. function (pcf)
par.h0      = 69.5                   # Change H0
par.nsepp   = 24                     # Set 24 bins in projected separation
par.dsepp   = 0.1                    # Each of size 0.1 dex
par.estimator = 'LS'                 # Pick Landy-Szalay estimator 

c = gun.pcf(gals, rans, par, nthreads=4)   # Estimate pcf using 4 threads

c.qprint()                           # Quickly check the output fields (dd, rr, etc.)
gun.cnttable(c)                      # Or show counts in your browser
gun.cntplot(c)                       # Or plot the pcf

For further information please read-the-docs here. There is a very decent introduction so you can start using Gundam within 5 minutes, and of course the full API.

Example Runs

Data and code for 3 examples demonstrating typical use cases are provided in the repo (example_lrg.py, example_pcf.py and example_redblue.py). For the moment these are couple plots to illustrate what can be done with Gundam in just a few lines of code

   

Prerequisites

You will need to have these:

Installing

To install Gundam, you have two choices: (1) use pip, or (2) build from scratch. Method (1) is useful if you simply want to use gundam. Method (2) on the other hand allows easy access to modify or extend the Fortran counting routines.

To install via pip execute:

pip install gundam

If you want to contribute to the package, you need to clone the Gundam repository and install with the "dev" optional dependencies.

git clone https://github.com/lincc-frameworks-mask-incubator/gundam.git
cd gundam
pip install -e .'[dev]'
pre-commit install

By default, this will compile and build the library in-place. Feel free to modify the CMakeLists file to suit your needs.

Contributing

Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

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

gundam-0.0.2.tar.gz (25.5 MB view details)

Uploaded Source

Built Distributions

gundam-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

gundam-0.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (700.1 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

gundam-0.0.2-cp39-cp39-macosx_14_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.9 macOS 14.0+ ARM64

gundam-0.0.2-cp39-cp39-macosx_12_0_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9 macOS 12.0+ x86-64

File details

Details for the file gundam-0.0.2.tar.gz.

File metadata

  • Download URL: gundam-0.0.2.tar.gz
  • Upload date:
  • Size: 25.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for gundam-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ce11bf9c7ad329c8e35c2739d175f4cff8c956d440ab5de46ea8721ac5fa5c77
MD5 206c99f39b3d5ceaacda44dcd87bc16e
BLAKE2b-256 730a924b617b2acc0d1c2d41f1ea3c5e2437069376b4eda71552f1c3798bc84a

See more details on using hashes here.

File details

Details for the file gundam-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gundam-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e0da1695686a6fb09ef2435138304452277abaaa2c8859c990db8c28fb444d7c
MD5 30f536c1fe3f6ddb8198f5bba269f72d
BLAKE2b-256 575b5e0914fa9e475d098d92da66e24680f4bce9bcdbb46b1e9737062b7633ef

See more details on using hashes here.

File details

Details for the file gundam-0.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for gundam-0.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d7a2361cf30113d40010012145886ad871e67350e7bb86ada380f0d7987a63ea
MD5 d3530c10f4bc9af7a4397da40e267937
BLAKE2b-256 733fa5c34c121f5db85dabb519ff06592b9432ab33c25ca4fe788032dd65b492

See more details on using hashes here.

File details

Details for the file gundam-0.0.2-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for gundam-0.0.2-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 730a8e532698d6631129650ec461b4c850ef1f97f31139b92390954464f16418
MD5 945a07e4e0b20228758dc80ed53d836a
BLAKE2b-256 1400385b9cfa9b773402f4cf5ea89b9fb2f1328acd67c910e813e51d14038700

See more details on using hashes here.

File details

Details for the file gundam-0.0.2-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for gundam-0.0.2-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 657ef4b88733e65d3a61c3b3bbf7eec2143f33ed7f11064a3bf3400c92e91586
MD5 65d6a662c053ecbbfb7dbb1292a6b2ae
BLAKE2b-256 517c61f5078416186275f8f4b6fb1f1abb687ac401eaf73954949f1d80c6c7c4

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