scopesim_templates.stellar.imf#
Initial mass function, used by the cluster function.
- KL:
Copied (18.06.2020, vers:134c5ff) almost directly from https://github.com/astropy/PyPopStar/blob/master/popstar/imf/imf.py
Lu
Original code was taken from libimf package written by Jan Pflamm-Altenburg and has been modified only marginally. The libimf code was licensed under a GNU General Public License.
When I use this code, I should cite Pflamm-Altenburg & Kroupa 2006
Unfortunately, the code was almost completely un-commented, so all comments are mine. I have also added substantially to the code to make more convenient and general purpose functions.
Functions
|
Pass in float or array of floats (x) and return 0.5 for x==0 and 1.0 for everything else. |
|
|
|
|
|
|
|
|
|
returns ((1+power) * x)**(1.0 / (1 + power)) and handles the case when power == -1. |
|
|
|
|
|
|
|
|
|
Take floats or arrays, but return arrays. |
|
Pass in float or array of floats (x) and return 0 for x<0 and 1 for everything else. |
|
Pass in float or array of floats (x) and return 1 for x>0 and 0 for everything else. |
Classes
|
IMF base class. |
|
Define IMF from Salpeter (1955). |
|
Initialize a multi-part power-law with N parts. |
|
Define IMF from Kennicutt (1983). |
|
Define IMF from Kroupa (2001). |
|
Define IMF from Miller & Scalo (1979). |
|
Define IMF from Weidner & Kroupa (2004). |