[Python] what may be the reason of RuntimeWarning: invalid value encountered in scalar...

Discussão em 'Python' iniciado por Stack, Junho 30, 2025.

  1. Stack

    Stack Membro Participativo

    I am usign a large library feeding it with the measured data. Logs show that in some cases there is some error/warning message and shows the line in which this warning occurs.

    Warning:


    .../MLE_funcs.py:4682: RuntimeWarning: invalid value encountered in scalar multiply
    ​

    Here it is:

    y = (np.pi/2) * x * np.exp(-np.pi*(x**2)/4)


    Why this warning can appear if x is always given and it's numeric (sometimes it's a numpy array but it should work in any case.. Any suggestions?

    Or maybe you can suggest how to catch that warning to log the issue in more details?

    Continue reading...

Compartilhe esta Página