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, 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.6.tar.gz (134.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.6-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.6-cp312-cp312-macosx_11_0_arm64.whl (853.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

galapy_fit-0.5.6-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.6-cp311-cp311-macosx_11_0_arm64.whl (845.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

galapy_fit-0.5.6-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.6-cp310-cp310-macosx_11_0_arm64.whl (837.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

galapy_fit-0.5.6-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.6-cp39-cp39-macosx_11_0_arm64.whl (838.7 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

galapy_fit-0.5.6-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.6-cp38-cp38-macosx_11_0_arm64.whl (836.4 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

galapy_fit-0.5.6-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.6.tar.gz.

File metadata

  • Download URL: galapy_fit-0.5.6.tar.gz
  • Upload date:
  • Size: 134.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.6.tar.gz
Algorithm Hash digest
SHA256 f06a20a7fd834b5b3c928c2c14335f701cfc2c4341e6bb3c39d660f7fb280a01
MD5 ca6d2c582dcc08a6a27d19e02139b0ad
BLAKE2b-256 04007c31e48aa38d3d239db86077c60f1daa3f584ecd939da52079b6d3081218

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 380a7e1058dfc8d316c31e6e5792c9c90bcb8d7ed3795aedd6bf15681462663e
MD5 7e8301e2448ea7b536d9888e18c9d181
BLAKE2b-256 361ba2c7f978e3936f097fe78ecd01683e39bf619769b5fab2d8688fd6ae8842

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7cd5c21c4a1ad297cc3650009ab8054a36e982df4afebe7579dd621689f015d7
MD5 08d6d2c008a39d167c14c711448590a5
BLAKE2b-256 14cb2d94d8be9f43458b51ca745065632c3ebb6ba97b8d476ebeda9da245ba61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 001d7106d683b80715c55726698f46a6d818d1569b78bb734a5637637b4e8e87
MD5 28b991e4ac95bc512b3f0b3c9ff72746
BLAKE2b-256 18612b1ce5f81f4b7ff1e26704f0269bc1a35871c443c3524866362317bf914c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 20b0d3b20063bbf035359e0d5beb46d4c4c15b82383a9c0bb1e39689b7c28294
MD5 1d260f7b6341737fa045dddf0882be26
BLAKE2b-256 7adf4a79b6a0eb27e8952687ebfbbabf6b1881876facf40672df7f52f9ebfa85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1f9de10871249ed1bc4b56532e83ccc5c30041681e5317f6231546b930b84e8f
MD5 a16bd121d2ff7ffb55cb3fb1affef842
BLAKE2b-256 5475cba34acdde61bb7b03fc2966945afa156c683846ccfbad740be710055536

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b6f9e7a51e00831e21d4bc9b91508da852a6970eb18925b85b65840a81a6764d
MD5 329bb12e6a285a1fd931c3e2ada613c2
BLAKE2b-256 8c7c67b581fcebfde0e6ae6d75d97fff7df98db8546141cbf8347c9ad490065d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d4db3773f6869f1aad61cd1c3510ee0ee5d016942667bcc0ce28f51be5e55082
MD5 aaceb684adae5639002264a73ecb4f73
BLAKE2b-256 ca79f3666b8bd3a1231e6c8723ee856158c03d521393f49f599a4ef2f6d59b9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.6-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a6cfb82c6fb132a19665aa98bfd2abb74b79b90dd7b86c45c0f3cee1b72f817
MD5 c34abba7cd65cd2c287fb8dab9e5c22e
BLAKE2b-256 53274bf77abf3d3b8c764affa3973bddb985b1a775cda81f331b8c19d215f997

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1af35be82afd44943c80bf31c29015e5f0d2f4264066d81f7165b8a1a8d8d0b
MD5 eae4493c663b60d794a8469d2f0ea39f
BLAKE2b-256 c84f6b981ffc2bdb05a5539376f0ae7ab77cc2180de609fb313764b3828ad3d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.6-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 df6b5efa6e86f8ec2862f70237843b2cc9a7efbe69b4fbd32d0f28e00f159ded
MD5 b5b27b0bef2f64a02aa9e6fb0ee1afe5
BLAKE2b-256 6e80a05b4686c41e9967adc5a7ae22ce5ebf55d626215c47c36dfc1f0a17013f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5894a2197e1dd3d9b774542289f73c8a9189f4e86d9fe7fe81d7eaac1092b6e6
MD5 549d2a199838db4be3116c64af2a1ddd
BLAKE2b-256 5c31eccdebe973cf2c3bbd8218040ce2fd84a2e871f479a90b75d69d30b79bbd

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