Skip to main content

GalaPy - Spectral modelling tool for galaxies in Python

Project description

Testing Status Building Documentation Status ArXiV preprint

GalaPy is an open source, extensible API for modelling and fitting the Spectral Energy Distribution (SED) of galaxies from the X-ray to the radio band, as well as the evolution of their components and dust attenuation/reradiation. It provides functions, classes and terminal commands for Bayesian inference of galaxy properties from panchromatic photometric data, as well as for the analysis and simulation of galaxies spectral properties.

If the image is not directly shown in the text, it can be found in the subdirectory `logo/GalaPy_Example.png`

GalaPy provides an easy-to-use Python user interface while the number-crunching is done with compiled, high-performance, object-oriented C++.

The library is currently optimized for fitting photometric datasets, nevertheless, its simulation capabilities are way more flexible than this, as it allows for the extraction of many other physical properties of galaxies, such as attenuation curves, matter content evolution histories (divided by component), metallicity evolution, star formation histories and more.

Galapy enables instantiating multi-component parameterized galaxy objects with a high level of customization. It produces SEDs in a matter of milliseconds on a single core with a minimal memory consumption. It has been developed with the aim of providing a fast SED simulator and, thus, to aid research in Galaxy Formation and Evolution, both from the perspective of observational Astrophysics and Cosmology (thanks to its Bayesian statistical framework) as well as from the perspective of theoretical and computational researchers interested in a modern modelling tool.

Free software

GPLv3 license

GitHub repository

https://github.com/TommasoRonconi/galapy

Python versions

>=3.7

Dependencies

setuptools, numpy, scipy, emcee, dynesty, nautilus-sampler, matplotlib, getdist, requests

TL;DR

Galaxies are extremely complex astrophysical objects resulting from the interaction of baryonic matter which has collapsed within a Dark Matter halo. Their formation and evolution strongly depend on the interplay of several factors, including their matter reservoir and accretion history, the environment they reside and the interactions with their neighbouring objects and, ultimately, the large scale structure of the Universe and the physics regulating it on cosmological scales. By studying the properties of individual galaxies, such as their luminosity, chemical composition, and star formation rate, we can learn about how galaxies form and evolve over time as well as the cosmological conditions that lead to their assembly.

The Spectral Energy Distribution (SED) of a galaxy describes the distribution of its light across different wavelengths, from gamma rays to radio waves, literally shedding light over the baryonic components and processes that contribute to the overall emission. Modelling this emission is one of the primary tools of extra-galactic astronomy to constrain models of galaxy formation and evolution, which are an essential part of our understanding of the Universe as a whole.

Install

The preferred method to install the package is through pip as it will install the most recent stable release:

$ pip install galapy-fit

for further details, please refer to the installation guide.

Fitting through terminal commands

Sampling the parameter space can be done from the command line in a terminal. The steps required for running the sampling are just two:

  1. first we will have to generate a parameter file, this can be done by running the utility command

    $ galapy-genparams [--name/-n NAME | --SFH_model/-sfh MODEL_NAME ]

    The generated file should be self-explanatory and has to be modified according to the fit the user has to perform. A detailed guide to the generation and modification of the parameter file can be found in param_file.

  2. Once the parameter file has been generated and properly modified, we can run

    $ galapy-fit parameter_file.py [--serial/-s | --multiprocessing/-mp NCPU]

    which will run the sampling and authomatically store the results, as specified by the user in the parameter file. NOTE THAT the two optional arguments regulate whether to run the sampling serially or using shared-memory parallelism. The default behaviour is to run parallely on all the available CPUs. More details are provided in photometric_fit.

Quick API hands-on

The GalaPy API allows to directly access methods and classes modelling the different components that contribute to the overall emission of a galaxy. By the interplay of these components the final Spectral Energy Distribution (SED) emerges and travels towards the observer.

In order to control the aforementioned interplay of components the module galapy.Galaxy implements classes of type GXY, from which the intrinsic luminosity and the flux at given distance can be retrieved. An object of type GXY is built as follows

import galapy as gp
gxy = gp.Galaxy.GXY( age = 1.e+9, redshift = 1.0 )

We have built a galaxy \(1 \text{Gyr}\) old at redshift \(z = 1\). We can always change the parameters of the galaxy we have built by calling the method

gxy.set_parameters( age = 5.e+9 )

For a complete list of the tunable parameters check the relative documentation page: Free parameters. To get the intrinsic emission from the galaxy and its flux as arriving at the observer we can call the following two functions

# Intrinsic luminosity:
L = gxy.get_emission()

# Flux:
F = gxy.SED()

Note that the function gxy.wl( obs = True/False ) returns the wavelength grid in the observer’s frame (obs = True) and at rest frame (obs = False).

If, instead of the full spectrum, we want just the flux integrated within some transmission bands, we will build a photometric galaxy object, and obtain the photo-SED

pgxy = gp.Galaxy.PhotoGXY( age = 5.e+9, redshift = 1.0 )
pgxy.build_photometric_system( 'filter1', 'filter2', 'filter3', ... )
pF = pgxy.photoSED()

Further details on the usage of functions and classes of the API are provided in the tutorials and in the API documentation.

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

