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.3.tar.gz (133.5 kB view details)

Uploaded Source

Built Distributions

galapy_fit-0.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.3-cp312-cp312-macosx_10_9_x86_64.whl (764.0 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

galapy_fit-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.3-cp311-cp311-macosx_10_9_x86_64.whl (777.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

galapy_fit-0.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.3-cp310-cp310-macosx_10_9_x86_64.whl (767.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

galapy_fit-0.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.3-cp39-cp39-macosx_10_9_x86_64.whl (768.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

galapy_fit-0.5.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.3-cp38-cp38-macosx_10_9_x86_64.whl (766.8 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

galapy_fit-0.5.3-cp37-cp37m-macosx_10_9_x86_64.whl (762.0 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for galapy_fit-0.5.3.tar.gz
Algorithm Hash digest
SHA256 bb37d907551581ec6f7b24e4b6f97070262cc68dcdc688b8e9e92095e615ea43
MD5 f9fed00f6d440e03a84ca96a3bc6fb27
BLAKE2b-256 fff8edc9011869bc4e81ebaee20554af1ab3ee75d31190b478d39368584a06fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 338e4557d48dbb13000c8465f4e386b70c9362f03e3937ebcb5c3f346df963eb
MD5 16d40b58b299d919176bb1a5aab1e932
BLAKE2b-256 63d52407e08077d1f9a642509ce36c9c173d3189d0391b9d3582c55f88dffa59

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.3-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8b01d0db2e02d48a97878df887f9a17ea03c3dfb3bdd56ee73b5dd7677c3cc30
MD5 0d551eb6bbfe156a7f9042003b07d431
BLAKE2b-256 0c91f86a355daff631b633d741f5ff64a82591c56b789dd10b778f49f57dd392

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1c358ceca2d3a9cfc816bd6ff74cf6e67cd827d0671bc195b5c645a1575550ad
MD5 98b0270d0f16b7b0ef6a219fb2b3f5d7
BLAKE2b-256 ddd8a1ffc0bac9adf3878755d94b2bc625701a0f9f73bbcf59f942bcdbda31a2

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.3-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dcaf61670e7c0f5c913cb4f6369371f9bb04447125bd35f5513de6b54d2eef55
MD5 26218a5fced42b089d9ff72ac752890e
BLAKE2b-256 ea2e4b6d2ffbaaf3db060f40ac5eb1ded6ea4f8965e05ee361c155f61f09b452

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c786267ea064ce387210eb4d23dd909f13cacd36657a2055bb1c7aff758ff714
MD5 80a139f29218cc2713b51cded874192d
BLAKE2b-256 c5169199269882e32dc72dcd9c9d6c945e177fa098495cfcc8fd00a3a4d7fe9a

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.3-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 de116b4022484518cd940693bc8101b42b8f43a9a626c03e4bcfc2360d7e3cb9
MD5 1473389fba7aae80110f12bfefc13bd3
BLAKE2b-256 fc74572405951952c4595ccc6d74bf79c517a2ac4c853d71503940fcceb732fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 901256b242b80ddf493a0281d58bbcdb436df2d373be11932b5dea9802655d97
MD5 17350c58eb5ef875c70dd1f033b0ea02
BLAKE2b-256 11f562149f062b82307fc12cd6933cd0f5ed592967888f868077ac42b81c9b7d

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.3-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 17329cd1f3127a641e75eb23a060ea15f794f2080da63d8183019b9f7bae0640
MD5 44c7857d3392a2c17c73bc01927fdfab
BLAKE2b-256 b7b8c5b96b603827c232fea8bf3c8bf8c2683dcee02b2451ddbbc23dd021244e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6417d9457abae46bfae991019d7c5de054b541ef48beaeb0f347d310a0723483
MD5 6458f54f2b1a1c5a570f8e5a64e57603
BLAKE2b-256 6cbc01e6c706cd5e3a2eb6c55c2dfd6b39c81dd79e9f34d969bdc83ff1342e26

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.3-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 259349a3e3ec83e0da5ad62562ad8a68ce147aba943b3ac8fe638f4ce6ac8f6e
MD5 14a78d1ef6de12c9acfbc55a9c358dd0
BLAKE2b-256 627d19a9f72faea82eb1761507631c5565fa1d845c4b7cc4c7ba03aac085b543

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8ec87ba14cbbead122faaad85b4384d30258f5440ee2d1296261a81064a88b17
MD5 09c46d0df8a66d3f5658e6cb3e4914d0
BLAKE2b-256 7c84d46be385caea4b439d3a7cc9d02bd875de6db4d67076ade95cf98f9883a3

See more details on using hashes here.

File details

Details for the file galapy_fit-0.5.3-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for galapy_fit-0.5.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b1298b6d98025ad4f82a366785e92144c1246854f15a7085af19a81e1d5dfad2
MD5 7bc209b40d4a9d45a0d3ac33d8dadefe
BLAKE2b-256 cb8986841b122910627648416a8b7f670d001ba1f8740a0b6b829ca481605496

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