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

nessai test suite fails with corner 2.2.2 #297

Closed
duncanmmacleod opened this issue Apr 13, 2023 · 0 comments · Fixed by #298
Closed

nessai test suite fails with corner 2.2.2 #297

duncanmmacleod opened this issue Apr 13, 2023 · 0 comments · Fixed by #298
Labels
bug Something isn't working

Comments

@duncanmmacleod
Copy link

Describe the bug

The test suite fails when corner 2.2.2 is included in the test environment:

$ python -m pytest tests/test_plot.py -x
======================================== test session starts =========================================
platform linux -- Python 3.11.3, pytest-7.3.0, pluggy-1.0.0
rootdir: /home/duncan/git/nessai
configfile: pyproject.toml
plugins: cov-4.0.0
collected 75 items

tests/test_plot.py .......................................................F

============================================== FAILURES ==============================================
__________________________________________ test_corner_plot __________________________________________

live_points = array([(-4.65345777,  0.96432746, nan, nan, 0),
       (-2.21440385,  4.9681729 , nan, nan, 0),
       ( 1.67006296,  ... -3.00372179, nan, nan, 0)],
      dtype=[('x', '<f8'), ('y', '<f8'), ('logP', '<f8'), ('logL', '<f8'), ('it', '<i4')])

    def test_corner_plot(live_points):
        """Test the corner plot."""
>       fig = plot.corner_plot(live_points)

tests/test_plot.py:446:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nessai/plot.py:58: in wrapper
    return func(*args, **kwargs)
nessai/plot.py:634: in corner_plot
    fig = corner.corner(
../../opt/mambaforge/envs/nessai/lib/python3.11/site-packages/corner/corner.py:280: in corner
    return arviz_corner(
../../opt/mambaforge/envs/nessai/lib/python3.11/site-packages/corner/arviz_corner.py:136: in arviz_corner
    fig = corner_impl(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

xs = array([[-4.65345777,  0.96432746],
       [-2.21440385,  4.9681729 ],
       [ 1.67006296,  3.63502087],
       [ 1.55... 0.03564489],
       [ 3.90688656, -2.11997105],
       [-4.1205496 ,  4.93055757],
       [ 0.96344951, -3.00372179]])
bins = 32, range = None, axes_scale = 'linear', weights = None, color = '#02979d', hist_bin_factor = 1
smooth = 0.9, smooth1d = None, labels = array(['x', 'y'], dtype='<U4'), label_kwargs = {}
titles = array(['x', 'y'], dtype='<U4'), show_titles = True, title_fmt = '.2f', title_kwargs = {}
truths = None, truth_color = '#f5b754', scale_hist = False, quantiles = [0.16, 0.84]
title_quantiles = [0.16, 0.84], verbose = False, fig = None, max_n_ticks = 5, top_ticks = False
use_math_text = False, reverse = False, labelpad = 0.0, hist_kwargs = {'density': True}
hist2d_kwargs = {'fill_contours': True, 'levels': (0.3934693402873666, 0.8646647167633873, 0.9888910034617577), 'plot_datapoints': True, 'plot_density': True}

    def corner_impl(
        xs,
        bins=20,
        range=None,
        axes_scale="linear",
        weights=None,
        color=None,
        hist_bin_factor=1,
        smooth=None,
        smooth1d=None,
        labels=None,
        label_kwargs=None,
        titles=None,
        show_titles=False,
        title_fmt=".2f",
        title_kwargs=None,
        truths=None,
        truth_color="#4682b4",
        scale_hist=False,
        quantiles=None,
        title_quantiles=None,
        verbose=False,
        fig=None,
        max_n_ticks=5,
        top_ticks=False,
        use_math_text=False,
        reverse=False,
        labelpad=0.0,
        hist_kwargs=None,
        **hist2d_kwargs,
    ):
        if quantiles is None:
            quantiles = []
        if title_kwargs is None:
            title_kwargs = dict()
        if label_kwargs is None:
            label_kwargs = dict()

        # If no separate titles are set, copy the axis labels
        if titles is None:
            titles = labels

        # deal with title quantiles so they much quantiles unless desired otherwise
        if title_quantiles is None:
            if len(quantiles) > 0:
                title_quantiles = quantiles
            else:
                # a default for when quantiles not supplied.
                title_quantiles = [0.16, 0.5, 0.84]

        if show_titles and len(title_quantiles) != 3:
>           raise ValueError(
                "'title_quantiles' must contain exactly three values; "
                "pass a length-3 list or array using the 'title_quantiles' argument"
            )
E           ValueError: 'title_quantiles' must contain exactly three values; pass a length-3 list or array using the 'title_quantiles' argument

../../opt/mambaforge/envs/nessai/lib/python3.11/site-packages/corner/core.py:83: ValueError

I believe the incompatibility was introduced by dfm/corner.py#193.

To Reproduce

mamba create -n nessai python=3.11 corner=2.2.2 nessai=0.8.0 pytest pytest-cov
conda activate nessai
python -m pytest tests/test_plot.py -x

Expected behaviour

The tests pass

Screenshots

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant