Skip to content

Pymultinest `outputfiles_basename` too long

I'm getting this error associated with the usual nuisance of multinest cutting off the filenames if the outputfiles_basename is too long:

  File "/home/sylvia.biscoveanu/GRB_git/call_tupak_grb.py", line 83, in <module>
    main(int(sys.argv[1]), sys.argv[2], sys.argv[3], sys.argv[4])
  File "/home/sylvia.biscoveanu/GRB_git/call_tupak_grb.py", line 72, in main
    evidence_tolerance=0.05, outdir=outdir, label=label, clean=True)
  File "/home/sylvia.biscoveanu/.local/lib/python2.7/site-packages/tupak-0.2.2-py2.7.egg/tupak/core/sampler/__init__.py", line 146, in run_sampler
    result = sampler._run_external_sampler()
  File "/home/sylvia.biscoveanu/.local/lib/python2.7/site-packages/tupak-0.2.2-py2.7.egg/tupak/core/sampler/pymultinest.py", line 61, in _run_external_sampler
    n_dims=self.ndim, **self.kwargs)
  File "/home/sylvia.biscoveanu/.local/lib/python2.7/site-packages/pymultinest/solve.py", line 74, in solve
    samples = analyzer.get_equal_weighted_posterior()[:,:-1]
  File "/home/sylvia.biscoveanu/.local/lib/python2.7/site-packages/pymultinest/analyse.py", line 66, in get_equal_weighted_posterior
    self.equal_weighted_posterior = loadtxt2d(self.equal_weighted_file)
  File "/home/sylvia.biscoveanu/.local/lib/python2.7/site-packages/pymultinest/analyse.py", line 10, in loadtxt2d
    return numpy.loadtxt(intext)
  File "/home/sylvia.biscoveanu/.local/lib/python2.7/site-packages/numpy/lib/npyio.py", line 896, in loadtxt
    fh = iter(open(fname, 'U'))
IOError: [Errno 2] No such file or directory: u'/home/sylvia.biscoveanu/GRB_git/outdir/pymultinest_sgrb_0_sample_prior_topHatUniformElse/post_equal_weights.dat'

Can we workshop some way around this? I'm running on condor so I need to specify the full file path. I tried changing the call in _run_external_sampler to pymultinest.run instead of pymultinest.solve but I'm getting an error with the prior, which confuses me because the pymultinest source code seems to invoke the prior in the same way between the two functions.

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 314, in 'calling callback function'
  File "/home/sylvia.biscoveanu/.local/lib/python2.7/site-packages/pymultinest/run.py", line 210, in loglike
    Prior(cube, ndim, nparams)
TypeError: prior_transform() takes exactly 2 arguments (4 given)

If we fixed this error with the prior, we could write our own version of the multinest analyzer to load the posterior samples and the evidences. There has to be a way around this... it's frustrating not to be able to use a sampler because the file paths are too long. I think @colm.talbot was having issues with this earlier as well.