v3.0.0dev0 blobs failing when different shapes
See original GitHub issueGeneral information:
- emcee version: v3.0.0dev0
- platform: any
- installation method (pip/conda/source/other?): any
Problem description:
Expected behavior:
I expect that returning blobs of various shapes should work.
Actual behavior:
An error is raised: ValueError: setting an array element with a sequence.
What have you tried so far?:
When passing blobs_dtype with shapes for each returned blob, it works fine.
Minimal example:
import emcee
import numpy as np
def lnl(p):
return p[0], 1.0, np.array([1,2,3])
sampler = emcee.EnsembleSampler(
nwalkers = 10,
ndim = 2,
log_prob_fn = lnl
)
p0 = np.random.normal(size=(10,2))
for sample in sampler.sample(p0, iterations=10):
continue
The offending line is L394 of ensemble.py: dt = np.atleast_1d(blob[0]).dtype. This will work as intended (I think), if it is instead: dt = [(np.atleast_1d(b).dtype, np.atleast_1d(b).shape) for b in blob[0]], though there might need to be a check for 1-dimensional arrays.
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Azure Blob Storage error codes - Microsoft Learn
Error code HTTP status code User message
BlobAlreadyExists Conflict (409) The specified blob already exists.
BlobNotFound Not Found (404) The specified blob does not exist.
ContainerAlreadyExists...
Read more >The Python ensemble sampling toolkit for affine-invariant MCMC
Can ensemble samplers be used in both/all phases of a Gibbs step? ... v3.0.0dev0 blobs failing when different shapes. General information:.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

yes @alessiospuriomancini, for example here: https://github.com/sibirrer/lenstronomy/blob/master/lenstronomy/Sampling/sampler.py in definition mcmc_emcee()
Thanks so much @sibirrer. Just to clarify: you use the script
multiprocessing.pywithin some script for emcee, to directly run using emcee without going through CosmoHammer?