Package: galapy-fit
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.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 softwareGPLv3 licenseGitHub repositoryhttps://github.com/TommasoRonconi/galapyPython versions>=3.7Dependenciessetuptools,numpy,scipy,emcee,dynesty,matplotlib,getdist,requestsTL;DRGalaxies 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.InstallThe preferred method to install the package is throughpipas it will install the most recent stable release:$pipinstallgalapy-fitfor further details, please refer to theinstallation guide.Fitting through terminal commandsSampling the parameter space can be done from the command line in a terminal.
The steps required for running the sampling are just two:first we will have to generate a parameter file, this can be done by running
the utility command$galapy-genparams[--name/-nNAME|--SFH_model/-sfhMODEL_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 inparam_file.Once the parameter file has been generated and properly modified, we can run$galapy-fitparameter_file.py[--serial/-s|--multiprocessing/-mpNCPU]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 inphotometric_fit.NoteGalaPy, in some of its components (e.g. SSP tables, PAH template), makes use of pre-computed functions that are
available in the official database (galapy_database). When one of the files in the database is accessed for the
first time it will authomatically be downloaded into the user’s filesystem
(in the default location$HOME/.galapy/galapy_database).
This will of course require an internet connection and can partially slow down the computations.
We therefore suggest, prior to first run, to download all the database by running$galapy-download-databaseQuick API hands-onThe 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 modulegalapy.Galaxyimplements classes of
typeGXY, from which the intrinsic luminosity and the flux at given distance can be retrieved.
An object of typeGXYis built as followsimportgalapyasgpgxy=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 methodgxy.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 functiongxy.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-SEDpgxy=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 thetutorialsand in theAPI documentation.