REVIEW 2 major objections 4 minor 58 references
The IMF package: a toolkit implementing mass functions and statistical tools to analyze them
T0 review · 2 major / 4 minor · reviewed 2026-08-01 · deepseek-v4-flash
Pith's one-line read The paper presents the imf Python package, which implements common and variant forms of mass functions — especially the stellar IMF and its pre- and protostellar equivalents — as probability distributions, enabling sampling and integration
desk verdict Useful, well-integrated IMF/PMF/CMF sampling toolkit, but the KK09 CDF in Eq (6) is mathematically wrong and needs fixing before that distribution can be trusted. read the letter →
The pith
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
The reading
What carries the argument
The central object is the MassFunction class, built on a Distribution layer that wraps or reimplements statistical distributions. Complex or non-analytic functions are evaluated on a grid and interpolated with PCHIP (piecewise cubic Hermite interpolating polynomial) using a default of 200 points. Random sampling works through the percent-point function (inverse CDF) of the underlying distribution; optimal sampling solves a root-finding equation for the most massive member and then iteratively integrates one-member mass intervals. CompositeDistribution joins component distributions for broken-power-law and Chabrier forms.
What would settle it
Pick a stress case — e.g., the Koen–Kondlo error-convolved power law with α=2.35 and σ=2 over (0.03, 120) M⊙ — evaluate the PDF and CDF on a dense grid via direct numeric integration, and compare with the package's interpolated values at the same masses; a deviation above ~0.1% anywhere in the range would refute the fidelity claim underpinning the package's sampling and integration.
Extended reading notes
Core claim
The paper claims that the imf package provides a unified, statistically grounded implementation of common mass functions — Salpeter, Kroupa, Chabrier, Schechter, the Koen–Kondlo error-convolved power law, and the Padoan–Nordlund turbulent IMF — and extends the same machinery to protostellar mass functions (PMFs) and core mass functions (CMFs) from several formation models. It further claims that both random sampling (via inverse-CDF draws) and deterministic optimal sampling (via iterative root-finding on one-member integrals) are implemented faithfully, with interpolation used only where analytic forms are intractable. The package also includes utilities for star-cluster multiplicity, integr
Load-bearing premise
The load-bearing numerical premise is that 200-point PCHIP interpolation keeps every interpolated PDF/CDF within about 0.1% of its true value; if that fails for a particular function, all sampling and derived statistics inherit the bias.
Editorial extensions
If this is right
- Researchers can generate synthetic stellar populations with reproducible random or optimal sampling from any included IMF form, with configurable stop criteria controlling how the mass budget is filled.
- Pre- and protostellar models — PMFs from the McKee–Offner formalism and CMFs from Padoan–Nordlund and Hennebelle–Chabrier — become directly testable against observations without requiring bespoke code.
- Integrated galaxy IMFs can be assembled by sampling cluster masses from a Schechter function and then stars from an IMF, all within one package, enabling population-level comparisons.
- The package's luminosity and Lyman-continuum helpers connect a sampled cluster to observable integrated light, providing inputs for stellar population synthesis codes.
- Performance measurements indicate that random sampling of a 10^4 M⊙ cluster is sub-second for all tested IMFs, with memory scaling linearly, supporting repeated Monte Carlo experiments.
Reading between the lines
- The paper's ~0.1% accuracy claim for PCHIP interpolation is asserted without a presented validation; a targeted error curve would tell users when to increase the default 200-point grid.
- Because interpolated functions default to finite mass bounds, any user who requests non-finite limits gets silently truncated distributions, which could bias the high-mass tails of cluster statistics.
- The package's PMF/CMF implementations put competing star-formation theories on equal computational footing, so a natural next step is to run the same cluster-sampling experiments across PN, HC, and M10/O11 forms to see which matches observed core and protostar counts.
- The system-versus-stellar IMF distinction, including multiplicity assignment, is built in; users working with single-star IMFs need to be aware which population they are sampling.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper presents `imf`, a Python package implementing a variety of mass functions (Salpeter, Kroupa, Chabrier, Schechter, KK09 error-convolved power law, Padoan turbulent IMF) as SciPy-compatible distributions, with random and optimal sampling, star-cluster generation, integrated-galaxy IMF construction, CMF/PMF models, luminosity calculations, and visualization. The authors describe the mathematical forms, the interpolation strategy used for expensive functions, the sampling algorithms, and performance characteristics. The central claim is that the package enables faithful sampling and integration across this range of mass functions.
Significance. The package fills a real need: it provides a unified, SciPy-integrated interface to many commonly used mass functions and offers both random and optimal sampling, as well as access to PMF/CMF models that are rarely available in other tools. The open-source availability and Zenodo archiving are commendable, and the paper clearly documents the implemented functional forms and the design choices (interpolation, sampling modes). However, as submitted, the implementation of at least one mass function is demonstrably incorrect, so the central claim of faithful implementations is not presently established. If the mathematical error in Eq. (6) is corrected and the interpolation accuracy is validated with concrete tests, the package would be a valuable community resource.
major comments (2)
- [§2.5, Eq. (6)] Equation (6) is not a valid CDF for the error-convolved power law. Differentiating the RHS does not reproduce the PDF in Eq. (5); the correct CDF is F(m)=α/(m_min^{-α}-m_max^{-α}) ∫_{m_min}^{m_max} x^{-(α+1)} Φ((m-x)/σ) dx. In the σ→0 limit, Eq. (6) approaches α(m_min^{-α}-m^{-α})/(m_min^{-α}-m_max^{-α}) for m in (m_min,m_max), i.e. α times the true CDF; for α>1 this exceeds 1 near m_max. For parameters typical of the package's examples (α=2.35, m_min=0.03, m_max=120, σ=0.5), the RHS at m=m_max is approximately 2.85, clearly inconsistent with a cumulative probability. Because KoenConvolvedPowerLaw interpolates this CDF to construct the PPF (§2.5 and §3.1), random samples from that class are drawn from the wrong distribution. The formula (and the code implementing it) must be corrected before the package can be described as faithfully implementing the KK09 distribution.
- [§2, interpolation paragraph] The paper states that PCHIP interpolation with the default 200-point grid keeps errors 'within ∼.1% of true value for sufficiently well-sampled functions,' but no validation is presented. This is a load-bearing claim because many central outputs (KK09, PadoanTF, Schechter, PMFs, CMFs) rely on interpolation for evaluation and sampling. Please provide measured error curves for representative functions against high-accuracy direct evaluations (e.g. using scipy.integrate.quad) as a function of the number of interpolation points, and state the conditions under which the 0.1% bound holds. Without such tests, the accuracy of all interpolated functions—and hence of sampled masses—is unquantified.
minor comments (4)
- [§3.2] The text 'each satisfy ∫_{b_{i-1}}^{b_i} ξ(m)dm = 1' is inconsistent with the use of the scaling factor k in Eqs. (10)–(12); it should read 'k∫_{b_{i-1}}^{b_i} ξ(m)dm = 1' (or the mass function should be explicitly rescaled). This is a clarity issue but could confuse users implementing the algorithm.
- [§4, Table 2] Table 2 reports single timing measurements without repeats or error bars, and the statement that 'time for both methods and memory all scale linearly with cluster mass' is not supported by any figure or fit. Please include at least three repeats with scatter, and a scaling plot or fitted exponents.
- [§2.1] The abstract and text use 'imf' while the PyPI project is 'initial_mass_function'; please clarify the import name and PyPI name once for users unfamiliar with the package.
- [§5.1.2] The description of Padoan & Nordlund (2011) CMF generation is very brief; a small pseudocode block or a sentence clarifying how masses, densities, and ages are combined to build the CMF would improve reproducibility.
Circularity Check
No circularity: the package's mass-function forms are taken from independent cited literature, and its claims are about implementation, not derived from or fitted to its own outputs.
full rationale
The paper is a software/toolkit paper whose central claim is that `imf` provides working implementations of known mass functions (Salpeter, Kroupa, Chabrier, Schechter, Koen & Kondlo, Padoan & Nordlund, Hennebelle & Chabrier, McKee/Offner PMFs) as SciPy-compatible distributions. Each functional form is imported from an external, independent reference and is not derived from or fitted to the package's own outputs. There are no fitted parameters being renamed as predictions, no self-referential uniqueness theorems, and no ansatz smuggled in via self-citation. The authors' citations of their own prior work (e.g., Richardson et al. 2025, the Zenodo archive of this package itself, Ginsburg et al. 2019) are not load-bearing for the mathematical content. The paper's use of interpolation and its assertion that numerical error is ~0.1% is an unverified accuracy claim, and the reviewer's noted issue with Eq. (6) is a potential mathematical correctness problem, but neither is a circular step: the package is not 'predicting' anything from data, and its outputs are not equivalent to its inputs by construction. Therefore no circularity is present; any concerns are correctness or validation risks, not circular reasoning.
Assumptions & free parameters
free parameters (2)
- Interpolation grid size =
200 points
- Salpeter default mass bounds =
(0.3, 120) M_sun
assumptions (5)
- domain assumption The cited mass-function models (Salpeter 1955, Kroupa 2001, Chabrier 2003, Padoan & Nordlund 2002, PN2011, HC2008-13, M10/O11) are physically meaningful descriptions of the populations they target.
- domain assumption Inverse-CDF sampling via SciPy rvs produces correct draws from each Distribution, including interpolated CDFs.
- domain assumption The optimal-sampling prescription (Kroupa et al. 2013/2026, Schulz et al. 2015) is well-posed and converges under imf's iterative root-finding.
- domain assumption M10/O11 accretion histories and the HC/PN CMF formalisms correctly describe protostellar and core mass evolution.
- standard math scipy.integrate.quad and PCHIP interpolation compute the stated integrals and interpolants accurately for the integrands in Equations (5), (6), (13), and (16).
Cite this review
Pith. "Pith review of The IMF package: a toolkit implementing mass functions and statistical tools to analyze them." pith.science (2026). https://pith.science/paper/RWI22HUN
@misc{pith2026260726007,
author = {Pith},
title = {Pith review of: The IMF package: a toolkit implementing mass functions and statistical tools to analyze them},
year = {2026},
howpublished = {\url{https://pith.science/paper/RWI22HUN}},
note = {Machine review of arXiv:2607.26007}
}
abstract
Mass functions are used in all areas of astrophysics. The stellar initial mass function (IMF), in particular, plays a central role in modeling stellar populations in galaxies. However, few dedicated tools for working directly with the IMF and its precursor functions are widely available. We present the $\texttt{imf}$ package, a Python library integrated into the wider scientific Python ecosystem that implements common and variant forms of mass functions, especially the IMF and its pre- and protostellar equivalents, as probability distribution functions based on SciPy's statistics architecture. This package enables the performance of operations such as sampling and integration on a wide array of highly customizable mass functions. $\texttt{imf}$ is publicly available on the Python package index $\texttt{pypi}$ under the project name $\texttt{initial_mass_function}$.
Figures
Figures from the paper (5 more)
Reference graph
Works this paper leans on
-
[1]
Alves, J., Lombardi, M., & Lada, C. J. 2007, A&A, 462, L17, doi: 10.1051/0004-6361:20066389 Astropy Collaboration, Robitaille, T. P., Tollerud, E. J., et al. 2013, A&A, 558, A33, doi: 10.1051/0004-6361/201322068 Astropy Collaboration, Price-Whelan, A. M., Sip˝ ocz, B. M., et al. 2018, AJ, 156, 123, doi: 10.3847/1538-3881/aabc4f Astropy Collaboration, Pric...
-
[2]
Bonnell, I. A., Bate, M. R., Clarke, C. J., & Pringle, J. E. 1997, MNRAS, 285, 201, doi: 10.1093/mnras/285.1.201
-
[4]
2003a, PASP, 115, 763, doi: 10.1086/376392
Chabrier, G. 2003a, PASP, 115, 763, doi: 10.1086/376392
-
[5]
2003b, ApJL, 586, L133, doi: 10.1086/374879
Chabrier, G. 2003b, ApJL, 586, L133, doi: 10.1086/374879
-
[6]
2005, in Astrophysics and Space Science
Chabrier, G. 2005, in Astrophysics and Space Science
2005
-
[7]
327, The Initial Mass Function 50 Years Later, ed
Library, Vol. 327, The Initial Mass Function 50 Years Later, ed. E. Corbelli, F. Palla, & H. Zinnecker, 41, doi: 10.1007/978-1-4020-3407-7 5
-
[8]
2013, ARA&A, 51, 393, doi: 10.1146/annurev-astro-082812-141017
Conroy, C. 2013, ARA&A, 51, 393, doi: 10.1146/annurev-astro-082812-141017
-
[9]
Conroy, C., & van Dokkum, P. G. 2012, ApJ, 760, 71, doi: 10.1088/0004-637X/760/1/71 Ekstr¨ om, S., Georgy, C., Eggenberger, P., et al. 2012, A&A, 537, A146, doi: 10.1051/0004-6361/201117751
Show all 58 references
-
[10]
N., & Butland, J
Fritsch, F. N., & Butland, J. 1984, SIAM Journal on Scientific and Statistical Computing, 5, 300, doi: 10.1137/0905021 17
1984 doi
-
[11]
M., Brasseur, C
Ginsburg, A., Sip˝ ocz, B. M., Brasseur, C. E., et al. 2019, AJ, 157, 98, doi: 10.3847/1538-3881/aafc33
2019 doi
-
[12]
2026a, Research in Astronomy and Astrophysics, 26, 055012, doi: 10.1088/1674-4527/ae4600
Gjergo, E., Zhang, Z., & Kroupa, P. 2026a, Research in Astronomy and Astrophysics, 26, 055012, doi: 10.1088/1674-4527/ae4600
-
[13]
2026b, Research in Astronomy and Astrophysics, 26, 025003, doi: 10.1088/1674-4527/ae1f79
Gjergo, E., Zhang, Z.-Y., Kroupa, P., et al. 2026b, Research in Astronomy and Astrophysics, 26, 025003, doi: 10.1088/1674-4527/ae1f79
-
[14]
R., Millman, K
Harris, C. R., Millman, K. J., van der Walt, S. J., et al. 2020, Nature, 585, 357, doi: 10.1038/s41586-020-2649-2
2020 doi
-
[15]
2016, ARA&A, 54, 135, doi: 10.1146/annurev-astro-081915-023347
Hartmann, L., Herczeg, G., & Calvet, N. 2016, ARA&A, 54, 135, doi: 10.1146/annurev-astro-081915-023347
2016 doi
-
[16]
2008, ApJ, 684, 395, doi: 10.1086/589916
Hennebelle, P., & Chabrier, G. 2008, ApJ, 684, 395, doi: 10.1086/589916
2008 doi
-
[17]
2009, ApJ, 702, 1428, doi: 10.1088/0004-637X/702/2/1428
Hennebelle, P., & Chabrier, G. 2009, ApJ, 702, 1428, doi: 10.1088/0004-637X/702/2/1428
2009 doi
-
[18]
2013, ApJ, 770, 150, doi: 10.1088/0004-637X/770/2/150
Hennebelle, P., & Chabrier, G. 2013, ApJ, 770, 150, doi: 10.1088/0004-637X/770/2/150
2013 doi
-
[19]
Hennebelle, P., & Grudi´ c, M. Y. 2024, ARA&A, 62, 63, doi: 10.1146/annurev-astro-052622-031748
2024 doi
-
[20]
Hopkins, P. F. 2013, MNRAS, 430, 1880, doi: 10.1093/mnras/stt010
2013 doi
-
[21]
Hunter, J. D. 2007, Computing in Science & Engineering, 9, 90, doi: 10.1109/MCSE.2007.55
2007 doi
-
[23]
C., Seth, A
Johnson, L. C., Seth, A. C., Dalcanton, J. J., et al. 2017, ApJ, 839, 78, doi: 10.3847/1538-4357/aa6a1f
2017 doi
-
[24]
D., Marocco, F., Gelino, C
Kirkpatrick, J. D., Marocco, F., Gelino, C. R., et al. 2024, ApJS, 271, 55, doi: 10.3847/1538-4365/ad24e2
2024 doi
-
[25]
E., & Peters, T
Klassen, M., Pudritz, R. E., & Peters, T. 2012, MNRAS, 421, 2861, doi: 10.1111/j.1365-2966.2012.20523.x
2012
-
[26]
2009, MNRAS, 397, 495, doi: 10.1111/j.1365-2966.2009.14956.x K¨ onyves, V., Andr´ e, P., Men’shchikov, A., et al
Koen, C., & Kondlo, L. 2009, MNRAS, 397, 495, doi: 10.1111/j.1365-2966.2009.14956.x K¨ onyves, V., Andr´ e, P., Men’shchikov, A., et al. 2015, A&A, 584, A91, doi: 10.1051/0004-6361/201525861
2009
-
[27]
2001, MNRAS, 322, 231, doi: 10.1046/j.1365-8711.2001.04022.x
Kroupa, P. 2001, MNRAS, 322, 231, doi: 10.1046/j.1365-8711.2001.04022.x
2001
-
[28]
2026, in Encyclopedia of Astrophysics, Volume 2, Vol
Kroupa, P., Gjergo, E., Jerabkova, T., & Yan, Z. 2026, in Encyclopedia of Astrophysics, Volume 2, Vol. 2, 173–210, doi: 10.1016/B978-0-443-21439-4.00035-3
2026 doi
-
[29]
2003, ApJ, 598, 1076, doi: 10.1086/379105
Kroupa, P., & Weidner, C. 2003, ApJ, 598, 1076, doi: 10.1086/379105
2003 doi
-
[30]
2013, in Planets, Stars and Stellar Systems
Kroupa, P., Weidner, C., Pflamm-Altenburg, J., et al. 2013, in Planets, Stars and Stellar Systems. Volume 5: Galactic Structure and Stellar Populations, ed. T. D. Oswalt & G. Gilmore, Vol. 5 (Springer, Dordrecht), 115, doi: 10.1007/978-94-007-5612-0 4
2013 doi
-
[31]
R., Fumagalli, M., da Silva, R
Krumholz, M. R., Fumagalli, M., da Silva, R. L., Rendahl, T., & Parra, J. 2015, MNRAS, 452, 1447, doi: 10.1093/mnras/stv1374
2015 doi
-
[32]
J., & Lada, E
Lada, C. J., & Lada, E. A. 2003, ARA&A, 41, 57, doi: 10.1146/annurev.astro.41.011802.094844
2003 arXiv
-
[33]
F., & Offner, S
McKee, C. F., & Offner, S. S. R. 2010, ApJ, 716, 167, doi: 10.1088/0004-637X/716/1/167
2010 doi
- [34]
- [35]
-
[36]
1998, A&A, 336, 150
Motte, F., Andre, P., & Neri, R. 1998, A&A, 336, 150
1998
-
[37]
2022, A&A, 662, A8, doi: 10.1051/0004-6361/202141677
Motte, F., Bontemps, S., Csengeri, T., et al. 2022, A&A, 662, A8, doi: 10.1051/0004-6361/202141677
2022 doi
-
[38]
Myers, P. C. 2014, ApJ, 781, 33, doi: 10.1088/0004-637X/781/1/33
2014 doi
-
[39]
Offner, S. S. R., Klein, R. I., McKee, C. F., & Krumholz, M. R. 2009, ApJ, 703, 131, doi: 10.1088/0004-637X/703/1/131
2009 doi
-
[40]
Offner, S. S. R., & McKee, C. F. 2011, ApJ, 736, 53, doi: 10.1088/0004-637X/736/1/53
2011 doi
- [41]
-
[42]
2002, ApJ, 576, 870, doi: 10.1086/341790
Padoan, P., & Nordlund, ˚A. 2002, ApJ, 576, 870, doi: 10.1086/341790
2002 doi
-
[43]
2011, ApJL, 741, L22, doi: 10.1088/2041-8205/741/1/L22
Padoan, P., & Nordlund, ˚A. 2011, ApJL, 741, L22, doi: 10.1088/2041-8205/741/1/L22
2011 doi
-
[44]
Padoan, P., Nordlund, A., & Jones, B. J. T. 1997, MNRAS, 288, 145, doi: 10.1093/mnras/288.1.145
1997 doi
-
[45]
Palla, F., & Stahler, S. W. 1999, ApJ, 525, 772, doi: 10.1086/307928
1999 doi
-
[46]
Palla, F., & Stahler, S. W. 2000, ApJ, 540, 255, doi: 10.1086/309312 Portegies Zwart, S. F., McMillan, S. L. W., & Gieles, M. 2010, ARA&A, 48, 431, doi: 10.1146/annurev-astro-081309-130834
2000 doi
- [47]
-
[48]
Richardson, T., Ginsburg, A., & Koposov, S. E. 2026, Zenodo, doi: 10.5281/ZENODO.21313299
2026 doi
-
[49]
2025, ApJ, 989, 95, doi: 10.3847/1538-4357/ade99d
Richardson, T., Ginsburg, A., Rosolowsky, E., Peltonen, J., & Indebetouw, R. 2025, ApJ, 989, 95, doi: 10.3847/1538-4357/ade99d
2025 doi
-
[50]
Rosen, A. L. 2026, arXiv e-prints, arXiv:2603.15779, doi: 10.48550/arXiv.2603.15779
2026 doi
-
[51]
Salpeter, E. E. 1955, ApJ, 121, 161, doi: 10.1086/145971 18
1955 doi
-
[52]
Schneider, F. R. N., Sana, H., Evans, C. J., et al. 2018, Science, 359, 69, doi: 10.1126/science.aan0106
2018 doi
-
[53]
2015, A&A, 582, A93, doi: 10.1051/0004-6361/201425296
Schulz, C., Pflamm-Altenburg, J., & Kroupa, P. 2015, A&A, 582, A93, doi: 10.1051/0004-6361/201425296
2015 doi
-
[54]
Shu, F. H. 1977, ApJ, 214, 488, doi: 10.1086/155274
1977 doi
-
[55]
S., & Dav´ e, R
Somerville, R. S., & Dav´ e, R. 2015, ARA&A, 53, 51, doi: 10.1146/annurev-astro-082812-140951
2015 doi
-
[56]
D., Garmany, C
Vacca, W. D., Garmany, C. D., & Shull, J. M. 1996, ApJ, 460, 914, doi: 10.1086/177020
1996 doi
-
[57]
E., et al
Virtanen, P., Gommers, R., Oliphant, T. E., et al. 2020, Nature Methods, 17, 261, doi: 10.1038/s41592-019-0686-2
2020 doi
-
[58]
M., Johnson, L
Wainer, T. M., Johnson, L. C., Seth, A. C., et al. 2022, ApJ, 928, 15, doi: 10.3847/1538-4357/ac51cf
2022 doi
-
[59]
2006, MNRAS, 365, 1333, doi: 10.1111/j.1365-2966.2005.09824.x
Weidner, C., & Kroupa, P. 2006, MNRAS, 365, 1333, doi: 10.1111/j.1365-2966.2005.09824.x
2006
-
[60]
2017, A&A, 607, A126, doi: 10.1051/0004-6361/201730987
Yan, Z., Jerabkova, T., & Kroupa, P. 2017, A&A, 607, A126, doi: 10.1051/0004-6361/201730987
2017 doi
Reviewed August 1, 2026 · model on record in the stance chip above.
Discussion (0). Sign in to comment.