Skip to content

Having title_quantiles=None when quantiles is passed without having exactly 3 elements raises a ValueError #237

Open
@sybreton

Description

@sybreton

Hi,

The behaviour of the title_quantiles argument that was introduced in v2.2.2 is responsible for a crash when using the following set of arguments:
show_titles=True, title_quantiles=None
and a list for quantiles that has a number of elements other than 3. In this case, according to what is written in the documentation, the value for title_quantiles is set as what is passed for quantiles, and a ValueError is raised.

In particular, this is an issue for compatibility with codes that were running with corner versions older than v2.2.2.

The error can be reproduced by slightly modifying the code from the Getting started tutorial (https://corner.readthedocs.io/en/latest/pages/quickstart/):

import corner
import numpy as np

ndim, nsamples = 2, 10000
np.random.seed(42)
samples = np.random.randn(ndim * nsamples).reshape([nsamples, ndim])
figure = corner.corner(samples, quantiles=[0.16, 0.84], 
                       show_titles=True, title_quantiles=None)

Running this code, the following error is raised:
ValueError: 'title_quantiles' must contain exactly three values; pass a length-3 list or array using the 'title_quantiles' argument

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions