nuclear-multimessenger-astronomy / nmma

A pythonic library for probing nuclear physics and cosmology with multimessenger analysis
https://nuclear-multimessenger-astronomy.github.io/nmma/
GNU General Public License v3.0
33 stars 58 forks source link

Pymultinest error with missing positional argument 'lnew' #149

Closed bking-astro closed 1 year ago

bking-astro commented 1 year ago

Traceback (most recent call last): File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/pymultinest/run.py", line 221, in loglike return LogLikelihood(cube, ndim, nparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: solve..SafeLoglikelihood() missing 1 required positional argument: 'lnew' Exception ignored on calling ctypes callback function: <function run..loglike at 0x7f3424eeea20>

Describe the bug When I run light_curve_analysis with the command below and the outdir doesn't exist, I get the error above. Then the command fails with the error below:

To Reproduce Steps to reproduce the behavior:

  1. Download Michael's trained model on LANL files

  2. Run command: light_curve_analysis --model LANL2022 --svd-path /lustre/scratch4/turquoise/bking/nmma_test/svdmodels/ --filters 2massh,2massj,2massks,atlasc,atlaso,bessellb,besselli,bessellr,bessellux,bessellv,ps1g,ps1i,ps1r,ps1y,ps1z,sdssu,uvotb,uvotu,uvotuvm2,uvotuvw1,uvotuvw2,uvotv,uvotwhite,ztfg,ztfi,ztfr --verbose --local-only --interpolation_type sklearn_gp --outdir /lustre/scratch4/turquoise/bking/nmma_test/outdir/LANLTP1 --label TP1 --prior /lustre/scratch4/turquoise/bking/nmma_test/nmma/priors/LANL2022.prior --tmin 0. --tmax 21 --dt 0.1 --error-budget 1 --nlive 512 --Ebv-max 0 --trigger-time 59397.28347219899 --injection /lustre/scratch4/turquoise/bking/nmma_test/outdir/LANLTP1/injection.json --injection-num 0 --injection-outfile /lustre/scratch4/turquoise/bking/nmma_test/outdir/LANLTP1/lc.csv --generation-seed 42 --plot

  3. See error Traceback (most recent call last): File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/pymultinest/run.py", line 221, in loglike return LogLikelihood(cube, ndim, nparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: solve..SafeLoglikelihood() missing 1 required positional argument: 'lnew' Exception ignored on calling ctypes callback function: <function run..loglike at 0x7f3424eeea20>

(You see this many times)

Traceback (most recent call last): File "/usr/projects/nsmergers/conda_nmma/bin/light_curve_analysis", line 33, in sys.exit(load_entry_point('nmma==0.0.13', 'console_scripts', 'light_curve_analysis')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/nmma-0.0.13-py3.11.egg/nmma/em/analysis.py", line 592, in main result = bilby.run_sampler( ^^^^^^^^^^^^^^^^^^ File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/bilby/core/sampler/init.py", line 234, in run_sampler result = sampler.run_sampler() ^^^^^^^^^^^^^^^^^^^^^ File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/bilby/core/sampler/base_sampler.py", line 96, in wrapped output = method(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/bilby/core/sampler/pymultinest.py", line 156, in run_sampler out = pymultinest.solve( ^^^^^^^^^^^^^^^^^^ File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/pymultinest/solve.py", line 74, in solve stats = analyzer.get_stats() ^^^^^^^^^^^^^^^^^^^^ File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/pymultinest/analyse.py", line 123, in get_stats posterior = self.get_data() ^^^^^^^^^^^^^^^ File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/pymultinest/analyse.py", line 86, in get_data self.data = loadtxt2d(self.data_file) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/pymultinest/analyse.py", line 36, in loadtxt2d return numpy.loadtxt(intext) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/numpy/lib/npyio.py", line 1373, in loadtxt arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/projects/nsmergers/conda_nmma/lib/python3.11/site-packages/numpy/lib/npyio.py", line 1016, in _read arr = _load_from_filelike( ^^^^^^^^^^^^^^^^^^^^ ValueError: could not convert string '-0.557764778579776782-315' to float64 at row 0, column 2.

Platform information:

Additional context If I run with the flag --sampler dynesty I do not see this problem

mcoughlin commented 1 year ago

@tsunhopang Any ideas? pymultinest issue?

sahiljhawar commented 1 year ago

@bking-astro I used to get similar errors but it was mostly due to some incorrect initialisation or using same output dir as last garbage run, etc. But here I am curious to know about the location of injection input file, outputdir, and injection outfile. All three have same base path: /lustre/scratch4/turquoise/bking/nmma_test/outdir/LANLTP1. Shouldn't the path to your input inejction be one folder up relative to the output directory? Or it maybe anywhere else as well. But input can't be inside the folder which is not yet created. Or maybe I am missing something

tsunhopang commented 1 year ago

This problem found to be related to broken pymultinest installation