galapy_fit-0.5.7.tar.gz (160.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

galapy_fit-0.5.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.7-cp313-cp313-macosx_11_0_arm64.whl (854.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

galapy_fit-0.5.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.7-cp312-cp312-macosx_11_0_arm64.whl (854.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

galapy_fit-0.5.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.7-cp311-cp311-macosx_11_0_arm64.whl (845.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

galapy_fit-0.5.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.7-cp310-cp310-macosx_11_0_arm64.whl (838.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

galapy_fit-0.5.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.7-cp39-cp39-macosx_11_0_arm64.whl (839.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

galapy_fit-0.5.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.7-cp38-cp38-macosx_11_0_arm64.whl (836.9 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

galapy_fit-0.5.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

Details for the file galapy_fit-0.5.7.tar.gz.

File metadata

  • Download URL: galapy_fit-0.5.7.tar.gz
  • Upload date:
  • Size: 160.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for galapy_fit-0.5.7.tar.gz
Algorithm Hash digest
SHA256 90cd28fa3385c99928d04a460ef0f2ba97e8671e2b788b7a3fb2b3a5b50d7fab
MD5 0cd807bab3706b3d8b42c8ab83ef23a1
BLAKE2b-256 7d2ae553303531d7517089356c3c296907b18aae3c86526550a40bc94341d2a7

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5b021cc618745c36fe6103a76608ac0c6d719536e7a74cb0b3de7261218c8528
MD5 611fdf30495f04195dd856df3ca4760d
BLAKE2b-256 8a182d78d13578e1efcd1315dc0b0f89ef84b3b1033799801bbc338ba6c43bb5

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a67c318ed1c7ac9dcdd6f09580e84e3bd46298c7edff9884f13bb0e06a23af3a
MD5 778fb372e7d6e63e001fb0fdc63906d8
BLAKE2b-256 daceffe0b12492956f08fd69815ec6fdf5df7647e1cf470939e50ecbff861284

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 224a4fb9f2fd3b311932a24bdefae4d5c2096000121b54c4b3f07e7236a95d60
MD5 66418535177a314775370edbb0022d2a
BLAKE2b-256 a3f12ff2263b69cfac84334d49f2fd00fa8e863c0d33ffa4d40b489faf6dc9d3

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f3a57fe98952a15e6f522fcbbf988d7a1b64e85a73370e57a0ade6da11563b6
MD5 025a731bc20ef07fc0ed9f3135f33157
BLAKE2b-256 14e3c33833ad697e561dadf7c2290eafc6d6a8b93156df82093f9c1860c71a5d

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6fb6bf1655cbe1d9131dedd2cc1471b78f23f865627d7f6b0442eb1d0b5fc122
MD5 cdb295be5f425b52e8aeec7dbc4d8e03
BLAKE2b-256 ceb3ec57ab21ec771ba08e9777c694418b55d56a6d420f6bdd7cf8c40cb18014

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48f4700c97e591304b1c9dfbe68c7789815689c03884ec549e91a6049c73cdaf
MD5 39544f615b110c6f8ec20e11d0fea139
BLAKE2b-256 c98c4893aa3ba818e53d6ce760935124d61f0138ee254e54db3b95170f0e85b5

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 64d3044cda6a744733af2dcff019c6b5a8cb71d8313c8108eac69e640ef92e73
MD5 929b35f73de5752c52ecdff85c950a21
BLAKE2b-256 f01e521bca0b7e551fd73ac46ecfdd093fe7a6d7932458cb1e8f36bc441c38cb

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9abef13ef0e323239af5297fd5db823ad9ca80b0b26d211156dcd9bcf2e0ff3a
MD5 58c84e902ce7b1db146372968b1a5c0b
BLAKE2b-256 3e47ab69535e6b12720a0fffe13ef6e17f5d4bd2757ac415a7e16d8dd8f5a7ec

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1e52b120a56a698ac92bdc731af0a972dce90eca8fd31a03625d01b806bd99f3
MD5 b0e8f69302fb69e055facf1c570a7b95
BLAKE2b-256 beb317cc14f9558580b7b6bf8d0238c1563d703e667d6380376cdfa870f2dc41

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 56e09bf4827bc0d10ed92cc433f601ac560f41f45f6eafa2b972d97ca4841411
MD5 d445590060ee623b8af05be8e0b554b5
BLAKE2b-256 aa362481d67ab6841a63ccafeec05cd10340e5ff0fca1799ed89467d01ecb215

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e20c9dce6b633b6b77228b79396fab704a8e2922e81d78dff732929cc9cdf289
MD5 ae93c5b39d5bbcbd184ebe21b601b4ea
BLAKE2b-256 1c3f0f305a50e67f69dc01f99de4775b8db653bd6fe639a3379dcbe7ce6ee545

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7132af89dc7dd05dd2bf319fe71490b677a0861be2c92f0077bc451ed2f3923b
MD5 36945aa4adb7bf6db1e3bd7ae626ad39
BLAKE2b-256 ce19bb77b214b256b278beed43e1c0712f0c34a1a4b7c164e9a1a66e226d9b91

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ac0dd8db7283a65bed409ea68cd02e4fa5441052022f6d3968dafacdc4201f4
MD5 603b1dbd705955d2c5d329d0d3b4e161
BLAKE2b-256 514cf2974d741d3008c943be7bfcd24fd72079da9b70b3c2a5158758987043f8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page