Giter Site home page Giter Site logo

Comments (9)

JohannesBuchner avatar JohannesBuchner commented on July 26, 2024

Thank you for the report.
Another solution would be to pass a lambda function that calls the method.

from pymultinest.

jtlz2 avatar jtlz2 commented on July 26, 2024

@timothydmorton Would you mind posting your fix?

from pymultinest.

timothydmorton avatar timothydmorton commented on July 26, 2024

line 191 of the current run.py I changed to:

if nargs == 4 and not inspect.ismethod(LogLikelihood):

This is crude because it ignores the current purpose of this test, which is presumably to test whether lnew is passed, but that's the idea. A more complete fix would first test whether LogLikelihood is a method and then would test nargs (3 vs. 4 or 4 vs. 5 depending on whether it's a method).

from pymultinest.

JohannesBuchner avatar JohannesBuchner commented on July 26, 2024

You pass myobject.LogLikelihood not MyClass.LogLikelihood to run(), right?

It is strange that python treats methods differently. I expected if you pass myobject.LogLikelihood, that it acts just like a function which calls MyClass.LogLikelihood with additionally myobject as the first parameter.

from pymultinest.

JohannesBuchner avatar JohannesBuchner commented on July 26, 2024

Would

 nargs = len(inspect.getargspec(LogLikelihood).args) - inspect.ismethod(LogLikelihood)

also work? (line 187)

from pymultinest.

timothydmorton avatar timothydmorton commented on July 26, 2024

right, I'm passing myobject.LogLikelihood. Also, I just made that pull request for a quick fix, but didn't test it. I don't actually know whether it's a generally acceptable solution or not.

from pymultinest.

timothydmorton avatar timothydmorton commented on July 26, 2024

yes, that sounds like a much cleaner fix, and should work the same.

from pymultinest.

JohannesBuchner avatar JohannesBuchner commented on July 26, 2024

Hey,
I just released an update to PyMultiNest, which includes a fix to this problem. Could you upgrade and test it?
Thank you, Johannes

from pymultinest.

JohannesBuchner avatar JohannesBuchner commented on July 26, 2024

Closing, I think this is fixed.

from pymultinest.

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.