Closed pierre-guillou closed 19 hours ago
I added those line in core.py if not ncr: raise ValueError("ncr est vide.") if l >= len(pcr): raise IndexError("Index l est en dehors des limites de pcr.") if np.isnan(pcr[l]).any(): raise ValueError("pcr[l] contient des valeurs NaN.") if not np.isclose(sum(pcr[l]), 1): raise ValueError("Les probabilités dans pcr[l] ne sont pas normalisées.")
I have python 3.11.4 and don't have any errors raised when executing demoPyheatmy.ipynb @pierre-guillou Maybe you can test it again with the CI (I add an issue) so we can have more explainations. I suspect this is linked to DREAMS. I open 2 new issues one for the CI and one for DREAM
lines added in core.py 1021-1028
There seems to be a stability issue with pyheatmy/core.py around line 1022 in
np.random.choice(ncr, p=pcr[l])
,pcr[l]
sometimes contains NaNs that makenp.random.choice
raiseValueError: probabilities contain NaN
.This issue has been noticed when running
demoPyheatmy.ipynb
under the GitHub Actions workflow (c.f. #80).An additional check should be added somewhere in the function to ensure that NaN value are properly handled: should we replace them with 0? should we skip the corresponding for loop iteration?