LoLab-MSM / PyDREAM

MT-DREAM(ZS) algorithm for model optimization, calibration, selection
GNU General Public License v3.0
49 stars 33 forks source link

run_dream fails if start keyword is given a 2D numpy array instead of a list of 1D arrays #10

Open regislachaume opened 4 years ago

regislachaume commented 4 years ago

The code is comparing to None with the operators == and != instead of the correct (and more efficient) pythonic idiom is or is not. Thus, an if clause fails on a numpy array because ==and != operate elementwise, while is and is not return a scalar bool

The lines that require modifications are

regis@gatito ~/git/CO-Ori-VLTI % for file in /usr/local/lib/python3.7/dist-packages/pydream/*.py; do echo $file; egrep -n '[!=]=\s*None' $file; done 
/usr/local/lib/python3.7/dist-packages/pydream/convergence.py
/usr/local/lib/python3.7/dist-packages/pydream/core.py
43:        if start == None:
218:                #On first iteration without starting points this will fail because q0 == None
284:    if step_instance.crossover_burnin == None:
287:    if start_pt != None:
/usr/local/lib/python3.7/dist-packages/pydream/Dream.py
158:        if self.nseedchains == None:
227:            if last_loglike != None:
253:            if self.last_logp == None:
421:        if self.nchains == None:
425:        if self.chain_n == None:
/usr/local/lib/python3.7/dist-packages/pydream/Dream_shared_vars.py
/usr/local/lib/python3.7/dist-packages/pydream/__init__.py
/usr/local/lib/python3.7/dist-packages/pydream/model.py
/usr/local/lib/python3.7/dist-packages/pydream/parameters.py