Skip to content

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

@regislachaume

Description

@regislachaume

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions