exoplanet-dev / exoplanet

Fast & scalable MCMC for all your exoplanet needs!
https://docs.exoplanet.codes
MIT License
206 stars 52 forks source link

Couldn't plot the corner plot as tutorials showed. #228

Closed xylm2021 closed 3 years ago

xylm2021 commented 3 years ago

I just installed this package and went through the commands in the tutorial 'A quick intro to PyMC3' https://docs.exoplanet.codes/en/latest/tutorials/intro-to-pymc3/. Every step seems running smoothly except the last step which is the corner plot. The message is 'TypeError: cannot perform reduce with flexible type'.

Below is the specific output:

>   ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call last)
> <ipython-input-7-4b4a51e8a350> in <module>
>       1 import corner
>       2 
> ----> 3 _ = corner.corner(
>       4     trace,
>       5     truths=dict(m=true_m, b=true_b, logs=true_logs),
> 
> ~/.local/lib/python3.8/site-packages/corner/corner.py in corner(xs, bins, range, weights, color, hist_bin_factor, smooth, smooth1d, labels, label_kwargs, titles, show_titles, title_fmt, title_kwargs, truths, truth_color, scale_hist, quantiles, verbose, fig, max_n_ticks, top_ticks, use_math_text, reverse, labelpad, hist_kwargs, **hist2d_kwargs)
>     212             range = hist2d_kwargs.pop("extents")
>     213         else:
> --> 214             range = [[x.min(), x.max()] for x in xs]
>     215             # Check for parameters that never change.
>     216             m = np.array([e[0] == e[1] for e in range], dtype=bool)
> 
> ~/.local/lib/python3.8/site-packages/corner/corner.py in <listcomp>(.0)
>     212             range = hist2d_kwargs.pop("extents")
>     213         else:
> --> 214             range = [[x.min(), x.max()] for x in xs]
>     215             # Check for parameters that never change.
>     216             m = np.array([e[0] == e[1] for e in range], dtype=bool)
> 
> ~/.local/lib/python3.8/site-packages/numpy/core/_methods.py in _amin(a, axis, out, keepdims, initial, where)
>      41 def _amin(a, axis=None, out=None, keepdims=False,
>      42           initial=_NoValue, where=True):
> ---> 43     return umr_minimum(a, axis, None, out, keepdims, initial, where)
>      44 
>      45 def _sum(a, axis=None, dtype=None, out=None, keepdims=False,
> 
> TypeError: cannot perform reduce with flexible type

My setup is: Version of exoplanet: 0.5.1. Version of the corner: 2.1.0 Operating system: Ubuntu 20.04. Python version & installation method: 3.8.10 and is the default python version in the system.

dfm commented 3 years ago

@xylm2021: You'll need to update corner to version >=2.2.0 to get support for ArviZ traces.

xylm2021 commented 3 years ago

@xylm2021: You'll need to update corner to version >=2.2.0 to get support for ArviZ traces.

Thanks, it works.