Bug in luminosity calculations affecting pynbody v2.0.0 to v2.1.2

1 view
Skip to first unread message

PONTZEN, ANDREW P.

unread,
Jun 10, 2025, 11:05:49 AMJun 10
to pynbody-users
Dear all,

I’m writing to alert you to a significant bug in pynbody v2.0.0 (released Dec 2024) through to v2.1.2. It is fixed in v2.1.3 (released today, 10 June 2025).

What is the bug and its impact?

The issue is in the interpolation from stellar ages and metallicities into luminosities. In the version range above, these erroneously mapped most stars onto results for super-solar metallicities. The size of the resulting changes is around 10% for old star particles, but can be up to a factor of 3 in luminosity (up to 1.2 magnitudes) for star particles less than 30 Myr old.  Thanks to Martin Rey for catching and fixing this; the new version is already available on pypi (pip install -U pynbody to update). 


Recommendation

If you’ve published or are planning to publish results using affected versions (2.0.0 to 2.1.2), consider re-running key analyses with pynbody version 2.1.3 or later.


How did this happen and how will we make sure similar bugs don't happen again?

While the cases where this makes a major impact should be quite limited, I want to apologise to anyone whose science analysis may have been affected.

Pynbody has for many years had a significant test suite, which should catch issues like this and keep it reliable. What happened in this case is that the SSP tables were updated simultaneously with updating the interpolation code. Because the changes in the tabulated values were comparable in magnitude to the changes induced by the bug, I attributed the changing results fully to the updated SSP tables rather than dig deeper. There is now a test specifically for the accuracy of metallicity interpolation. More generally, in future, I’ll be more careful not to make two changes at once, which should guard against shadowing bugs in this way.


If you have any further questions please feel free to reach out.

All the best,

Andrew


Reply all
Reply to author
Forward
0 new messages