Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with the arguments of the dump_callback function #80

Closed
bthoven opened this issue Feb 1, 2017 · 3 comments
Closed

Issue with the arguments of the dump_callback function #80

bthoven opened this issue Feb 1, 2017 · 3 comments

Comments

@bthoven
Copy link

bthoven commented Feb 1, 2017

Hi,

I'm trying to use the following callback function to watch the progress of pymultinest.run (I got it from the issue #18):

def progress(nsamples, nlive, n, *args):
    print 'python dumper callback called!'
    sys.stdout.flush()
    print nsamples, nlive, n
    sys.stdout.flush()

However, when I try to run the code I get this error:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 315, in 'calling callback function'
  File "/home/thoven/Programs/miniconda2/lib/python2.7/site-packages/pymultinest/run.py", line 225, in dumper
    (pc[0,:],pc[1,:],pc[2,:],pc[3,:]), # (mean,std,bestfit,map)
IndexError: index 2 is out of bounds for axis 0 with size 2

The code snippet in run.py referenced by the error message above is:

220             pc =  as_array(paramConstr,shape=(nPar,4))
221
222             dump_callback(nSamples,nlive,nPar,
223                 as_array(physLive,shape=(nPar+1,nlive)).T,
224                 as_array(posterior,shape=(nPar+2,nSamples)).T,
225                 (pc[0,:],pc[1,:],pc[2,:],pc[3,:]), # (mean,std,bestfit,map)
226                 maxLogLike,logZ,logZerr)

If I understood it correctly, pc is an array of shape (number of params, 4), but line 225 attempts to access it as if it were its transpose. Is this a bug in the code? Or I'm missing something?

Thanks.

PS: The version of PyMultiNest is 2.1.

@JohannesBuchner
Copy link
Owner

Hi @bthoven,

it is quite possible that this functionality has bugs. It is largely untested. If you put in some print statements you can explore what is actually being passed.

Johannes

@JohannesBuchner
Copy link
Owner

Please reopen if you still have issues.

@JohannesBuchner
Copy link
Owner

see also #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants