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

Uploaded Source

Built Distributions

galapy_fit-0.5.0-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.0-cp312-cp312-macosx_10_9_x86_64.whl (734.3 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

galapy_fit-0.5.0-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.0-cp311-cp311-macosx_10_9_x86_64.whl (747.8 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

galapy_fit-0.5.0-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.0-cp310-cp310-macosx_10_9_x86_64.whl (738.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

galapy_fit-0.5.0-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.0-cp39-cp39-macosx_10_9_x86_64.whl (738.8 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

galapy_fit-0.5.0-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.0-cp38-cp38-macosx_10_9_x86_64.whl (737.4 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

galapy_fit-0.5.0-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.0-cp37-cp37m-macosx_10_9_x86_64.whl (733.1 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: galapy-fit-0.5.0.tar.gz
  • Upload date:
  • Size: 128.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.0.tar.gz
Algorithm Hash digest
SHA256 1643e4ed5a46aeec3c55c90159dfafcb7ecda68258d37a87318a72c0ad8d642e
MD5 05d67deba37894399452fe5c45df77de
BLAKE2b-256 93377ff5f3ea9fce66a52a2095d54861e099b4c9412fd9aef377c7aa35f155d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 702d36acd6cff9ca0e888c3d1e838155687c31c0d4727ca67f118a83a507b1c1
MD5 e5cb6a75b9d8df5e1e604da0265a7cb8
BLAKE2b-256 dcb4b9e541c17ee86f20eeec0a5a279bb83b2a4368c0a53050367567d619cd98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 284579aa8fd755e8404c8bd0311258255e0abdcf361d3cf82726ce0ed470cb8e
MD5 050654f35664c1378153b9ef34484134
BLAKE2b-256 2d06cfce05aa348d919e3641edb8abaa2992f90c329cafb7a653cd8bd804d8fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 73035dc73ac2183312a278ff4d2ad15c3074c4364d1a8c1fafbff217677fa2b8
MD5 1bc34afac736b10d1619f94b0de6c0dc
BLAKE2b-256 175c613b79cfad5839d29187194ce934af7814602ac749e6b05da968f59e5bb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ad8be09d5ca21e6ca10c75fd337c480ea7a46f3ceecb2d35a9ded4b0a8a537f3
MD5 3fc033f0a8c9a796df5c272d2139f7d2
BLAKE2b-256 dd7a291dc2c167200352cfae7b38a4760b12f114de802a40f8c89a6cb05d94ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f79c7ce30a8c1d67c7dce8fb1b6f9e429002c88c38004c70f8721cdd899eaf8
MD5 d90b0fb690d8307f76e7d6726bd31175
BLAKE2b-256 00372a89a79ac688c6c9a6e7e862fde828b8017273cf9cdbbb9f8b6ee4642c7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 28b6fd98e9d5fbd3925b0ea1fac6d81c5571cb959e78c7117842e9c860e1e5ad
MD5 7f27606842dfaa5b83ca3bb0f83af21c
BLAKE2b-256 6182211b8b10ef73d72db5613bc4db4ea9479333558252e4239fd321c4412f50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af99bbaad74dfbe1dd684ae54f41c035f7292b18b42ab5df046e718f3c195995
MD5 d8870f613686bcfd866ed57842f965ff
BLAKE2b-256 07f571728bd082ddbc2852e8ff512b03eeb9cc38f55ea76228dbcc396514f782

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0ca9f1984783ac3506b05f3f9cbc0917e09c570736fea5fa5d5e16af5d7ea440
MD5 4fd03be36a201606f0573c3b7a122b79
BLAKE2b-256 612e24d9e242a02c92dbd119389e0e5f99197b9763516625de060e96d6128880

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9cc8d710538ad7463db830ad3bcc5220545ec9cbce0b627c35763b6e59599314
MD5 ea69ed948ea81f752d4dd71e12451bdd
BLAKE2b-256 61fda3bb0c21f873b1ffffb1eccfe66b899206aef27761963229052cbce3255d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ddf13bc8c530c31fb01b680f4077bb5fac1b407de5813db40ad81d0804a92bcd
MD5 32635dfcbe8b4632601b0c5abfbc99a5
BLAKE2b-256 87c23d03e33a8fb62e690c5ac87d8b7ca1ac906369e945b4f3886170dccd31f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c408adf9de031a1a11a0a3665f683ed77d9db47ee97a714be0563ae6407dd2d1
MD5 47336057b23280cfe80e710a1468fb9c
BLAKE2b-256 09036b247a80cb789184bf06227fd51eedb19658c9671c30fa11ba2eff4651b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8ba077f47a43db5429c5346ad0b8656154e0bffbfddb84dcba8750fbc9b86306
MD5 ba60828ec61cf65e5992bacc4e228b21
BLAKE2b-256 31f9cc4c89dd85d683701f10c65d85848aeb6fc3c3a2e6bd707c0a8dc9858dd8

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