question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v3.0.0dev0 blobs failing when different shapes

See original GitHub issue

General 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:closed
  • Created 5 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sibirrercommented, Jul 11, 2020
0reactions
alessiospuriomancinicommented, Jul 11, 2020

Thanks so much @sibirrer. Just to clarify: you use the script multiprocessing.py within some script for emcee, to directly run using emcee without going through CosmoHammer?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found