Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truth value of an array is ambiguous in demcz.py #310

Open
Richteny opened this issue Sep 13, 2023 · 1 comment
Open

Truth value of an array is ambiguous in demcz.py #310

Richteny opened this issue Sep 13, 2023 · 1 comment

Comments

@Richteny
Copy link

Hi,

I am trying to run the differential evolution Markov Chain in a cluster environment coupled to a dask-parallelised model.
I am running 5 DEMCZ Chains in Parallel, but I do not allow for any MPI parallelisation. My idea was that it runs each chain after another but after 25 successful simulations, my model setup crashes with the error code:

Traceback (most recent call last):
File "/data/scratch/richteny/thesis/cosipy_test_space/spotpy_multobj_full.py", line 199, in
mcmc = psample(obs=(tsla_obs,geod_ref), count=1, rep=10000, algorithm='demcz')
File "/data/scratch/richteny/thesis/cosipy_test_space/spotpy_multobj_full.py", line 196, in psample
sampler.sample(rep, nChains=5)
File "/home/richteny/miniconda3/envs/cspy/lib/python3.10/site-packages/spotpy/algorithms/demcz.py", line 295, in sample
if decisions[curchain]:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Do you have any idea why this happens?
Since the coupled model setup is quite intensive, it's difficult for me to provide an example.
I am using numpy==1.23.5 and spotpy==1.6.2

Thank you very much!

@philippkraft
Copy link
Collaborator

decisions should be a 1D numpy array of bool and curchain an int. It seems that for some reason this is not the case. Can you check the types in a debugger? I would suggest to test this in a simpler setup - smaller model, sequential chains and see if the error is still there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants