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

Uploaded Source

Built Distributions

galapy_fit-0.5.1-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.1-cp312-cp312-macosx_10_9_x86_64.whl (738.0 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

galapy_fit-0.5.1-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.1-cp311-cp311-macosx_10_9_x86_64.whl (751.5 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

galapy_fit-0.5.1-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.1-cp310-cp310-macosx_10_9_x86_64.whl (741.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

galapy_fit-0.5.1-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.1-cp39-cp39-macosx_10_9_x86_64.whl (742.5 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

galapy_fit-0.5.1-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.1-cp38-cp38-macosx_10_9_x86_64.whl (741.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

galapy_fit-0.5.1-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.1-cp37-cp37m-macosx_10_9_x86_64.whl (736.8 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: galapy-fit-0.5.1.tar.gz
  • Upload date:
  • Size: 131.9 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.1.tar.gz
Algorithm Hash digest
SHA256 a344fe66b05ddbef3bfe459db0bad8251fb40bc16502beaa0836b54d90c6b30a
MD5 261a65845f9aeee76f4a61836cf116a3
BLAKE2b-256 0be7906044c66ce1fce8eab128fd40d5d101dae6a9c4b4fdec15ef419c844042

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b110fcf55392f9f136d8d6310220b77e0e4f60d011e4110fdc8e50d9fd548114
MD5 5f26116d8a17a5268af68d47df0204ec
BLAKE2b-256 6819812ffacc25e9bf4014f98fc6d3272f11064d29624e86cbeefad81a7241fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7ee09962cb7d536dbf5f20b184d7320d1c07fc21b0103381e18766759cbe33da
MD5 f9577f0998e691ed100a194d365a8772
BLAKE2b-256 a8bb6b31c6bf03f969b46fc48e587343fc0c5e42879ac4762e2f07f3d7471f8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b85ecce31f9e5b579dc0dc6fddc0304c6d64e24c3b86d2256f50198cf1de4849
MD5 3b6f0211490d487c7d55b9ca396a8aa5
BLAKE2b-256 76bddbf627c08c095e4bc6352aa13d54d7c7297f1b0fe96586ddaaf4db1fc562

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 906f9a253fef396b29b494f362c7ad84ea36f4785fae7ab8e1d756b13bff661e
MD5 4f5e5f756d91f88f9b2fbce43c697062
BLAKE2b-256 9288ecbacb5291bb6967cac3ef59abb959d213b6d6f08d38163bf5347667516a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e63fff8a6f73b5975beb7c04acfb90697f038e810bfdbf73195011ecd881250c
MD5 6b6fff51d3d7d593ba7ad747eb24b28d
BLAKE2b-256 af364ffac16e2c806e89330f89ece40ee898507eb725b03218e1a81b13289948

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aeb15b61e316746b3a0c1dae79bda189423cab9fd466d9d244909e2c1cf1ea52
MD5 b4d81ead10df1d5ba9dba4b500fcedab
BLAKE2b-256 b4e92eb420ad298f8746116491b2721c4a88763aa7acedeb3fefaa8db4c47e3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2329c1bb9e0c419317f645df485ef4014071ea3334fc488262ad45bfdae76e37
MD5 cc5e275fad846c05f65f2a5e850f2c5d
BLAKE2b-256 00cec498238d7f052984dfe6ed236ae5c9b44a7408248a8032492b35bc0a534e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6656abbc5ee3ee2abdba9f9ee8fc3af0bea8e74dc1a33d8c2dc6d2e91861de20
MD5 c08e539259a4b93b10ad9d757a25ca64
BLAKE2b-256 78966e41839d90ac72428351f01d6836b592c3d20596545520f9f46225ad4913

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b5f79438a7d5f9d5e87ae86e23d9000ab750af20a6ccd21bae8fcf96b2d69e32
MD5 c77723b84cc5ba170a4f5b9615a60d2f
BLAKE2b-256 ede23066cc252149eeaadd378650a6e968d6e82e1a2fba29e266c0afd4d04414

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 44f160b5d809baec8f2580fdb1da9f3630864e46b5d7ae485182f158fe494d24
MD5 4a89a74d21b3c9ac7b5efc7babf53615
BLAKE2b-256 33736c42091e22d2e4f179163dde84242b061bc9b6d2c5f5065d47c10461d137

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd7307ca01e764fccd920e595f22a0867a9523fd981d1acd2894a1f39a3e18d2
MD5 36cdde7f2b3293d255c7bc7edf6fd664
BLAKE2b-256 cf1553e1031132adec684c36abf9169f8ba60694eaf776d244b945a920c21700

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for galapy_fit-0.5.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0fab9bce32129559cc03ef2ca76a12f17bd3889107981a26341a76d7222fc307
MD5 b70faf120443c1aebd3e9f0d298cb65e
BLAKE2b-256 f9143d7dfa8636905c2569f4598f6ef59adb0159bf3264f645d759c7e91e184d

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