Skip to main content

GalaPy - Spectral modelling tool for galaxies in Python

Project description

Testing Status Building Documentation Status

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

Uploaded Source

Built Distributions

galapy_fit-0.5.2-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.2-cp312-cp312-macosx_10_9_x86_64.whl (739.6 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

galapy_fit-0.5.2-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.2-cp311-cp311-macosx_10_9_x86_64.whl (753.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

galapy_fit-0.5.2-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.2-cp310-cp310-macosx_10_9_x86_64.whl (743.3 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

galapy_fit-0.5.2-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.2-cp39-cp39-macosx_10_9_x86_64.whl (744.2 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

galapy_fit-0.5.2-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.2-cp38-cp38-macosx_10_9_x86_64.whl (742.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

galapy_fit-0.5.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

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

galapy_fit-0.5.2-cp37-cp37m-macosx_10_9_x86_64.whl (738.2 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file galapy-fit-0.5.2.tar.gz.

File metadata

  • Download URL: galapy-fit-0.5.2.tar.gz
  • Upload date:
  • Size: 132.8 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.2.tar.gz
Algorithm Hash digest
SHA256 aabfffafcf50d7ed21c18d8607a6f65122dfd92fde343c4e5a36ff445a92b6f0
MD5 b7dd9ccc7b92be67a0905dbd0d40f555
BLAKE2b-256 26f8e236eb0f1f700c71a2d0331f5f7c2f80d6b144d0a5016e8be17fcd8a9b50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a7c1a635f51d0df6be602115980bf497559aa6d90f8305a51e930840633fdd05
MD5 3b92a44eb20075dc50a2ba9c94270fbd
BLAKE2b-256 7887836192412603b98378baf2fe4018b7a5376bd0fd745939b4f6725dda01c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2301fade32b0ef85ddc71bbc85893358e31df9366b3fe65ff20edb10083d99ba
MD5 19017e5b011f98523f949dba7028d705
BLAKE2b-256 7dfc3f141254b70f7dbaec812150ade0a702c212596ab6bc2b4d7e3b1451e473

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 48808e1c182e04a7de2f18ffd715c78c9ac8fa4cb9f791df8d48dfd821f0277c
MD5 84b2d346fc7a0c2d995bfeb11d74141b
BLAKE2b-256 ce83a7556ee85b744c1ff00fb7139a2eded9325447517c7f7c264ba5d08b3b42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6fa8434d3cb309c12d28b0f8da79e657dd41854e57ba90dd40e02aab4cd01f38
MD5 929414025a931bb102b1761274326af4
BLAKE2b-256 3805805a7c8e66d22996bd1223ed9d485fec4d355510b1099b8b8b431084d878

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc7d4f60cb885a1faf9eb412eac11500c21c55d87a32a6cafe0588a9dcf50552
MD5 6bf3d4222800cc0eac72bc5370826b8d
BLAKE2b-256 e34f2937631742256305c10f2d6dae0cb2a897c770180398163710c8891ddde5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a045cfe49e09b3ff374503e5d039861fd6c10ef5e229aeb37b6b20d2635853d1
MD5 cc082483eef95ce7d32e741319877245
BLAKE2b-256 8086d8b1604433e600d5d90baedd7e44b88979d012761a7db73b72b2918b9eb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f068bea8302d145436394eccade87f8ef523e135b12a1fcbc555dc7946d56b59
MD5 e42faed7534464ac0bb167724e70a47c
BLAKE2b-256 9c2d4b508eeebce9915948b90322018f72bb114eaf711b4e5de3ba5e3bab81f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bb8c00e65e720854ed600279caeb362723570819f4cb81beba25c16babbf374f
MD5 a6a1ba867b9bdda05d591369d2257503
BLAKE2b-256 f1d8e2d4c6f190cb13e9a1c10e0c26295b259f4eb243038f488dc476f28baf5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e31ef0142bea127cebcc7542c02c65e01d096f41698167fd350f55a2bcca6504
MD5 a184e1276388cd79f69b772dc2b8aab9
BLAKE2b-256 907d36c60819b4654ce7354c2d22a4c4181ef3967d1ee6834660018cbc2b2a4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 454fecffa2417a245488ad4df804232026a65b33931b0abb3dfbc9e712cba598
MD5 e170166f4f285f5373ca8100a9fbdcf5
BLAKE2b-256 109f4719ab2a2edb5ead7fc26170d0ad39300947e20a321d8cdfb7cb95e9e430

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d86f90fea0499ced611615d9eae88522246ee4206391bba3797cba2bd3865633
MD5 dafb1c460f141954a7c64b3bf19e4d45
BLAKE2b-256 37da86154657fbf46d85ba667c12e983c3a0c7ecd1f1474560dd747d14efaaf2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1f29c6efd2479a658fa457cbd478643d7ea7c85c42d6920dc6ed078c151eea8e
MD5 d53d707494730c83df2513906b93c8d4
BLAKE2b-256 26a8c6370ae561f18b89542327780fd50d2a95fc4126ba29fe117b6c60c168ff

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