Git Product home page Git Product logo

Comments (6)

fjosw avatar fjosw commented on July 28, 2024

I last change to Corr.m_eff appears to have happened 5 months ago, what version did you use before and can you provide a minimal example for the error you are seeing?

from pyerrors.

JanNeuendorf avatar JanNeuendorf commented on July 28, 2024

I do not know, which version the script was previously running on. I think it was the first 2.0 release.
I have a correlator, which has values up to a certain timeslice and is then set to zero.
So you can see, where the problem occurs.
The error is:

m_eff=corr.m_eff(variant="cosh")
File "/usr/local/lib/python3.8/site-packages/pyerrors/correlators.py", line 631, in m_eff
newcontent.append(np.abs(find_root(self.content[t][0] / self.content[t + 1][0], root_function, guess=guess)))
File "/usr/local/lib/python3.8/site-packages/pyerrors/obs.py", line 744, in truediv
return derived_observable(lambda x, **kwargs: x[0] / x[1], [self, y], man_grad=[1 / y.value, - self.value / y.value ** 2])
ZeroDivisionError: float division by zero

from pyerrors.

JanNeuendorf avatar JanNeuendorf commented on July 28, 2024

Would you mind, if i change this?

from pyerrors.

fjosw avatar fjosw commented on July 28, 2024

Ah okay, I understand the problem, and there should be an easy fix, but I do not understand why it did not appear in earlier versions. I think we never explicitly checked whether the denominator is zero.

from pyerrors.

fjosw avatar fjosw commented on July 28, 2024

Feel free to fix this. A general way including other kind of arithmetic errors might be to check for an ArithmeticError

try:
    newcontent.append(self.content[t] / self.content[t + 1])
except ArithmeticError:
    newcontent.append(None)

from pyerrors.

JanNeuendorf avatar JanNeuendorf commented on July 28, 2024

Yes, you are right, we only checked for None not for zero. So maybe something that i did to the correlator with the previous version set it to None on these timeslices, but this behaviour changed. We might never know.

from pyerrors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.