Last update: 31.7.2024
GalIMF stands for the Galaxy-wide Initial Mass Function originated from the Integrated-Galactic-IMF (IGIMF) theory Kroupa & Weidner (2003).
GalIMF version 1.0 (with a companion paper Yan, Jerabkova, Kroupa 2017). It is a Python 3 module that computes galaxy-wide initial stellar mass functions based on locally derived empirical constraints following the IGIMF theory (Weidner et al. 2013; Kroupa et al. 2013).
GalIMF version 1.1 (with a companion paper Yan et al. 2019). It is a Python 3 module that couples the IGIMF theory with galaxy chemical evolution.
The initial stellar mass function (IMF) can be defined as a mass distribution of stars formed during one star formation event in a region of approximately the size of 1 pc. The stellar IMF, therefore, dictates the number of supernova explosions, the chemical enrichment, how bright the stellar population and unresolved objects are, and many other issues that affect directly or indirectly a vast majority of astrophysical fields.
Despite ongoing research, we still cannot formulate and predict the IMF self-consistently. Therefore it is necessary to look at the empirical evidence that might help us to understand the IMF.
One possible way of doing so is to look at Galactic star-forming regions and try to estimate the shape of the IMF as is done by Marks et al. (2012). Then we can look at whole galaxies which can have very different chemical compositions and very different densities and other physical parameters. For a galaxy, we can measure the emitted light and we can try to constrain the total mass and deduce the composite galaxy-wide IMF. For example, one could use the Hα EW and galaxy color as in Hoversten & Glazebrook (2008) or the ratio between Hα and UV luminosity as in Lee et al. (2009).
And now here comes the question:
The module calculating the galaxy-wide IMF is described here while more detailed comments can be found in the source code together with the support PDF file (supplementary-document-galimf.pdf), where all equations are derived in detail and labeled in a consistent way with the source code galIMF.py.
An example file, example_galaxy.py, is provided for a quick test and also serves as an easy entrance for the most basic usage of galIMF.py.
GalIMF is also able to optimally sample not an entire galaxy, but only one embedded star cluster with a given mass and metallicity. This is demonstrated in example_star_cluster.py.
GalIMF represents a Python 3 module that allows computing galaxy-wide IMFs under various assumptions. With the module, we distribute an example script where we use the invariant two-part power-law canonical IMF (Kroupa 2001) as a benchmark, and the grid of Salpeter slopes (2.3) drawn into the figures is used for demonstration of IMF variations.
For the computational details, please, look at Yan, Jerabkova, Kroupa (2017) and Schulz, Pflamm-Altenburg & Kroupa (2015).
The generated stellar mass distribution depends on the galaxy-wide star formation rate (SFR, which is related to the total mass of a galaxy) and the galaxy-wide metallicity ([M/H], see alpha1_model, alpha2_model, and alpha3_model in the code file galIMF.py).
The code can generate a galaxy-wide IMF, i.e., IGIMF. It can also generate all the stellar masses within a galaxy with optimal sampling, i.e., OSGIMF:
Based on a local IMF (can be the fixed universal Kroupa IMF or the systematically varying IMF based on Marks et al. 2012), GalIMF will produce the galaxy-wide IMF in a data file with contents: stellar mass [Msun] vs. IGIMF values [number of stars Msun^(-1)] normalized to the total mass of a stellar population (see Yan, Jerabkova, Kroupa 2017 for details).
The optimally sampled galaxy-wide IMF is based on the same local assumptions as the IGIMF above, however, it represents a discrete formulation of the IMF. That is, its output is in the form of the number of stars in mass bins. The optimal sampling methodology implemented here is from Schulz, Pflamm-Altenburg & Kroupa (2015) which generates stars from the IMF without Poison noise (therefore "optimal sampling"). This method presents a probe that is capable of testing the nature of star formation as an alternative to random/stochastic sampling of the IMF.
To compute the IGIMF or the OSGIMF, the GalIMF module contains all local IMF properties (e.g. the dependence of the stellar IMF on the metallicity, on the density of the star-cluster forming molecular cloud cores), and this software module can, therefore, be also used to obtain only the stellar IMF with various prescriptions or to investigate other features of the stellar population such as what is the most massive star that can be formed in a star cluster.
This script needs two input values: SFR (the star formation rate, in Msun/yr) and the [M/H] value. The output is the IGIMF and OSGIMF as a function of stellar mass, normalized to the total stellar mass. The IGIMF and OSGIMF values are also written into the output file. To demonstrate the shape of the generated IMF, we include a grid of Salpeter power-law indices in the figures.
For users without any experience with Python, we recommend using Anaconda to install Python 3 and all required packages.
For users who already have installed Python 3, we recommend using pip to install all required packages. An instruction can be found here.
For users having both Python 2 and Python 3 installed, your two Python interpreters may coexist with the same name. See this page if it causes any problem.
In the following subsections, we describe how to install and set up the module. We tested this on MACOSX, Linux and Windows platforms.
The GalIMF module is written in Python 3, therefore you need to install Python 3 and the following packages:
For analyzing and visualize the results as our example script example_galaxy.py does, one needs numpy, scipy, matplotlib.
To learn how to use the code and to present its main features to researchers not familiar with Python, we prepared an example implementation of the GalIMF module. This example implementation is called example_galaxy.py and is included together with the module.
First, make sure you are using Python 3, then write:
python directory_of_example_galaxy/example_galaxy.py
into a terminal to run our example program. Further instructions will show up in the terminal.
The example_galaxy.py will generate a TXT file and a PDF file in the same directory as the basic output of GalIMF.
You can download the GalIMF repository and call the galIMF.py module based on the placement in your computer.
If the Module directory is in the same directory as your own Python script (this is the case of the presented example example_galaxy.py) you will import galIMF.py as:
import galIMF
If it is in a different directory, it is also possible to call it from its directory using:
import directory.galIMF
The third option is to put galIMF.py into the Python directory structure so that you can easily deploy galIMF.py for your Python 3 project in any directory all as:
import galIMF
To do that open the Python interpreter and run:
import sys
sys.path
This will locate Python libraries on your computer (usually there is something similar to "...\lib\site-packages"). If GalIMF is placed in this directory the galIMF.py module can be called from the Python script located anywhere simply as:
import galIMF
Then you can treat GalIMF as the same as any other package.
Use a pipeline to first run, e.g., the example_galaxy.py. Then read in the output files of GalIMF, e.g., GalIMF_IGIMF.txt, for your own program.
To apply the IGIMF theory to different galaxies, the following parameters should be changed. They are also the required input of our example code example_galaxy.py:
galaxy-wide star formation rate: SFR
galaxy-wide metallicity [M/H]: M_over_H
OSGIMF stellar mass resolution: resolution
The following inputs are not essential for the IGIMF theory and can be changed according to the research context:
bindw: defined in example_galaxy.py, will automatically change the resolution of histograms for optimal sampling.
M_str_L = 0.08: stellar mass lower limit [Solar mass]
M_str_U = 150: stellar mass upper limit [Solar mass]
M_turn = 0.5: first mass at which the power-law index of the stellar IMF changes [Solar mass] (i.e. in the canonical IMF, the IMF power-law index changes from alpha_1=1.3 to alpha_2=2.3 at a stellar mass of 0.5 Msun)
M_turn2 = 1: second mass at which the power-law index of the stellar IMF changes [Solar mass] (i.e. in the canonical IMF, the IMF power-law index changes from alpha_2=2.3 to alpha_3=2.3 at a stellar mass of 1.0 Msun, i.e., the canonical IMF has a Salpeter index above 0.5 Msun)
alpha3_model = 1: IMF high-mass-end power-law index model, see Function_alpha_3_change
alpha2_model = 1: see Function_alpha_2_change
alpha1_model = 1: see Function_alpha_1_change
beta_model = 1: see Function_beta_change
M_ecl_U = 10^9: the upper limit of the embedded cluster mass in stars [Solar mass]
M_ecl_L = 5: lower limit of the embedded cluster mass in stars [Solar mass]
The following parameters should not be changed as they are part of the IGIMF theory. Read Yan, Jerabkova, Kroupa (2017) carefully if you do intend to change them.
delta_t = 10: duration of star formation epoch [Myr] (the time-scale on which the ISM forms molecular clouds and from them a new stellar population in embedded clusters)
I_ecl = 1: normalization factor in the optimal sampling condition equation
I_str = 1: normalization factor in the optimal sampling condition equation
A galaxy evolution model is developed (See Yan et al. 2019 for a detailed description of the model) that can couple the IGIMF theory or any other variable IMF theory.
The default model assuming no gas flows is designed for the monolithic collapse galaxy formation scenario, which particularly applies to the central regions of giant ellipticals. Modeling code with gas flows can be obtained with private communications.
Our model can vary the galaxy-wide IMF at each time step depending on the galaxy-wide star formation rate and the gas-phase metallicity at the time.
In order to compare different IMF assumptions with the same condition, the star formation history of a galaxy can be specified and fixed.
The deployment of this module is already covered when deploying the galaxy-wide IMF generator.
Set up the parameters for the main function of galevo.py, and run it to start a galaxy chemical evolution simulation. The output will be in saved .txt files and generated plots.
The main inputs are:
Other (currently activated) input parameters include the settings of initial gas metallicity (Z_0), solar abundance mass fraction, i.e., X, Y, and Z (solar_mass_component), stellar yield table (str_yield_table), the mass limit of the most massive star (steller_mass_upper_bound), the efficiency of the star formation (SFE, only activate when SFH_model='gas_mass_dependent'), type Ia supernova yield table (SNIa_yield_table), solar abundance table (solar_abu_table). And the flags include whether to activate type Ia supernova (SNIa_ON), insert more time step (high_time_resolution), show the plots (plot_show), save the plots (plot_save), activate galactic wind (outflow), and use previously generated gwIMF (check_igimf).
An example is given in the file "example_galaxy_evolution.py", which calls "galevo.py", which goes through the setup of the main input parameters and shows the resulting plots.
This site keeps the newest GalIMF version and the old version used in our publications.
We use SemVer for versioning. That is,
See the GalIMF homepage for an overlook of all the major versions, related scientific publications, and simulation demonstrations.
The major updates include:
GalIMF is the first open-source code tailored specifically to study the effect of the variable IMF.
GalIMF models the IMF variation effect with high precision. Different from the models that assume an invariant IMF, GalIMF cannot apply a limited number of look-up tables for the yield of previous stellar populations, the computational time of GalIMF, involving unlimited or at least a much larger number of possible situations due to the IMF variation, is proportional to the square of the number of the timestep.
GalIMF discusses, for the first time, how the number of SNIa is affected by IMF variation.
A summary of different chemical evolution codes is provided here.
The main author of the Python program is:
Other members of this project include:
Tereza Jeřábková, European Southern Observatory, Tereza.Jerabkova(at)eso.org
Prof. Dr. Pavel Kroupa, Universty of Bonn, Charles University, pkroupa(at)uni-bonn.de
This program is free software. You can redistribute it and/or modify it. However, you must state all modifications carefully and contain the License file when doing so.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file for details.
GalIMF was developed by our group with a large amount of effort. If GalIMF contributes to a project that leads to a scientific publication, please acknowledge this work by citing the project.
When publishing results based on this software or parts of it (the executable and/or the source code) please cite the relevant publications with this ready-made citation entry:
We thank Vaclav Pavlik for kindly testing the code GalIMF 1.0.