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.5.tar.gz (133.9 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.5-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.5-cp312-cp312-macosx_11_0_arm64.whl (852.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

galapy_fit-0.5.5-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.5-cp311-cp311-macosx_11_0_arm64.whl (844.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

galapy_fit-0.5.5-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.5-cp310-cp310-macosx_11_0_arm64.whl (837.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

galapy_fit-0.5.5-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.5-cp39-cp39-macosx_11_0_arm64.whl (837.9 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

galapy_fit-0.5.5-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.5-cp38-cp38-macosx_11_0_arm64.whl (835.5 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

galapy_fit-0.5.5-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.5.tar.gz.

File metadata

  • Download URL: galapy_fit-0.5.5.tar.gz
  • Upload date:
  • Size: 133.9 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.5.tar.gz
Algorithm Hash digest
SHA256 2b549ec2d389570ce8e9fc64352b5e2012a838d57b920930759ea9581e4fb27e
MD5 c9c6faf2a7e9376e012e026c7438e681
BLAKE2b-256 4692a7867338b92c326cb466cafeb985f0266ee6bca9ea2edb49215a7498c53c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9bd1a3652bcd87133953db0953544a91bfffbb3d5762dbfc79e57b48c978391e
MD5 c0ef26f2ab27da873eb52089e112220e
BLAKE2b-256 1fb01bbed1f717c470715f863ed8adfeced066000794c57a7055ce645319fb68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c4c402c2ad1c89ae3d392b99a34eba195aeaa0ced81041ef5d60661a2bfcccc3
MD5 557eab864aa0d6da1cc2493dd071dfb3
BLAKE2b-256 94f981f41aac3bba7bef63a12742044ee3799be568b17423ba286beb271a4451

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2cbd6fb0f4870fa7ca62d38d87506f2d102e783ef982b2b8935f7b24bff934f
MD5 975720caae1b9c5057d05aa5b1cf4456
BLAKE2b-256 965ba15b40d6ef34b38dcc70255f17b81d6cef6d5a96505b25b41a634d774180

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 864b28c12034fcf83987dfa39f7c3f560dd5ab7eb6127064e931476853002248
MD5 8e93fa6fa1a83e743134c2d65e7a7128
BLAKE2b-256 269e3df1dd0cf02706ded4594cf95d4ab193231186c0e5bbc56edcfe7ff3281e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b726da00ddcd527be67e6b14f194bb4651adc3c44ebc33c99b554ab011b7138c
MD5 04acddfbf9c830adeff63c241b923471
BLAKE2b-256 1162c689e8b42e2fbe827e4fd42e9f3685756094e6163af44c5c2bb8f63a7dcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1d87bc5b335519aa8f9ec1ca4aa3f885f9a5eec65698becda3d5cf674f0fd9c
MD5 68941ae83a1f1fa3f9c8fc20dd069346
BLAKE2b-256 0e647a6bebd6c9b03b715bf90f6d3ce4be9aa4a654dd7d1c7da1b0709c401490

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31c09ddab9d50ba21463b5ec41bb099d939a6db76ee984d3371fc105b09a10e7
MD5 66555764d8a2b97b903cd4ad6a8fb77b
BLAKE2b-256 78f9d1e8f0da5cbb7a88ed9e32acc230fce3b6daba28ad3213bf644511b74e07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.5-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 00783e0714e395ab27a7a51ca975898bc2fac8dbbdfbbf8d2dedac2e5b382c29
MD5 818a9cbb0e5dcacdcc4531595beaacef
BLAKE2b-256 3602a72fe72a7617d5a654c6fefc6995c2b459e7bf31536fbab4cd24e0eb06ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5280233284abe1f5ea387841ff5ae0565beb2da698c6d24a785e76c528ac1b79
MD5 4c2fc39cbb9461737a4cfc46ea5487ae
BLAKE2b-256 8a8a38d407e890b3d6e4ac53ec7d4c7f4cd3003bc4ba4676f746572f4d888586

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.5-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6bc7406071576f01846fa409e5a6756a1d9b6185bfeeac02f5f95edd71391957
MD5 394bc2530d9e38abb2b7c5604da37a85
BLAKE2b-256 29f24462deebeb24d8eeb912c6a7ad599c6ab5c3f8def86f36f8a552b525a8f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5adc4c41ebfb5ba753e26dc819a1c0f5d957ee24a8165699aacbd1f8fbf3bd82
MD5 829f76da6f8a397466a33fa89aaae84b
BLAKE2b-256 ed11b3a4bcc840addac405dadccf907ad00f2b2f668d7b6e7678892468958369

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