baudren / montepython_public

Public repository for the Monte Python Code
MIT License
65 stars 116 forks source link

Importance Sampling with New Likelihood #59

Closed borisbolliet closed 8 years ago

borisbolliet commented 8 years ago

Dear All,

I would like to use the importance sampling (IS) method with a personal experiment. Everything works fine for the metropolis hasting sampler, however when I am using IS I get the following error message:

 -> reading  COM_CosmoParams_fullGrid_R2.00/base_w/plikHM_TT_lowTEB__4.txt

Exception in thread Thread-3:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 380, in _handle_results
    task = get()
TypeError: ('__init__() takes exactly 2 arguments (1 given)', <class 'io_mp.CosmologicalModuleError'>, ())

If any one is familiar with this issue I would be glad to hear what can be going wrong. Thank you very much,

Boris

nbellomo commented 8 years ago

Hello Boris, I had the same problem months ago. According to what I understood (but I'm not an expert in these topics), when you run a program on a cluster there are arguments of functions that have to be specified even if you usually don't do it. In the class MyError(Exception): of the io_mp.py module, I have substituted the line Exception.__init__(self) with Exception.__init__(self, message). In this way the code didn't complain anymore that one argument was missing. Hope it helps, Nicola

borisbolliet commented 8 years ago

Dear Nicola,

Thank you very much, this fixed the problem. It does not seem to be a problem that occurs on a cluster because i am also getting this error message on my laptop.

It is certainly due to the fact that I am using a new likelihood that I made myself, apparently, without doin the error message management proberly.

What is strange though, is that I get this problem only when I use the -m IS option.

Thank you again,

Boris