From 005ea8adeab0f0c1c9e0e52e569ed7b1de9d55de Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Mon, 25 Mar 2024 22:59:37 +0100 Subject: [PATCH 1/6] check cmaps aren't registered yet --- arviz/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arviz/__init__.py b/arviz/__init__.py index 0397e274e8..74b5cc6d6c 100644 --- a/arviz/__init__.py +++ b/arviz/__init__.py @@ -315,7 +315,8 @@ def _log( def _mpl_cm(name, colorlist): cmap = LinearSegmentedColormap.from_list(name, colorlist, N=256) - mpl.colormaps.register(cmap, name="cet_" + name) + if "cet_" + name not in mpl.colormaps(): + mpl.colormaps.register(cmap, name="cet_" + name) try: From 664af248a33b7e86b8105a6dfe4f03ca41fd739d Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Mon, 25 Mar 2024 23:09:07 +0100 Subject: [PATCH 2/6] black --- arviz/data/__init__.py | 1 + arviz/data/base.py | 1 + arviz/data/converters.py | 1 + arviz/data/datasets.py | 1 + arviz/data/inference_data.py | 31 +++++++++---------- arviz/data/io_cmdstan.py | 4 +-- arviz/data/io_datatree.py | 1 + arviz/data/io_dict.py | 5 ++- arviz/data/io_emcee.py | 1 + arviz/data/io_numpyro.py | 1 + arviz/data/io_pyjags.py | 1 + arviz/data/io_pyro.py | 1 + arviz/data/utils.py | 1 + arviz/plots/__init__.py | 1 + arviz/plots/autocorrplot.py | 1 + arviz/plots/backends/bokeh/autocorrplot.py | 1 + arviz/plots/backends/bokeh/bpvplot.py | 1 + arviz/plots/backends/bokeh/compareplot.py | 1 + arviz/plots/backends/bokeh/densityplot.py | 1 + arviz/plots/backends/bokeh/distplot.py | 1 + arviz/plots/backends/bokeh/dotplot.py | 1 + arviz/plots/backends/bokeh/ecdfplot.py | 1 + arviz/plots/backends/bokeh/elpdplot.py | 1 + arviz/plots/backends/bokeh/energyplot.py | 1 + arviz/plots/backends/bokeh/hdiplot.py | 1 + arviz/plots/backends/bokeh/khatplot.py | 1 + arviz/plots/backends/bokeh/lmplot.py | 1 + arviz/plots/backends/bokeh/loopitplot.py | 1 + arviz/plots/backends/bokeh/mcseplot.py | 1 + arviz/plots/backends/bokeh/pairplot.py | 1 + arviz/plots/backends/bokeh/parallelplot.py | 1 + arviz/plots/backends/bokeh/posteriorplot.py | 1 + arviz/plots/backends/bokeh/ppcplot.py | 1 + arviz/plots/backends/bokeh/rankplot.py | 1 + arviz/plots/backends/bokeh/separationplot.py | 1 + arviz/plots/backends/bokeh/traceplot.py | 1 + arviz/plots/backends/bokeh/violinplot.py | 1 + .../plots/backends/matplotlib/autocorrplot.py | 1 + arviz/plots/backends/matplotlib/bpvplot.py | 1 + .../plots/backends/matplotlib/compareplot.py | 1 + .../plots/backends/matplotlib/densityplot.py | 1 + .../backends/matplotlib/distcomparisonplot.py | 5 ++- arviz/plots/backends/matplotlib/distplot.py | 1 + arviz/plots/backends/matplotlib/dotplot.py | 1 + arviz/plots/backends/matplotlib/ecdfplot.py | 1 + arviz/plots/backends/matplotlib/elpdplot.py | 1 + arviz/plots/backends/matplotlib/energyplot.py | 1 + arviz/plots/backends/matplotlib/essplot.py | 11 ++++--- arviz/plots/backends/matplotlib/forestplot.py | 1 + arviz/plots/backends/matplotlib/hdiplot.py | 1 + arviz/plots/backends/matplotlib/kdeplot.py | 1 + arviz/plots/backends/matplotlib/khatplot.py | 1 + arviz/plots/backends/matplotlib/lmplot.py | 1 + arviz/plots/backends/matplotlib/loopitplot.py | 1 + arviz/plots/backends/matplotlib/mcseplot.py | 21 +++++++------ arviz/plots/backends/matplotlib/pairplot.py | 1 + .../plots/backends/matplotlib/parallelplot.py | 1 + .../backends/matplotlib/posteriorplot.py | 1 + arviz/plots/backends/matplotlib/ppcplot.py | 1 + arviz/plots/backends/matplotlib/rankplot.py | 1 + .../backends/matplotlib/separationplot.py | 1 + arviz/plots/backends/matplotlib/traceplot.py | 1 + arviz/plots/backends/matplotlib/tsplot.py | 1 + arviz/plots/backends/matplotlib/violinplot.py | 1 + arviz/plots/bpvplot.py | 1 + arviz/plots/compareplot.py | 1 + arviz/plots/densityplot.py | 1 + arviz/plots/distcomparisonplot.py | 1 + arviz/plots/dotplot.py | 1 + arviz/plots/ecdfplot.py | 1 + arviz/plots/elpdplot.py | 1 + arviz/plots/energyplot.py | 1 + arviz/plots/essplot.py | 1 + arviz/plots/forestplot.py | 1 + arviz/plots/hdiplot.py | 1 + arviz/plots/khatplot.py | 1 + arviz/plots/lmplot.py | 1 + arviz/plots/loopitplot.py | 1 + arviz/plots/mcseplot.py | 1 + arviz/plots/pairplot.py | 1 + arviz/plots/parallelplot.py | 1 + arviz/plots/plot_utils.py | 1 + arviz/plots/posteriorplot.py | 1 + arviz/plots/ppcplot.py | 1 + arviz/plots/rankplot.py | 1 + arviz/plots/separationplot.py | 1 + arviz/plots/traceplot.py | 1 + arviz/plots/tsplot.py | 1 + arviz/plots/violinplot.py | 1 + arviz/rcparams.py | 1 + arviz/sel_utils.py | 1 + arviz/stats/ecdf_utils.py | 1 + arviz/stats/stats_refitting.py | 1 + arviz/stats/stats_utils.py | 1 + arviz/tests/base_tests/test_diagnostics.py | 1 + .../base_tests/test_diagnostics_numba.py | 1 + arviz/tests/base_tests/test_labels.py | 1 + .../tests/base_tests/test_plots_matplotlib.py | 1 + arviz/tests/base_tests/test_stats_utils.py | 1 + arviz/tests/base_tests/test_utils.py | 1 + arviz/wrappers/__init__.py | 1 + examples/bokeh/bokeh_plot_autocorr.py | 1 + examples/bokeh/bokeh_plot_bpv.py | 1 + examples/bokeh/bokeh_plot_bpv_tstat.py | 1 + examples/bokeh/bokeh_plot_compare.py | 1 + examples/bokeh/bokeh_plot_density.py | 1 + examples/bokeh/bokeh_plot_density_single.py | 1 + examples/bokeh/bokeh_plot_dist.py | 1 + examples/bokeh/bokeh_plot_dot.py | 1 + examples/bokeh/bokeh_plot_ecdf.py | 1 + examples/bokeh/bokeh_plot_elpd.py | 1 + examples/bokeh/bokeh_plot_energy.py | 1 + examples/bokeh/bokeh_plot_ess_evolution.py | 1 + examples/bokeh/bokeh_plot_ess_local.py | 1 + examples/bokeh/bokeh_plot_ess_quantile.py | 1 + examples/bokeh/bokeh_plot_forest.py | 1 + .../bokeh/bokeh_plot_forest_comparison.py | 1 + examples/bokeh/bokeh_plot_forest_mixed.py | 1 + examples/bokeh/bokeh_plot_forest_ridge.py | 1 + examples/bokeh/bokeh_plot_hdi.py | 1 + examples/bokeh/bokeh_plot_joint.py | 1 + examples/bokeh/bokeh_plot_kde.py | 1 + examples/bokeh/bokeh_plot_kde_2d.py | 1 + examples/bokeh/bokeh_plot_kde_2d_hdi.py | 1 + examples/bokeh/bokeh_plot_kde_quantiles.py | 1 + examples/bokeh/bokeh_plot_khat.py | 1 + examples/bokeh/bokeh_plot_lm.py | 1 + examples/bokeh/bokeh_plot_loo_pit_ecdf.py | 1 + examples/bokeh/bokeh_plot_loo_pit_overlay.py | 1 + examples/bokeh/bokeh_plot_mcse.py | 1 + examples/bokeh/bokeh_plot_mcse_errorbar.py | 1 + examples/bokeh/bokeh_plot_pair.py | 1 + examples/bokeh/bokeh_plot_pair_hex.py | 1 + examples/bokeh/bokeh_plot_pair_kde.py | 1 + examples/bokeh/bokeh_plot_pair_kde_hdi.py | 1 + .../bokeh/bokeh_plot_pair_point_estimate.py | 1 + examples/bokeh/bokeh_plot_parallel.py | 1 + examples/bokeh/bokeh_plot_posterior.py | 1 + .../bokeh/bokeh_plot_posterior_combinedims.py | 1 + examples/bokeh/bokeh_plot_ppc.py | 1 + examples/bokeh/bokeh_plot_ppc_cumulative.py | 1 + examples/bokeh/bokeh_plot_rank.py | 1 + examples/bokeh/bokeh_plot_separation.py | 1 + examples/bokeh/bokeh_plot_trace.py | 1 + examples/bokeh/bokeh_plot_trace_bars.py | 1 + examples/bokeh/bokeh_plot_trace_circ.py | 1 + examples/bokeh/bokeh_plot_trace_vlines.py | 1 + examples/bokeh/bokeh_plot_violin.py | 1 + .../bokeh/bokeh_plot_violin_single_sided.py | 1 + examples/matplotlib/mpl_plot_autocorr.py | 1 + examples/matplotlib/mpl_plot_bf.py | 1 + examples/matplotlib/mpl_plot_bpv.py | 1 + examples/matplotlib/mpl_plot_bpv_tstat.py | 1 + examples/matplotlib/mpl_plot_compare.py | 1 + examples/matplotlib/mpl_plot_density.py | 1 + .../matplotlib/mpl_plot_density_single.py | 1 + examples/matplotlib/mpl_plot_dist.py | 1 + examples/matplotlib/mpl_plot_dot.py | 1 + examples/matplotlib/mpl_plot_ecdf.py | 1 + examples/matplotlib/mpl_plot_elpd.py | 1 + examples/matplotlib/mpl_plot_energy.py | 1 + examples/matplotlib/mpl_plot_ess_evolution.py | 1 + examples/matplotlib/mpl_plot_ess_local.py | 1 + examples/matplotlib/mpl_plot_ess_quantile.py | 1 + examples/matplotlib/mpl_plot_forest.py | 1 + .../matplotlib/mpl_plot_forest_comparison.py | 1 + examples/matplotlib/mpl_plot_forest_mixed.py | 1 + examples/matplotlib/mpl_plot_forest_ridge.py | 1 + examples/matplotlib/mpl_plot_hdi.py | 1 + examples/matplotlib/mpl_plot_joint.py | 1 + examples/matplotlib/mpl_plot_kde.py | 1 + examples/matplotlib/mpl_plot_kde_2d.py | 1 + examples/matplotlib/mpl_plot_kde_2d_hdi.py | 1 + examples/matplotlib/mpl_plot_kde_quantiles.py | 1 + examples/matplotlib/mpl_plot_khat.py | 1 + examples/matplotlib/mpl_plot_lm.py | 1 + examples/matplotlib/mpl_plot_loo_pit_ecdf.py | 1 + .../matplotlib/mpl_plot_loo_pit_overlay.py | 1 + examples/matplotlib/mpl_plot_mcse.py | 1 + examples/matplotlib/mpl_plot_mcse_errorbar.py | 1 + examples/matplotlib/mpl_plot_pair.py | 1 + examples/matplotlib/mpl_plot_pair_hex.py | 1 + examples/matplotlib/mpl_plot_pair_kde.py | 1 + examples/matplotlib/mpl_plot_pair_kde_hdi.py | 1 + .../mpl_plot_pair_point_estimate.py | 1 + examples/matplotlib/mpl_plot_parallel.py | 1 + examples/matplotlib/mpl_plot_posterior.py | 1 + .../mpl_plot_posterior_combinedims.py | 1 + examples/matplotlib/mpl_plot_ppc.py | 1 + .../matplotlib/mpl_plot_ppc_cumulative.py | 1 + examples/matplotlib/mpl_plot_rank.py | 1 + examples/matplotlib/mpl_plot_separation.py | 1 + examples/matplotlib/mpl_plot_trace.py | 1 + examples/matplotlib/mpl_plot_trace_bars.py | 1 + examples/matplotlib/mpl_plot_trace_circ.py | 1 + examples/matplotlib/mpl_plot_trace_vlines.py | 1 + examples/matplotlib/mpl_plot_violin.py | 1 + .../mpl_plot_violin_single_sided.py | 1 + examples/matplotlib/mpl_styles.py | 1 + requirements-dev.txt | 2 +- 200 files changed, 230 insertions(+), 42 deletions(-) diff --git a/arviz/data/__init__.py b/arviz/data/__init__.py index 572e9dfe6c..aa5866dd76 100644 --- a/arviz/data/__init__.py +++ b/arviz/data/__init__.py @@ -1,4 +1,5 @@ """Code for loading and manipulating data structures.""" + from .base import CoordSpec, DimSpec, dict_to_dataset, numpy_to_data_array, pytree_to_dataset from .converters import convert_to_dataset, convert_to_inference_data from .datasets import clear_data_home, list_datasets, load_arviz_data diff --git a/arviz/data/base.py b/arviz/data/base.py index 322a4a0ffd..1ee38b739f 100644 --- a/arviz/data/base.py +++ b/arviz/data/base.py @@ -1,4 +1,5 @@ """Low level converters usually used by other functions.""" + import datetime import functools import importlib diff --git a/arviz/data/converters.py b/arviz/data/converters.py index a8f34bc490..4dfde761fb 100644 --- a/arviz/data/converters.py +++ b/arviz/data/converters.py @@ -1,4 +1,5 @@ """High level conversion functions.""" + import numpy as np import tree import xarray as xr diff --git a/arviz/data/datasets.py b/arviz/data/datasets.py index 7577160619..4e0272503f 100644 --- a/arviz/data/datasets.py +++ b/arviz/data/datasets.py @@ -1,4 +1,5 @@ """Base IO code for all datasets. Heavily influenced by scikit-learn's implementation.""" + import hashlib import itertools import json diff --git a/arviz/data/inference_data.py b/arviz/data/inference_data.py index 2987108bba..5c1d50faef 100644 --- a/arviz/data/inference_data.py +++ b/arviz/data/inference_data.py @@ -394,8 +394,10 @@ def from_netcdf( ) try: - with h5netcdf.File(filename, mode="r") if engine == "h5netcdf" else nc.Dataset( - filename, mode="r" + with ( + h5netcdf.File(filename, mode="r") + if engine == "h5netcdf" + else nc.Dataset(filename, mode="r") ) as file_handle: if base_group == "/": data = file_handle @@ -744,11 +746,11 @@ def to_dataframe( if len(dfs) > 1: for group, df in dfs.items(): df.columns = [ - col - if col in ("draw", "chain") - else (group, *col) - if isinstance(col, tuple) - else (group, col) + ( + col + if col in ("draw", "chain") + else (group, *col) if isinstance(col, tuple) else (group, col) + ) for col in df.columns ] dfs, *dfs_tail = list(dfs.values()) @@ -1918,8 +1920,7 @@ def concat( copy: bool = True, inplace: "Literal[True]", reset_dim: bool = True, -) -> None: - ... +) -> None: ... @overload @@ -1929,8 +1930,7 @@ def concat( copy: bool = True, inplace: "Literal[False]", reset_dim: bool = True, -) -> InferenceData: - ... +) -> InferenceData: ... @overload @@ -1941,8 +1941,7 @@ def concat( copy: bool = True, inplace: "Literal[False]", reset_dim: bool = True, -) -> InferenceData: - ... +) -> InferenceData: ... @overload @@ -1953,8 +1952,7 @@ def concat( copy: bool = True, inplace: "Literal[True]", reset_dim: bool = True, -) -> None: - ... +) -> None: ... @overload @@ -1965,8 +1963,7 @@ def concat( copy: bool = True, inplace: bool = False, reset_dim: bool = True, -) -> Optional[InferenceData]: - ... +) -> Optional[InferenceData]: ... # pylint: disable=protected-access, inconsistent-return-statements diff --git a/arviz/data/io_cmdstan.py b/arviz/data/io_cmdstan.py index d45f65ee6f..a744cba9ed 100644 --- a/arviz/data/io_cmdstan.py +++ b/arviz/data/io_cmdstan.py @@ -732,9 +732,7 @@ def _process_configuration(comments): key = ( "warmup_time_seconds" if "(Warm-up)" in comment - else "sampling_time_seconds" - if "(Sampling)" in comment - else "total_time_seconds" + else "sampling_time_seconds" if "(Sampling)" in comment else "total_time_seconds" ) results[key] = float(value) elif "=" in comment: diff --git a/arviz/data/io_datatree.py b/arviz/data/io_datatree.py index bbcc7f9bab..71e196f0b1 100644 --- a/arviz/data/io_datatree.py +++ b/arviz/data/io_datatree.py @@ -1,4 +1,5 @@ """Conversion between InferenceData and DataTree.""" + from .inference_data import InferenceData diff --git a/arviz/data/io_dict.py b/arviz/data/io_dict.py index d76a7511c6..ebff5276e9 100644 --- a/arviz/data/io_dict.py +++ b/arviz/data/io_dict.py @@ -1,4 +1,5 @@ """Dictionary specific conversion code.""" + import warnings from typing import Optional @@ -59,9 +60,7 @@ def __init__( self.coords = ( coords if pred_coords is None - else pred_coords - if coords is None - else {**coords, **pred_coords} + else pred_coords if coords is None else {**coords, **pred_coords} ) self.index_origin = index_origin self.coords = coords diff --git a/arviz/data/io_emcee.py b/arviz/data/io_emcee.py index e66a06fc50..d08c5f8d89 100644 --- a/arviz/data/io_emcee.py +++ b/arviz/data/io_emcee.py @@ -1,4 +1,5 @@ """emcee-specific conversion code.""" + import warnings from collections import OrderedDict diff --git a/arviz/data/io_numpyro.py b/arviz/data/io_numpyro.py index ed61c72955..e742732ee2 100644 --- a/arviz/data/io_numpyro.py +++ b/arviz/data/io_numpyro.py @@ -1,4 +1,5 @@ """NumPyro-specific conversion code.""" + import logging from typing import Callable, Optional diff --git a/arviz/data/io_pyjags.py b/arviz/data/io_pyjags.py index 248ad1a27b..c5cd9ebd95 100644 --- a/arviz/data/io_pyjags.py +++ b/arviz/data/io_pyjags.py @@ -1,4 +1,5 @@ """Convert PyJAGS sample dictionaries to ArviZ inference data objects.""" + import typing as tp from collections import OrderedDict from collections.abc import Iterable diff --git a/arviz/data/io_pyro.py b/arviz/data/io_pyro.py index ba3920ddb9..501be5ea38 100644 --- a/arviz/data/io_pyro.py +++ b/arviz/data/io_pyro.py @@ -1,4 +1,5 @@ """Pyro-specific conversion code.""" + import logging from typing import Callable, Optional import warnings diff --git a/arviz/data/utils.py b/arviz/data/utils.py index 4adc208f43..67d56b396c 100644 --- a/arviz/data/utils.py +++ b/arviz/data/utils.py @@ -1,4 +1,5 @@ """Data specific utilities.""" + import warnings import numpy as np diff --git a/arviz/plots/__init__.py b/arviz/plots/__init__.py index ea4dcaa0e6..ddc8c6fd3b 100644 --- a/arviz/plots/__init__.py +++ b/arviz/plots/__init__.py @@ -1,4 +1,5 @@ """Plotting functions.""" + from .autocorrplot import plot_autocorr from .bpvplot import plot_bpv from .bfplot import plot_bf diff --git a/arviz/plots/autocorrplot.py b/arviz/plots/autocorrplot.py index bc4c3de171..8afc8cfa9d 100644 --- a/arviz/plots/autocorrplot.py +++ b/arviz/plots/autocorrplot.py @@ -1,4 +1,5 @@ """Autocorrelation plot of data.""" + from ..data import convert_to_dataset from ..labels import BaseLabeller from ..sel_utils import xarray_var_iter diff --git a/arviz/plots/backends/bokeh/autocorrplot.py b/arviz/plots/backends/bokeh/autocorrplot.py index 7a2326c48d..dced230308 100644 --- a/arviz/plots/backends/bokeh/autocorrplot.py +++ b/arviz/plots/backends/bokeh/autocorrplot.py @@ -1,4 +1,5 @@ """Bokeh Autocorrplot.""" + import numpy as np from bokeh.models import DataRange1d, BoxAnnotation from bokeh.models.annotations import Title diff --git a/arviz/plots/backends/bokeh/bpvplot.py b/arviz/plots/backends/bokeh/bpvplot.py index 5c57cf7c71..83fa52d00f 100644 --- a/arviz/plots/backends/bokeh/bpvplot.py +++ b/arviz/plots/backends/bokeh/bpvplot.py @@ -1,4 +1,5 @@ """Bokeh Bayesian p-value Posterior predictive plot.""" + import numpy as np from bokeh.models import BoxAnnotation from bokeh.models.annotations import Title diff --git a/arviz/plots/backends/bokeh/compareplot.py b/arviz/plots/backends/bokeh/compareplot.py index 3b5c4ea393..a3a87c5e17 100644 --- a/arviz/plots/backends/bokeh/compareplot.py +++ b/arviz/plots/backends/bokeh/compareplot.py @@ -1,4 +1,5 @@ """Bokeh Compareplot.""" + from bokeh.models import Span from bokeh.models.annotations import Title, Legend diff --git a/arviz/plots/backends/bokeh/densityplot.py b/arviz/plots/backends/bokeh/densityplot.py index 5d604920e1..2834073d8a 100644 --- a/arviz/plots/backends/bokeh/densityplot.py +++ b/arviz/plots/backends/bokeh/densityplot.py @@ -1,4 +1,5 @@ """Bokeh Densityplot.""" + from collections import defaultdict from itertools import cycle diff --git a/arviz/plots/backends/bokeh/distplot.py b/arviz/plots/backends/bokeh/distplot.py index 4a52b51a56..00ec9d9e1e 100644 --- a/arviz/plots/backends/bokeh/distplot.py +++ b/arviz/plots/backends/bokeh/distplot.py @@ -1,4 +1,5 @@ """Bokeh Distplot.""" + import matplotlib.pyplot as plt import numpy as np diff --git a/arviz/plots/backends/bokeh/dotplot.py b/arviz/plots/backends/bokeh/dotplot.py index a2f74036b2..5f48cbab71 100644 --- a/arviz/plots/backends/bokeh/dotplot.py +++ b/arviz/plots/backends/bokeh/dotplot.py @@ -1,4 +1,5 @@ """Bokeh dotplot.""" + import math import warnings import numpy as np diff --git a/arviz/plots/backends/bokeh/ecdfplot.py b/arviz/plots/backends/bokeh/ecdfplot.py index d756f62ac6..ce4aedc1f9 100644 --- a/arviz/plots/backends/bokeh/ecdfplot.py +++ b/arviz/plots/backends/bokeh/ecdfplot.py @@ -1,4 +1,5 @@ """Bokeh ecdfplot.""" + from matplotlib.colors import to_hex from ...plot_utils import _scale_fig_size diff --git a/arviz/plots/backends/bokeh/elpdplot.py b/arviz/plots/backends/bokeh/elpdplot.py index e646fe4cda..fd6484be13 100644 --- a/arviz/plots/backends/bokeh/elpdplot.py +++ b/arviz/plots/backends/bokeh/elpdplot.py @@ -1,4 +1,5 @@ """Bokeh ELPDPlot.""" + import warnings import bokeh.plotting as bkp diff --git a/arviz/plots/backends/bokeh/energyplot.py b/arviz/plots/backends/bokeh/energyplot.py index bc8f299fa6..6e24b2f493 100644 --- a/arviz/plots/backends/bokeh/energyplot.py +++ b/arviz/plots/backends/bokeh/energyplot.py @@ -1,4 +1,5 @@ """Bokeh energyplot.""" + from itertools import cycle import numpy as np diff --git a/arviz/plots/backends/bokeh/hdiplot.py b/arviz/plots/backends/bokeh/hdiplot.py index 12ad7215ea..771737683c 100644 --- a/arviz/plots/backends/bokeh/hdiplot.py +++ b/arviz/plots/backends/bokeh/hdiplot.py @@ -1,4 +1,5 @@ """Bokeh hdiplot.""" + import numpy as np from ...plot_utils import _scale_fig_size, vectorized_to_hex diff --git a/arviz/plots/backends/bokeh/khatplot.py b/arviz/plots/backends/bokeh/khatplot.py index 00ce84f3c7..61fc3e9992 100644 --- a/arviz/plots/backends/bokeh/khatplot.py +++ b/arviz/plots/backends/bokeh/khatplot.py @@ -1,4 +1,5 @@ """Bokeh pareto shape plot.""" + from collections.abc import Iterable from matplotlib import cm diff --git a/arviz/plots/backends/bokeh/lmplot.py b/arviz/plots/backends/bokeh/lmplot.py index 953a7a2e96..7bf2bdebbb 100644 --- a/arviz/plots/backends/bokeh/lmplot.py +++ b/arviz/plots/backends/bokeh/lmplot.py @@ -1,4 +1,5 @@ """Bokeh linear regression plot.""" + import numpy as np from bokeh.models.annotations import Legend diff --git a/arviz/plots/backends/bokeh/loopitplot.py b/arviz/plots/backends/bokeh/loopitplot.py index 4b097b3aa8..0884e04d48 100644 --- a/arviz/plots/backends/bokeh/loopitplot.py +++ b/arviz/plots/backends/bokeh/loopitplot.py @@ -1,4 +1,5 @@ """Bokeh loopitplot.""" + import numpy as np from bokeh.models import BoxAnnotation from matplotlib.colors import hsv_to_rgb, rgb_to_hsv, to_hex, to_rgb diff --git a/arviz/plots/backends/bokeh/mcseplot.py b/arviz/plots/backends/bokeh/mcseplot.py index 020feb549f..126fcdb2a7 100644 --- a/arviz/plots/backends/bokeh/mcseplot.py +++ b/arviz/plots/backends/bokeh/mcseplot.py @@ -1,4 +1,5 @@ """Bokeh mcseplot.""" + import numpy as np from bokeh.models import ColumnDataSource, Span from bokeh.models.glyphs import Scatter diff --git a/arviz/plots/backends/bokeh/pairplot.py b/arviz/plots/backends/bokeh/pairplot.py index 5701140925..f17622717d 100644 --- a/arviz/plots/backends/bokeh/pairplot.py +++ b/arviz/plots/backends/bokeh/pairplot.py @@ -1,4 +1,5 @@ """Bokeh pairplot.""" + import warnings from copy import deepcopy from uuid import uuid4 diff --git a/arviz/plots/backends/bokeh/parallelplot.py b/arviz/plots/backends/bokeh/parallelplot.py index bfa632eaa0..a6d042b71c 100644 --- a/arviz/plots/backends/bokeh/parallelplot.py +++ b/arviz/plots/backends/bokeh/parallelplot.py @@ -1,4 +1,5 @@ """Bokeh Parallel coordinates plot.""" + import numpy as np from bokeh.models import DataRange1d from bokeh.models.tickers import FixedTicker diff --git a/arviz/plots/backends/bokeh/posteriorplot.py b/arviz/plots/backends/bokeh/posteriorplot.py index 76a40849ef..2cee3c749e 100644 --- a/arviz/plots/backends/bokeh/posteriorplot.py +++ b/arviz/plots/backends/bokeh/posteriorplot.py @@ -1,4 +1,5 @@ """Bokeh Plot posterior densities.""" + from numbers import Number from typing import Optional diff --git a/arviz/plots/backends/bokeh/ppcplot.py b/arviz/plots/backends/bokeh/ppcplot.py index 9534d291f7..a26813db97 100644 --- a/arviz/plots/backends/bokeh/ppcplot.py +++ b/arviz/plots/backends/bokeh/ppcplot.py @@ -1,4 +1,5 @@ """Bokeh Posterior predictive plot.""" + import numpy as np from bokeh.models.annotations import Legend from bokeh.models.glyphs import Scatter diff --git a/arviz/plots/backends/bokeh/rankplot.py b/arviz/plots/backends/bokeh/rankplot.py index 1ccccfe72f..de364d0465 100644 --- a/arviz/plots/backends/bokeh/rankplot.py +++ b/arviz/plots/backends/bokeh/rankplot.py @@ -1,4 +1,5 @@ """Bokeh rankplot.""" + import numpy as np from bokeh.models import Span diff --git a/arviz/plots/backends/bokeh/separationplot.py b/arviz/plots/backends/bokeh/separationplot.py index 28ef3c68cd..b0aacb0dda 100644 --- a/arviz/plots/backends/bokeh/separationplot.py +++ b/arviz/plots/backends/bokeh/separationplot.py @@ -1,4 +1,5 @@ """Bokeh separation plot.""" + import numpy as np from ...plot_utils import _scale_fig_size, vectorized_to_hex diff --git a/arviz/plots/backends/bokeh/traceplot.py b/arviz/plots/backends/bokeh/traceplot.py index 05d83f1546..be10296cd2 100644 --- a/arviz/plots/backends/bokeh/traceplot.py +++ b/arviz/plots/backends/bokeh/traceplot.py @@ -1,4 +1,5 @@ """Bokeh Traceplot.""" + import warnings from collections.abc import Iterable from itertools import cycle diff --git a/arviz/plots/backends/bokeh/violinplot.py b/arviz/plots/backends/bokeh/violinplot.py index 2fd6602274..e44cc7f9d2 100644 --- a/arviz/plots/backends/bokeh/violinplot.py +++ b/arviz/plots/backends/bokeh/violinplot.py @@ -1,4 +1,5 @@ """Bokeh Violinplot.""" + import numpy as np from bokeh.models.annotations import Title diff --git a/arviz/plots/backends/matplotlib/autocorrplot.py b/arviz/plots/backends/matplotlib/autocorrplot.py index 998720f1bf..e1e871140f 100644 --- a/arviz/plots/backends/matplotlib/autocorrplot.py +++ b/arviz/plots/backends/matplotlib/autocorrplot.py @@ -1,4 +1,5 @@ """Matplotlib Autocorrplot.""" + import matplotlib.pyplot as plt import numpy as np diff --git a/arviz/plots/backends/matplotlib/bpvplot.py b/arviz/plots/backends/matplotlib/bpvplot.py index d736378055..3a4e55c7b8 100644 --- a/arviz/plots/backends/matplotlib/bpvplot.py +++ b/arviz/plots/backends/matplotlib/bpvplot.py @@ -1,4 +1,5 @@ """Matplotib Bayesian p-value Posterior predictive plot.""" + import matplotlib.pyplot as plt import numpy as np from scipy import stats diff --git a/arviz/plots/backends/matplotlib/compareplot.py b/arviz/plots/backends/matplotlib/compareplot.py index 2929341c29..948f5ee08e 100644 --- a/arviz/plots/backends/matplotlib/compareplot.py +++ b/arviz/plots/backends/matplotlib/compareplot.py @@ -1,4 +1,5 @@ """Matplotlib Compareplot.""" + import matplotlib.pyplot as plt from ...plot_utils import _scale_fig_size diff --git a/arviz/plots/backends/matplotlib/densityplot.py b/arviz/plots/backends/matplotlib/densityplot.py index 7f1747dcbd..b72641985c 100644 --- a/arviz/plots/backends/matplotlib/densityplot.py +++ b/arviz/plots/backends/matplotlib/densityplot.py @@ -1,4 +1,5 @@ """Matplotlib Densityplot.""" + from itertools import cycle import matplotlib.pyplot as plt diff --git a/arviz/plots/backends/matplotlib/distcomparisonplot.py b/arviz/plots/backends/matplotlib/distcomparisonplot.py index ecc76ae979..66305f097b 100644 --- a/arviz/plots/backends/matplotlib/distcomparisonplot.py +++ b/arviz/plots/backends/matplotlib/distcomparisonplot.py @@ -1,4 +1,5 @@ """Matplotlib Density Comparison plot.""" + import matplotlib.pyplot as plt import numpy as np @@ -88,9 +89,7 @@ def plot_dist_comparison( kwargs = ( prior_kwargs if group.startswith("prior") - else posterior_kwargs - if group.startswith("posterior") - else observed_kwargs + else posterior_kwargs if group.startswith("posterior") else observed_kwargs ) for idx2, ( var_name, diff --git a/arviz/plots/backends/matplotlib/distplot.py b/arviz/plots/backends/matplotlib/distplot.py index 8d8257acdf..afd539de5b 100644 --- a/arviz/plots/backends/matplotlib/distplot.py +++ b/arviz/plots/backends/matplotlib/distplot.py @@ -1,4 +1,5 @@ """Matplotlib distplot.""" + import matplotlib.pyplot as plt from matplotlib import _pylab_helpers import numpy as np diff --git a/arviz/plots/backends/matplotlib/dotplot.py b/arviz/plots/backends/matplotlib/dotplot.py index 1f5052b64d..73250bed28 100644 --- a/arviz/plots/backends/matplotlib/dotplot.py +++ b/arviz/plots/backends/matplotlib/dotplot.py @@ -1,4 +1,5 @@ """Matplotlib dotplot.""" + import math import warnings import numpy as np diff --git a/arviz/plots/backends/matplotlib/ecdfplot.py b/arviz/plots/backends/matplotlib/ecdfplot.py index 8b992d4aab..6dd475da2a 100644 --- a/arviz/plots/backends/matplotlib/ecdfplot.py +++ b/arviz/plots/backends/matplotlib/ecdfplot.py @@ -1,4 +1,5 @@ """Matplotlib ecdfplot.""" + import matplotlib.pyplot as plt from matplotlib.colors import to_hex diff --git a/arviz/plots/backends/matplotlib/elpdplot.py b/arviz/plots/backends/matplotlib/elpdplot.py index 5eb32a857e..456beb6557 100644 --- a/arviz/plots/backends/matplotlib/elpdplot.py +++ b/arviz/plots/backends/matplotlib/elpdplot.py @@ -1,4 +1,5 @@ """Matplotlib ELPDPlot.""" + import warnings from matplotlib import cm diff --git a/arviz/plots/backends/matplotlib/energyplot.py b/arviz/plots/backends/matplotlib/energyplot.py index 0019f6349a..3c263248c0 100644 --- a/arviz/plots/backends/matplotlib/energyplot.py +++ b/arviz/plots/backends/matplotlib/energyplot.py @@ -1,4 +1,5 @@ """Matplotlib energyplot.""" + from itertools import cycle import matplotlib.pyplot as plt diff --git a/arviz/plots/backends/matplotlib/essplot.py b/arviz/plots/backends/matplotlib/essplot.py index 3decb0eae9..8071b88405 100644 --- a/arviz/plots/backends/matplotlib/essplot.py +++ b/arviz/plots/backends/matplotlib/essplot.py @@ -1,4 +1,5 @@ """Matplotlib energyplot.""" + import matplotlib.pyplot as plt import numpy as np from scipy.stats import rankdata @@ -127,11 +128,11 @@ def plot_ess( ax_.annotate( "mean", (text_x, mean_ess_i), - va=text_va - if text_va is not None - else "bottom" - if mean_ess_i >= sd_ess_i - else "top", + va=( + text_va + if text_va is not None + else "bottom" if mean_ess_i >= sd_ess_i else "top" + ), **text_kwargs, ) ax_.axhline(sd_ess_i, **extra_kwargs) diff --git a/arviz/plots/backends/matplotlib/forestplot.py b/arviz/plots/backends/matplotlib/forestplot.py index 3993f497e6..25a085b60c 100644 --- a/arviz/plots/backends/matplotlib/forestplot.py +++ b/arviz/plots/backends/matplotlib/forestplot.py @@ -1,4 +1,5 @@ """Matplotlib forestplot.""" + from collections import OrderedDict, defaultdict from itertools import tee diff --git a/arviz/plots/backends/matplotlib/hdiplot.py b/arviz/plots/backends/matplotlib/hdiplot.py index 9c167596a6..a8600d5a0f 100644 --- a/arviz/plots/backends/matplotlib/hdiplot.py +++ b/arviz/plots/backends/matplotlib/hdiplot.py @@ -1,4 +1,5 @@ """Matplotlib hdiplot.""" + import matplotlib.pyplot as plt from matplotlib import _pylab_helpers diff --git a/arviz/plots/backends/matplotlib/kdeplot.py b/arviz/plots/backends/matplotlib/kdeplot.py index c6d3f07c76..63a204f7ff 100644 --- a/arviz/plots/backends/matplotlib/kdeplot.py +++ b/arviz/plots/backends/matplotlib/kdeplot.py @@ -1,4 +1,5 @@ """Matplotlib kdeplot.""" + import numpy as np from matplotlib import pyplot as plt from matplotlib import _pylab_helpers diff --git a/arviz/plots/backends/matplotlib/khatplot.py b/arviz/plots/backends/matplotlib/khatplot.py index b740ecd0bd..2e52b3dd2a 100644 --- a/arviz/plots/backends/matplotlib/khatplot.py +++ b/arviz/plots/backends/matplotlib/khatplot.py @@ -1,4 +1,5 @@ """Matplotlib khatplot.""" + import warnings import matplotlib as mpl diff --git a/arviz/plots/backends/matplotlib/lmplot.py b/arviz/plots/backends/matplotlib/lmplot.py index 109ca741a7..2977e933d4 100644 --- a/arviz/plots/backends/matplotlib/lmplot.py +++ b/arviz/plots/backends/matplotlib/lmplot.py @@ -1,4 +1,5 @@ """Matplotlib plot linear regression figure.""" + import matplotlib.pyplot as plt import numpy as np diff --git a/arviz/plots/backends/matplotlib/loopitplot.py b/arviz/plots/backends/matplotlib/loopitplot.py index 586788ab5d..4f3f618df2 100644 --- a/arviz/plots/backends/matplotlib/loopitplot.py +++ b/arviz/plots/backends/matplotlib/loopitplot.py @@ -1,4 +1,5 @@ """Matplotlib loopitplot.""" + import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import hsv_to_rgb, rgb_to_hsv, to_hex, to_rgb diff --git a/arviz/plots/backends/matplotlib/mcseplot.py b/arviz/plots/backends/matplotlib/mcseplot.py index 5f6306c180..7f1084470c 100644 --- a/arviz/plots/backends/matplotlib/mcseplot.py +++ b/arviz/plots/backends/matplotlib/mcseplot.py @@ -1,4 +1,5 @@ """Matplotlib mcseplot.""" + import matplotlib.pyplot as plt import numpy as np from scipy.stats import rankdata @@ -94,22 +95,22 @@ def plot_mcse( ax_.annotate( "mean", (text_x, mean_mcse_i), - va=text_va - if text_va is not None - else "bottom" - if mean_mcse_i > sd_mcse_i - else "top", + va=( + text_va + if text_va is not None + else "bottom" if mean_mcse_i > sd_mcse_i else "top" + ), **text_kwargs, ) ax_.axhline(sd_mcse_i, **extra_kwargs) ax_.annotate( "sd", (text_x, sd_mcse_i), - va=text_va - if text_va is not None - else "bottom" - if sd_mcse_i >= mean_mcse_i - else "top", + va=( + text_va + if text_va is not None + else "bottom" if sd_mcse_i >= mean_mcse_i else "top" + ), **text_kwargs, ) if rug: diff --git a/arviz/plots/backends/matplotlib/pairplot.py b/arviz/plots/backends/matplotlib/pairplot.py index f17f51e19b..c8313e3a46 100644 --- a/arviz/plots/backends/matplotlib/pairplot.py +++ b/arviz/plots/backends/matplotlib/pairplot.py @@ -1,4 +1,5 @@ """Matplotlib pairplot.""" + import warnings from copy import deepcopy diff --git a/arviz/plots/backends/matplotlib/parallelplot.py b/arviz/plots/backends/matplotlib/parallelplot.py index 6e0f5460e6..dee07fb18b 100644 --- a/arviz/plots/backends/matplotlib/parallelplot.py +++ b/arviz/plots/backends/matplotlib/parallelplot.py @@ -1,4 +1,5 @@ """Matplotlib Parallel coordinates plot.""" + import matplotlib.pyplot as plt import numpy as np diff --git a/arviz/plots/backends/matplotlib/posteriorplot.py b/arviz/plots/backends/matplotlib/posteriorplot.py index e612d4a82d..f67b4ad60d 100644 --- a/arviz/plots/backends/matplotlib/posteriorplot.py +++ b/arviz/plots/backends/matplotlib/posteriorplot.py @@ -1,4 +1,5 @@ """Matplotlib Plot posterior densities.""" + from numbers import Number import matplotlib.pyplot as plt diff --git a/arviz/plots/backends/matplotlib/ppcplot.py b/arviz/plots/backends/matplotlib/ppcplot.py index 1c00337202..2b4118760b 100644 --- a/arviz/plots/backends/matplotlib/ppcplot.py +++ b/arviz/plots/backends/matplotlib/ppcplot.py @@ -1,4 +1,5 @@ """Matplotlib Posterior predictive plot.""" + import logging import platform diff --git a/arviz/plots/backends/matplotlib/rankplot.py b/arviz/plots/backends/matplotlib/rankplot.py index cefaa002d3..5e64e2e82d 100644 --- a/arviz/plots/backends/matplotlib/rankplot.py +++ b/arviz/plots/backends/matplotlib/rankplot.py @@ -1,4 +1,5 @@ """Matplotlib rankplot.""" + import matplotlib.pyplot as plt import numpy as np diff --git a/arviz/plots/backends/matplotlib/separationplot.py b/arviz/plots/backends/matplotlib/separationplot.py index 528f89ddb0..f709c8613a 100644 --- a/arviz/plots/backends/matplotlib/separationplot.py +++ b/arviz/plots/backends/matplotlib/separationplot.py @@ -1,4 +1,5 @@ """Matplotlib separation plot.""" + import matplotlib.pyplot as plt import numpy as np diff --git a/arviz/plots/backends/matplotlib/traceplot.py b/arviz/plots/backends/matplotlib/traceplot.py index 7b6d6b8e07..71b4da731e 100644 --- a/arviz/plots/backends/matplotlib/traceplot.py +++ b/arviz/plots/backends/matplotlib/traceplot.py @@ -1,4 +1,5 @@ """Matplotlib traceplot.""" + import warnings from itertools import cycle diff --git a/arviz/plots/backends/matplotlib/tsplot.py b/arviz/plots/backends/matplotlib/tsplot.py index c7fcfe0938..f4471cdeef 100644 --- a/arviz/plots/backends/matplotlib/tsplot.py +++ b/arviz/plots/backends/matplotlib/tsplot.py @@ -1,4 +1,5 @@ """Matplotlib plot time series figure.""" + import matplotlib.pyplot as plt import numpy as np diff --git a/arviz/plots/backends/matplotlib/violinplot.py b/arviz/plots/backends/matplotlib/violinplot.py index 77a4c9ba53..640101b692 100644 --- a/arviz/plots/backends/matplotlib/violinplot.py +++ b/arviz/plots/backends/matplotlib/violinplot.py @@ -1,4 +1,5 @@ """Matplotlib Violinplot.""" + import matplotlib.pyplot as plt import numpy as np diff --git a/arviz/plots/bpvplot.py b/arviz/plots/bpvplot.py index 2127d972e0..f7f869105b 100644 --- a/arviz/plots/bpvplot.py +++ b/arviz/plots/bpvplot.py @@ -1,4 +1,5 @@ """Bayesian p-value Posterior/Prior predictive plot.""" + import numpy as np from ..labels import BaseLabeller diff --git a/arviz/plots/compareplot.py b/arviz/plots/compareplot.py index 97bd74fd3e..d567a8c798 100644 --- a/arviz/plots/compareplot.py +++ b/arviz/plots/compareplot.py @@ -1,4 +1,5 @@ """Summary plot for model comparison.""" + import numpy as np from ..labels import BaseLabeller diff --git a/arviz/plots/densityplot.py b/arviz/plots/densityplot.py index 38a3d3d979..8d167969d1 100644 --- a/arviz/plots/densityplot.py +++ b/arviz/plots/densityplot.py @@ -1,4 +1,5 @@ """KDE and histogram plots for multiple variables.""" + import warnings from ..data import convert_to_dataset diff --git a/arviz/plots/distcomparisonplot.py b/arviz/plots/distcomparisonplot.py index f7c1329f7d..92475eea6e 100644 --- a/arviz/plots/distcomparisonplot.py +++ b/arviz/plots/distcomparisonplot.py @@ -1,4 +1,5 @@ """Density Comparison plot.""" + import warnings from ..labels import BaseLabeller from ..rcparams import rcParams diff --git a/arviz/plots/dotplot.py b/arviz/plots/dotplot.py index 3ec52f4bbb..ac53aadc6c 100644 --- a/arviz/plots/dotplot.py +++ b/arviz/plots/dotplot.py @@ -1,4 +1,5 @@ """Plot distribution as dot plot or quantile dot plot.""" + import numpy as np from ..rcparams import rcParams diff --git a/arviz/plots/ecdfplot.py b/arviz/plots/ecdfplot.py index 83b6a11c0c..a67e8b93da 100644 --- a/arviz/plots/ecdfplot.py +++ b/arviz/plots/ecdfplot.py @@ -1,4 +1,5 @@ """Plot ecdf or ecdf-difference plot with confidence bands.""" + import numpy as np from scipy.stats import uniform diff --git a/arviz/plots/elpdplot.py b/arviz/plots/elpdplot.py index 54078ddda3..eef0486de1 100644 --- a/arviz/plots/elpdplot.py +++ b/arviz/plots/elpdplot.py @@ -1,4 +1,5 @@ """Plot pointwise elpd estimations of inference data.""" + import numpy as np from ..rcparams import rcParams diff --git a/arviz/plots/energyplot.py b/arviz/plots/energyplot.py index 49d76a3a87..34cabf2f00 100644 --- a/arviz/plots/energyplot.py +++ b/arviz/plots/energyplot.py @@ -1,4 +1,5 @@ """Plot energy transition distribution in HMC inference.""" + import warnings from ..data import convert_to_dataset diff --git a/arviz/plots/essplot.py b/arviz/plots/essplot.py index dadc51fe83..82c402f8b4 100644 --- a/arviz/plots/essplot.py +++ b/arviz/plots/essplot.py @@ -1,4 +1,5 @@ """Plot quantile or local effective sample sizes.""" + import numpy as np import xarray as xr diff --git a/arviz/plots/forestplot.py b/arviz/plots/forestplot.py index 5e84cf9045..d78c214b4a 100644 --- a/arviz/plots/forestplot.py +++ b/arviz/plots/forestplot.py @@ -1,4 +1,5 @@ """Forest plot.""" + from ..data import convert_to_dataset from ..labels import BaseLabeller, NoModelLabeller from ..rcparams import rcParams diff --git a/arviz/plots/hdiplot.py b/arviz/plots/hdiplot.py index a71f7f209b..b5cb9d649b 100644 --- a/arviz/plots/hdiplot.py +++ b/arviz/plots/hdiplot.py @@ -1,4 +1,5 @@ """Plot highest density intervals for regression data.""" + import warnings import numpy as np diff --git a/arviz/plots/khatplot.py b/arviz/plots/khatplot.py index ae64ad6acb..706b38c284 100644 --- a/arviz/plots/khatplot.py +++ b/arviz/plots/khatplot.py @@ -1,4 +1,5 @@ """Pareto tail indices plot.""" + import logging import numpy as np diff --git a/arviz/plots/lmplot.py b/arviz/plots/lmplot.py index 380e09722b..4dc1e26735 100644 --- a/arviz/plots/lmplot.py +++ b/arviz/plots/lmplot.py @@ -1,4 +1,5 @@ """Plot regression figure.""" + import warnings from numbers import Integral from itertools import repeat diff --git a/arviz/plots/loopitplot.py b/arviz/plots/loopitplot.py index 7421c760ec..d67857cd07 100644 --- a/arviz/plots/loopitplot.py +++ b/arviz/plots/loopitplot.py @@ -1,4 +1,5 @@ """Plot LOO-PIT predictive checks of inference data.""" + import numpy as np from scipy import stats diff --git a/arviz/plots/mcseplot.py b/arviz/plots/mcseplot.py index a72d6dc401..e442c64c1c 100644 --- a/arviz/plots/mcseplot.py +++ b/arviz/plots/mcseplot.py @@ -1,4 +1,5 @@ """Plot quantile MC standard error.""" + import numpy as np import xarray as xr diff --git a/arviz/plots/pairplot.py b/arviz/plots/pairplot.py index 78fe4f8e24..0eca9d3a29 100644 --- a/arviz/plots/pairplot.py +++ b/arviz/plots/pairplot.py @@ -1,4 +1,5 @@ """Plot a scatter, kde and/or hexbin of sampled parameters.""" + import warnings from typing import List, Optional, Union diff --git a/arviz/plots/parallelplot.py b/arviz/plots/parallelplot.py index feacaa2cfc..ec026facda 100644 --- a/arviz/plots/parallelplot.py +++ b/arviz/plots/parallelplot.py @@ -1,4 +1,5 @@ """Parallel coordinates plot showing posterior points with and without divergences marked.""" + import numpy as np from scipy.stats import rankdata diff --git a/arviz/plots/plot_utils.py b/arviz/plots/plot_utils.py index b15520c5e6..9170c783f2 100644 --- a/arviz/plots/plot_utils.py +++ b/arviz/plots/plot_utils.py @@ -1,4 +1,5 @@ """Utilities for plotting.""" + import importlib import warnings from typing import Any, Dict diff --git a/arviz/plots/posteriorplot.py b/arviz/plots/posteriorplot.py index 67d019bf96..13617e8149 100644 --- a/arviz/plots/posteriorplot.py +++ b/arviz/plots/posteriorplot.py @@ -1,4 +1,5 @@ """Plot posterior densities.""" + from ..data import convert_to_dataset from ..labels import BaseLabeller from ..sel_utils import xarray_var_iter diff --git a/arviz/plots/ppcplot.py b/arviz/plots/ppcplot.py index 8d1ee80312..6e965485fc 100644 --- a/arviz/plots/ppcplot.py +++ b/arviz/plots/ppcplot.py @@ -1,4 +1,5 @@ """Posterior/Prior predictive plot.""" + import logging import warnings from numbers import Integral diff --git a/arviz/plots/rankplot.py b/arviz/plots/rankplot.py index eeefe67ca4..9da1fa46b6 100644 --- a/arviz/plots/rankplot.py +++ b/arviz/plots/rankplot.py @@ -1,4 +1,5 @@ """Histograms of ranked posterior draws, plotted for each chain.""" + from itertools import cycle import matplotlib.pyplot as plt diff --git a/arviz/plots/separationplot.py b/arviz/plots/separationplot.py index d6a39814f1..3476dfea7d 100644 --- a/arviz/plots/separationplot.py +++ b/arviz/plots/separationplot.py @@ -1,4 +1,5 @@ """Separation plot for discrete outcome models.""" + import warnings import numpy as np diff --git a/arviz/plots/traceplot.py b/arviz/plots/traceplot.py index c462e89a63..ab8734ec18 100644 --- a/arviz/plots/traceplot.py +++ b/arviz/plots/traceplot.py @@ -1,4 +1,5 @@ """Plot kde or histograms and values from MCMC samples.""" + import warnings from typing import Any, Callable, List, Mapping, Optional, Tuple, Union, Sequence diff --git a/arviz/plots/tsplot.py b/arviz/plots/tsplot.py index 0c055be8a7..8085f22ba8 100644 --- a/arviz/plots/tsplot.py +++ b/arviz/plots/tsplot.py @@ -1,4 +1,5 @@ """Plot timeseries data.""" + import warnings import numpy as np diff --git a/arviz/plots/violinplot.py b/arviz/plots/violinplot.py index 98b6633d6e..a9b3ac28ee 100644 --- a/arviz/plots/violinplot.py +++ b/arviz/plots/violinplot.py @@ -1,4 +1,5 @@ """Plot posterior traces as violin plot.""" + from ..data import convert_to_dataset from ..labels import BaseLabeller from ..sel_utils import xarray_var_iter diff --git a/arviz/rcparams.py b/arviz/rcparams.py index bb28dec2f5..7a9961c9d7 100644 --- a/arviz/rcparams.py +++ b/arviz/rcparams.py @@ -1,4 +1,5 @@ """ArviZ rcparams. Based on matplotlib's implementation.""" + import locale import logging import os diff --git a/arviz/sel_utils.py b/arviz/sel_utils.py index 4c041f13b2..c538b5e1f7 100644 --- a/arviz/sel_utils.py +++ b/arviz/sel_utils.py @@ -1,4 +1,5 @@ """Utilities for selecting and iterating on xarray objects.""" + from itertools import product, tee import numpy as np diff --git a/arviz/stats/ecdf_utils.py b/arviz/stats/ecdf_utils.py index 53481657a6..b47c6d2731 100644 --- a/arviz/stats/ecdf_utils.py +++ b/arviz/stats/ecdf_utils.py @@ -1,4 +1,5 @@ """Functions for evaluating ECDFs and their confidence bands.""" + from typing import Any, Callable, Optional, Tuple import warnings diff --git a/arviz/stats/stats_refitting.py b/arviz/stats/stats_refitting.py index 5aa9cb250f..dbe3a5d49f 100644 --- a/arviz/stats/stats_refitting.py +++ b/arviz/stats/stats_refitting.py @@ -1,4 +1,5 @@ """Stats functions that require refitting the model.""" + import logging import warnings diff --git a/arviz/stats/stats_utils.py b/arviz/stats/stats_utils.py index e2c3b34323..cb05694709 100644 --- a/arviz/stats/stats_utils.py +++ b/arviz/stats/stats_utils.py @@ -1,4 +1,5 @@ """Stats-utility functions for ArviZ.""" + import warnings from collections.abc import Sequence from copy import copy as _copy diff --git a/arviz/tests/base_tests/test_diagnostics.py b/arviz/tests/base_tests/test_diagnostics.py index 1bd787b9a2..f30865d824 100644 --- a/arviz/tests/base_tests/test_diagnostics.py +++ b/arviz/tests/base_tests/test_diagnostics.py @@ -1,4 +1,5 @@ """Test Diagnostic methods""" + # pylint: disable=redefined-outer-name, no-member, too-many-public-methods import os diff --git a/arviz/tests/base_tests/test_diagnostics_numba.py b/arviz/tests/base_tests/test_diagnostics_numba.py index 78aeae1c0d..e3da38ded5 100644 --- a/arviz/tests/base_tests/test_diagnostics_numba.py +++ b/arviz/tests/base_tests/test_diagnostics_numba.py @@ -1,4 +1,5 @@ """Test Diagnostic methods""" + import importlib # pylint: disable=redefined-outer-name, no-member, too-many-public-methods diff --git a/arviz/tests/base_tests/test_labels.py b/arviz/tests/base_tests/test_labels.py index d8f75728e4..40d2986ff0 100644 --- a/arviz/tests/base_tests/test_labels.py +++ b/arviz/tests/base_tests/test_labels.py @@ -1,4 +1,5 @@ """Tests for labeller classes.""" + import pytest from ...labels import ( diff --git a/arviz/tests/base_tests/test_plots_matplotlib.py b/arviz/tests/base_tests/test_plots_matplotlib.py index c45b7085ac..399113ccac 100644 --- a/arviz/tests/base_tests/test_plots_matplotlib.py +++ b/arviz/tests/base_tests/test_plots_matplotlib.py @@ -1,4 +1,5 @@ """Tests use the default backend.""" + # pylint: disable=redefined-outer-name,too-many-lines import os from copy import deepcopy diff --git a/arviz/tests/base_tests/test_stats_utils.py b/arviz/tests/base_tests/test_stats_utils.py index 8d30d172ff..b16169c55b 100644 --- a/arviz/tests/base_tests/test_stats_utils.py +++ b/arviz/tests/base_tests/test_stats_utils.py @@ -1,4 +1,5 @@ """Tests for stats_utils.""" + # pylint: disable=no-member import numpy as np import pytest diff --git a/arviz/tests/base_tests/test_utils.py b/arviz/tests/base_tests/test_utils.py index c33ab0d7ed..37ca78bdb2 100644 --- a/arviz/tests/base_tests/test_utils.py +++ b/arviz/tests/base_tests/test_utils.py @@ -1,4 +1,5 @@ """Tests for arviz.utils.""" + # pylint: disable=redefined-outer-name, no-member from unittest.mock import Mock diff --git a/arviz/wrappers/__init__.py b/arviz/wrappers/__init__.py index 2d13a71e11..d6de945430 100644 --- a/arviz/wrappers/__init__.py +++ b/arviz/wrappers/__init__.py @@ -1,4 +1,5 @@ """Sampling wrappers.""" + from .base import SamplingWrapper from .wrap_stan import PyStan2SamplingWrapper, PyStanSamplingWrapper, CmdStanPySamplingWrapper from .wrap_pymc import PyMCSamplingWrapper diff --git a/examples/bokeh/bokeh_plot_autocorr.py b/examples/bokeh/bokeh_plot_autocorr.py index 157ff5cc91..918eadbdc8 100644 --- a/examples/bokeh/bokeh_plot_autocorr.py +++ b/examples/bokeh/bokeh_plot_autocorr.py @@ -2,6 +2,7 @@ Autocorrelation Plot ==================== """ + import arviz as az data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_bpv.py b/examples/bokeh/bokeh_plot_bpv.py index b532f2d375..fdc867137a 100644 --- a/examples/bokeh/bokeh_plot_bpv.py +++ b/examples/bokeh/bokeh_plot_bpv.py @@ -2,6 +2,7 @@ Bayesian u-value Plot ===================== """ + import arviz as az data = az.load_arviz_data("regression1d") diff --git a/examples/bokeh/bokeh_plot_bpv_tstat.py b/examples/bokeh/bokeh_plot_bpv_tstat.py index 1b9528ef2d..ee53d79274 100644 --- a/examples/bokeh/bokeh_plot_bpv_tstat.py +++ b/examples/bokeh/bokeh_plot_bpv_tstat.py @@ -2,6 +2,7 @@ Bayesian p-value with T statistic Plot ====================================== """ + import arviz as az data = az.load_arviz_data("regression1d") diff --git a/examples/bokeh/bokeh_plot_compare.py b/examples/bokeh/bokeh_plot_compare.py index 612dd5ebed..b70159a06f 100644 --- a/examples/bokeh/bokeh_plot_compare.py +++ b/examples/bokeh/bokeh_plot_compare.py @@ -2,6 +2,7 @@ Compare Plot ============ """ + import arviz as az model_compare = az.compare( diff --git a/examples/bokeh/bokeh_plot_density.py b/examples/bokeh/bokeh_plot_density.py index 560622a71a..0890d2f964 100644 --- a/examples/bokeh/bokeh_plot_density.py +++ b/examples/bokeh/bokeh_plot_density.py @@ -2,6 +2,7 @@ Density Plot (Comparison) ========================= """ + import arviz as az centered_data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_density_single.py b/examples/bokeh/bokeh_plot_density_single.py index 4f53e69457..645688eb01 100644 --- a/examples/bokeh/bokeh_plot_density_single.py +++ b/examples/bokeh/bokeh_plot_density_single.py @@ -2,6 +2,7 @@ Density Plot ============ """ + import arviz as az centered_data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_dist.py b/examples/bokeh/bokeh_plot_dist.py index 2ea524464e..851e177473 100644 --- a/examples/bokeh/bokeh_plot_dist.py +++ b/examples/bokeh/bokeh_plot_dist.py @@ -2,6 +2,7 @@ Dist Plot Bokeh =============== """ + import bokeh.plotting as bkp import numpy as np from bokeh.layouts import row diff --git a/examples/bokeh/bokeh_plot_dot.py b/examples/bokeh/bokeh_plot_dot.py index 08c69526df..3152dfbfaf 100644 --- a/examples/bokeh/bokeh_plot_dot.py +++ b/examples/bokeh/bokeh_plot_dot.py @@ -2,6 +2,7 @@ Dot Plot ========= """ + import numpy as np import arviz as az diff --git a/examples/bokeh/bokeh_plot_ecdf.py b/examples/bokeh/bokeh_plot_ecdf.py index 386618b3ff..81b40d607d 100644 --- a/examples/bokeh/bokeh_plot_ecdf.py +++ b/examples/bokeh/bokeh_plot_ecdf.py @@ -2,6 +2,7 @@ ECDF Plot ========= """ + from scipy.stats import norm import arviz as az diff --git a/examples/bokeh/bokeh_plot_elpd.py b/examples/bokeh/bokeh_plot_elpd.py index 18480421c5..a83f576286 100644 --- a/examples/bokeh/bokeh_plot_elpd.py +++ b/examples/bokeh/bokeh_plot_elpd.py @@ -2,6 +2,7 @@ ELPD Plot ========= """ + import arviz as az d1 = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_energy.py b/examples/bokeh/bokeh_plot_energy.py index af90086e36..42822a0066 100644 --- a/examples/bokeh/bokeh_plot_energy.py +++ b/examples/bokeh/bokeh_plot_energy.py @@ -2,6 +2,7 @@ Energy Plot =========== """ + import arviz as az data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_ess_evolution.py b/examples/bokeh/bokeh_plot_ess_evolution.py index 8f748ffe4a..f9b922c6b6 100644 --- a/examples/bokeh/bokeh_plot_ess_evolution.py +++ b/examples/bokeh/bokeh_plot_ess_evolution.py @@ -2,6 +2,7 @@ ESS Evolution Plot ================== """ + import arviz as az idata = az.load_arviz_data("radon") diff --git a/examples/bokeh/bokeh_plot_ess_local.py b/examples/bokeh/bokeh_plot_ess_local.py index 229b35ef85..49c58059c1 100644 --- a/examples/bokeh/bokeh_plot_ess_local.py +++ b/examples/bokeh/bokeh_plot_ess_local.py @@ -2,6 +2,7 @@ ESS Local Plot ============== """ + import arviz as az idata = az.load_arviz_data("non_centered_eight") diff --git a/examples/bokeh/bokeh_plot_ess_quantile.py b/examples/bokeh/bokeh_plot_ess_quantile.py index de7e9fd1e8..4dd3ffc81c 100644 --- a/examples/bokeh/bokeh_plot_ess_quantile.py +++ b/examples/bokeh/bokeh_plot_ess_quantile.py @@ -2,6 +2,7 @@ ESS Quantile Plot ================= """ + import arviz as az idata = az.load_arviz_data("radon") diff --git a/examples/bokeh/bokeh_plot_forest.py b/examples/bokeh/bokeh_plot_forest.py index dc710661d1..f9b1ce5925 100644 --- a/examples/bokeh/bokeh_plot_forest.py +++ b/examples/bokeh/bokeh_plot_forest.py @@ -2,6 +2,7 @@ Forest Plot =========== """ + import arviz as az centered_data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_forest_comparison.py b/examples/bokeh/bokeh_plot_forest_comparison.py index 89047b7601..d23f121e8e 100644 --- a/examples/bokeh/bokeh_plot_forest_comparison.py +++ b/examples/bokeh/bokeh_plot_forest_comparison.py @@ -2,6 +2,7 @@ Forest Plot Comparison ====================== """ + import arviz as az centered_data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_forest_mixed.py b/examples/bokeh/bokeh_plot_forest_mixed.py index 7797e581ed..a28926d976 100644 --- a/examples/bokeh/bokeh_plot_forest_mixed.py +++ b/examples/bokeh/bokeh_plot_forest_mixed.py @@ -2,6 +2,7 @@ Forest Plot with ESS ==================== """ + import arviz as az centered_data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_forest_ridge.py b/examples/bokeh/bokeh_plot_forest_ridge.py index 1012e93fc0..4ea0a6eb30 100644 --- a/examples/bokeh/bokeh_plot_forest_ridge.py +++ b/examples/bokeh/bokeh_plot_forest_ridge.py @@ -2,6 +2,7 @@ Ridgeplot ========= """ + import arviz as az rugby_data = az.load_arviz_data("rugby") diff --git a/examples/bokeh/bokeh_plot_hdi.py b/examples/bokeh/bokeh_plot_hdi.py index 32611f2790..008fbebc19 100644 --- a/examples/bokeh/bokeh_plot_hdi.py +++ b/examples/bokeh/bokeh_plot_hdi.py @@ -2,6 +2,7 @@ Plot HDI ======== """ + import bokeh.plotting as bkp import numpy as np diff --git a/examples/bokeh/bokeh_plot_joint.py b/examples/bokeh/bokeh_plot_joint.py index c4d45db8e7..10c6ec5364 100644 --- a/examples/bokeh/bokeh_plot_joint.py +++ b/examples/bokeh/bokeh_plot_joint.py @@ -2,6 +2,7 @@ Joint Plot ========== """ + import arviz as az data = az.load_arviz_data("non_centered_eight") diff --git a/examples/bokeh/bokeh_plot_kde.py b/examples/bokeh/bokeh_plot_kde.py index fafa603297..5f00a7dc8a 100644 --- a/examples/bokeh/bokeh_plot_kde.py +++ b/examples/bokeh/bokeh_plot_kde.py @@ -2,6 +2,7 @@ KDE Plot Bokeh ============== """ + import bokeh.plotting as bkp import numpy as np diff --git a/examples/bokeh/bokeh_plot_kde_2d.py b/examples/bokeh/bokeh_plot_kde_2d.py index e06e52818e..fbecb58c7d 100644 --- a/examples/bokeh/bokeh_plot_kde_2d.py +++ b/examples/bokeh/bokeh_plot_kde_2d.py @@ -2,6 +2,7 @@ 2D KDE ====== """ + import numpy as np import arviz as az diff --git a/examples/bokeh/bokeh_plot_kde_2d_hdi.py b/examples/bokeh/bokeh_plot_kde_2d_hdi.py index e502de918b..f78f3560a1 100644 --- a/examples/bokeh/bokeh_plot_kde_2d_hdi.py +++ b/examples/bokeh/bokeh_plot_kde_2d_hdi.py @@ -2,6 +2,7 @@ 2D KDE with HDI Contours ======================== """ + import numpy as np import arviz as az diff --git a/examples/bokeh/bokeh_plot_kde_quantiles.py b/examples/bokeh/bokeh_plot_kde_quantiles.py index f1a23b76ab..46e88855ee 100644 --- a/examples/bokeh/bokeh_plot_kde_quantiles.py +++ b/examples/bokeh/bokeh_plot_kde_quantiles.py @@ -2,6 +2,7 @@ KDE quantiles Bokeh =================== """ + import numpy as np import arviz as az diff --git a/examples/bokeh/bokeh_plot_khat.py b/examples/bokeh/bokeh_plot_khat.py index 9631d25d6f..5147b08795 100644 --- a/examples/bokeh/bokeh_plot_khat.py +++ b/examples/bokeh/bokeh_plot_khat.py @@ -2,6 +2,7 @@ Pareto Shape Plot ================= """ + import arviz as az idata = az.load_arviz_data("radon") diff --git a/examples/bokeh/bokeh_plot_lm.py b/examples/bokeh/bokeh_plot_lm.py index 8decd8cb99..9eda3e3924 100644 --- a/examples/bokeh/bokeh_plot_lm.py +++ b/examples/bokeh/bokeh_plot_lm.py @@ -2,6 +2,7 @@ Regression Plot. ========================================== """ + import xarray as xr import numpy as np import arviz as az diff --git a/examples/bokeh/bokeh_plot_loo_pit_ecdf.py b/examples/bokeh/bokeh_plot_loo_pit_ecdf.py index 69ff7e2a8b..3ea1b7da79 100644 --- a/examples/bokeh/bokeh_plot_loo_pit_ecdf.py +++ b/examples/bokeh/bokeh_plot_loo_pit_ecdf.py @@ -2,6 +2,7 @@ LOO-PIT ECDF Plot ================= """ + import arviz as az idata = az.load_arviz_data("radon") diff --git a/examples/bokeh/bokeh_plot_loo_pit_overlay.py b/examples/bokeh/bokeh_plot_loo_pit_overlay.py index 2a5f34a427..ec82abe520 100644 --- a/examples/bokeh/bokeh_plot_loo_pit_overlay.py +++ b/examples/bokeh/bokeh_plot_loo_pit_overlay.py @@ -2,6 +2,7 @@ LOO-PIT Overlay Plot ==================== """ + import arviz as az idata = az.load_arviz_data("non_centered_eight") diff --git a/examples/bokeh/bokeh_plot_mcse.py b/examples/bokeh/bokeh_plot_mcse.py index b6914bc8dd..9133133a1d 100644 --- a/examples/bokeh/bokeh_plot_mcse.py +++ b/examples/bokeh/bokeh_plot_mcse.py @@ -2,6 +2,7 @@ Quantile Monte Carlo Standard Error Plot ======================================== """ + import arviz as az data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_mcse_errorbar.py b/examples/bokeh/bokeh_plot_mcse_errorbar.py index 3039251c72..3fcedde638 100644 --- a/examples/bokeh/bokeh_plot_mcse_errorbar.py +++ b/examples/bokeh/bokeh_plot_mcse_errorbar.py @@ -2,6 +2,7 @@ Quantile MCSE Errobar Plot ========================== """ + import arviz as az data = az.load_arviz_data("radon") diff --git a/examples/bokeh/bokeh_plot_pair.py b/examples/bokeh/bokeh_plot_pair.py index 100df753ed..4d88507b70 100644 --- a/examples/bokeh/bokeh_plot_pair.py +++ b/examples/bokeh/bokeh_plot_pair.py @@ -2,6 +2,7 @@ Pair Plot ========= """ + import arviz as az centered = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_pair_hex.py b/examples/bokeh/bokeh_plot_pair_hex.py index fca2ff86c7..c5f4f00aac 100644 --- a/examples/bokeh/bokeh_plot_pair_hex.py +++ b/examples/bokeh/bokeh_plot_pair_hex.py @@ -2,6 +2,7 @@ Hexbin PairPlot =============== """ + import arviz as az centered = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_pair_kde.py b/examples/bokeh/bokeh_plot_pair_kde.py index 72e2be5e38..a26f86bd4c 100644 --- a/examples/bokeh/bokeh_plot_pair_kde.py +++ b/examples/bokeh/bokeh_plot_pair_kde.py @@ -2,6 +2,7 @@ KDE Pair Plot ============= """ + import arviz as az centered = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_pair_kde_hdi.py b/examples/bokeh/bokeh_plot_pair_kde_hdi.py index 6c1c4e5c63..68f746ca80 100644 --- a/examples/bokeh/bokeh_plot_pair_kde_hdi.py +++ b/examples/bokeh/bokeh_plot_pair_kde_hdi.py @@ -2,6 +2,7 @@ KDE Pair Plot with HDI Contours =============================== """ + import arviz as az centered = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_pair_point_estimate.py b/examples/bokeh/bokeh_plot_pair_point_estimate.py index 6739da48ae..8814ada794 100644 --- a/examples/bokeh/bokeh_plot_pair_point_estimate.py +++ b/examples/bokeh/bokeh_plot_pair_point_estimate.py @@ -2,6 +2,7 @@ Point Estimate Pairplot ======================= """ + import arviz as az centered = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_parallel.py b/examples/bokeh/bokeh_plot_parallel.py index 77a8755931..a15d9ac950 100644 --- a/examples/bokeh/bokeh_plot_parallel.py +++ b/examples/bokeh/bokeh_plot_parallel.py @@ -2,6 +2,7 @@ Parallel Plot ============= """ + import arviz as az data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_posterior.py b/examples/bokeh/bokeh_plot_posterior.py index fb0a217557..d464d76a83 100644 --- a/examples/bokeh/bokeh_plot_posterior.py +++ b/examples/bokeh/bokeh_plot_posterior.py @@ -2,6 +2,7 @@ Posterior Plot ============== """ + import arviz as az data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_posterior_combinedims.py b/examples/bokeh/bokeh_plot_posterior_combinedims.py index 3d89637997..98ca826a15 100644 --- a/examples/bokeh/bokeh_plot_posterior_combinedims.py +++ b/examples/bokeh/bokeh_plot_posterior_combinedims.py @@ -2,6 +2,7 @@ Posterior Plot (reducing school dimension) ========================================== """ + import arviz as az data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_ppc.py b/examples/bokeh/bokeh_plot_ppc.py index 42cc9824a4..740fffe607 100644 --- a/examples/bokeh/bokeh_plot_ppc.py +++ b/examples/bokeh/bokeh_plot_ppc.py @@ -2,6 +2,7 @@ Posterior Predictive Check Plot =============================== """ + import arviz as az data = az.load_arviz_data("non_centered_eight") diff --git a/examples/bokeh/bokeh_plot_ppc_cumulative.py b/examples/bokeh/bokeh_plot_ppc_cumulative.py index f8593502a7..6fe8f30024 100644 --- a/examples/bokeh/bokeh_plot_ppc_cumulative.py +++ b/examples/bokeh/bokeh_plot_ppc_cumulative.py @@ -2,6 +2,7 @@ Posterior Predictive Check Cumulative Plot ========================================== """ + import arviz as az data = az.load_arviz_data("non_centered_eight") diff --git a/examples/bokeh/bokeh_plot_rank.py b/examples/bokeh/bokeh_plot_rank.py index 36d9762ae1..97f83c4e0a 100644 --- a/examples/bokeh/bokeh_plot_rank.py +++ b/examples/bokeh/bokeh_plot_rank.py @@ -2,6 +2,7 @@ Rank plot ========= """ + import arviz as az data = az.load_arviz_data("centered_eight") diff --git a/examples/bokeh/bokeh_plot_separation.py b/examples/bokeh/bokeh_plot_separation.py index 9dbcca7c45..181c562c5c 100644 --- a/examples/bokeh/bokeh_plot_separation.py +++ b/examples/bokeh/bokeh_plot_separation.py @@ -2,6 +2,7 @@ Separation Plot =============== """ + import arviz as az idata = az.load_arviz_data("classification10d") diff --git a/examples/bokeh/bokeh_plot_trace.py b/examples/bokeh/bokeh_plot_trace.py index e27ae6130c..73c747dda6 100644 --- a/examples/bokeh/bokeh_plot_trace.py +++ b/examples/bokeh/bokeh_plot_trace.py @@ -2,6 +2,7 @@ Traceplot Bokeh =============== """ + import arviz as az data = az.load_arviz_data("non_centered_eight") diff --git a/examples/bokeh/bokeh_plot_trace_bars.py b/examples/bokeh/bokeh_plot_trace_bars.py index 6d66fdd55b..fb8d0f0305 100644 --- a/examples/bokeh/bokeh_plot_trace_bars.py +++ b/examples/bokeh/bokeh_plot_trace_bars.py @@ -2,6 +2,7 @@ Traceplot rank_bars Bokeh ========================= """ + import arviz as az data = az.load_arviz_data("non_centered_eight") diff --git a/examples/bokeh/bokeh_plot_trace_circ.py b/examples/bokeh/bokeh_plot_trace_circ.py index 681483c584..dc4fae8174 100644 --- a/examples/bokeh/bokeh_plot_trace_circ.py +++ b/examples/bokeh/bokeh_plot_trace_circ.py @@ -2,6 +2,7 @@ Traceplot with Circular Variables ================================= """ + import arviz as az data = az.load_arviz_data("glycan_torsion_angles") diff --git a/examples/bokeh/bokeh_plot_trace_vlines.py b/examples/bokeh/bokeh_plot_trace_vlines.py index 47bbd66ca5..0ba99a30e8 100644 --- a/examples/bokeh/bokeh_plot_trace_vlines.py +++ b/examples/bokeh/bokeh_plot_trace_vlines.py @@ -2,6 +2,7 @@ Traceplot rank_vlines Bokeh =========================== """ + import arviz as az data = az.load_arviz_data("non_centered_eight") diff --git a/examples/bokeh/bokeh_plot_violin.py b/examples/bokeh/bokeh_plot_violin.py index 31f750e485..b592f3312a 100644 --- a/examples/bokeh/bokeh_plot_violin.py +++ b/examples/bokeh/bokeh_plot_violin.py @@ -2,6 +2,7 @@ Violinplot ========== """ + import arviz as az data = az.load_arviz_data("non_centered_eight") diff --git a/examples/bokeh/bokeh_plot_violin_single_sided.py b/examples/bokeh/bokeh_plot_violin_single_sided.py index d8b78ebeef..025f5bf7b5 100644 --- a/examples/bokeh/bokeh_plot_violin_single_sided.py +++ b/examples/bokeh/bokeh_plot_violin_single_sided.py @@ -4,6 +4,7 @@ _thumb: .2, .8 """ + import arviz as az data = az.load_arviz_data("rugby") diff --git a/examples/matplotlib/mpl_plot_autocorr.py b/examples/matplotlib/mpl_plot_autocorr.py index 90350da56c..56ec6ced0f 100644 --- a/examples/matplotlib/mpl_plot_autocorr.py +++ b/examples/matplotlib/mpl_plot_autocorr.py @@ -3,6 +3,7 @@ ==================== _gallery_category: Inference Diagnostics """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_bf.py b/examples/matplotlib/mpl_plot_bf.py index 7158dde857..26bec1a64e 100644 --- a/examples/matplotlib/mpl_plot_bf.py +++ b/examples/matplotlib/mpl_plot_bf.py @@ -3,6 +3,7 @@ ================= _gallery_category: Model Comparison """ + import matplotlib.pyplot as plt import numpy as np import arviz as az diff --git a/examples/matplotlib/mpl_plot_bpv.py b/examples/matplotlib/mpl_plot_bpv.py index ba9cbaf22d..6670647d64 100644 --- a/examples/matplotlib/mpl_plot_bpv.py +++ b/examples/matplotlib/mpl_plot_bpv.py @@ -3,6 +3,7 @@ ===================== _gallery_category: Model Checking """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_bpv_tstat.py b/examples/matplotlib/mpl_plot_bpv_tstat.py index 0ba04830f7..2aaaf87e6b 100644 --- a/examples/matplotlib/mpl_plot_bpv_tstat.py +++ b/examples/matplotlib/mpl_plot_bpv_tstat.py @@ -3,6 +3,7 @@ ====================================== _gallery_category: Model Checking """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_compare.py b/examples/matplotlib/mpl_plot_compare.py index 2c1e33f374..2b088211fb 100644 --- a/examples/matplotlib/mpl_plot_compare.py +++ b/examples/matplotlib/mpl_plot_compare.py @@ -3,6 +3,7 @@ ============ _gallery_category: Model Comparison """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_density.py b/examples/matplotlib/mpl_plot_density.py index 5cf2df2012..a4ba54a970 100644 --- a/examples/matplotlib/mpl_plot_density.py +++ b/examples/matplotlib/mpl_plot_density.py @@ -3,6 +3,7 @@ ========================= _gallery_category: Distribution Comparison """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_density_single.py b/examples/matplotlib/mpl_plot_density_single.py index 5443ec5088..d7c5c36bfe 100644 --- a/examples/matplotlib/mpl_plot_density_single.py +++ b/examples/matplotlib/mpl_plot_density_single.py @@ -3,6 +3,7 @@ ============ _gallery_category: Distributions """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_dist.py b/examples/matplotlib/mpl_plot_dist.py index 56c63928eb..d0fd983c90 100644 --- a/examples/matplotlib/mpl_plot_dist.py +++ b/examples/matplotlib/mpl_plot_dist.py @@ -3,6 +3,7 @@ ========= _gallery_category: Distributions """ + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/matplotlib/mpl_plot_dot.py b/examples/matplotlib/mpl_plot_dot.py index 6576d005bd..cc1d63e6eb 100644 --- a/examples/matplotlib/mpl_plot_dot.py +++ b/examples/matplotlib/mpl_plot_dot.py @@ -3,6 +3,7 @@ ========= _gallery_category: Distributions """ + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/matplotlib/mpl_plot_ecdf.py b/examples/matplotlib/mpl_plot_ecdf.py index 525746f9b1..e1d3abb390 100644 --- a/examples/matplotlib/mpl_plot_ecdf.py +++ b/examples/matplotlib/mpl_plot_ecdf.py @@ -3,6 +3,7 @@ ========= _gallery_category: Distributions """ + import matplotlib.pyplot as plt from scipy.stats import norm diff --git a/examples/matplotlib/mpl_plot_elpd.py b/examples/matplotlib/mpl_plot_elpd.py index 8c8fcae848..affe0980c2 100644 --- a/examples/matplotlib/mpl_plot_elpd.py +++ b/examples/matplotlib/mpl_plot_elpd.py @@ -3,6 +3,7 @@ ========= _gallery_category: Model Comparison """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_energy.py b/examples/matplotlib/mpl_plot_energy.py index 89fe5587ff..2d93f85ed7 100644 --- a/examples/matplotlib/mpl_plot_energy.py +++ b/examples/matplotlib/mpl_plot_energy.py @@ -3,6 +3,7 @@ =========== _gallery_category: Inference Diagnostics """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_ess_evolution.py b/examples/matplotlib/mpl_plot_ess_evolution.py index e36089489d..05c8c71f9a 100644 --- a/examples/matplotlib/mpl_plot_ess_evolution.py +++ b/examples/matplotlib/mpl_plot_ess_evolution.py @@ -3,6 +3,7 @@ ================== _gallery_category: Inference Diagnostics """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_ess_local.py b/examples/matplotlib/mpl_plot_ess_local.py index c766ec33e3..5dc7cfb0e7 100644 --- a/examples/matplotlib/mpl_plot_ess_local.py +++ b/examples/matplotlib/mpl_plot_ess_local.py @@ -3,6 +3,7 @@ ============== _gallery_category: Inference Diagnostics """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_ess_quantile.py b/examples/matplotlib/mpl_plot_ess_quantile.py index 3bcc7a02dd..1db6e8457e 100644 --- a/examples/matplotlib/mpl_plot_ess_quantile.py +++ b/examples/matplotlib/mpl_plot_ess_quantile.py @@ -3,6 +3,7 @@ ================= _gallery_category: Inference Diagnostics """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_forest.py b/examples/matplotlib/mpl_plot_forest.py index d81e4584a5..c9c534c21e 100644 --- a/examples/matplotlib/mpl_plot_forest.py +++ b/examples/matplotlib/mpl_plot_forest.py @@ -3,6 +3,7 @@ =========== _gallery_category: Distributions """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_forest_comparison.py b/examples/matplotlib/mpl_plot_forest_comparison.py index 7663381ad1..6fa95f9daa 100644 --- a/examples/matplotlib/mpl_plot_forest_comparison.py +++ b/examples/matplotlib/mpl_plot_forest_comparison.py @@ -3,6 +3,7 @@ ====================== _gallery_category: Distribution Comparison """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_forest_mixed.py b/examples/matplotlib/mpl_plot_forest_mixed.py index 27a0dda58b..cd22117445 100644 --- a/examples/matplotlib/mpl_plot_forest_mixed.py +++ b/examples/matplotlib/mpl_plot_forest_mixed.py @@ -3,6 +3,7 @@ ==================== _gallery_category: Mixed Plots """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_forest_ridge.py b/examples/matplotlib/mpl_plot_forest_ridge.py index a2c33e7947..b866fdc697 100644 --- a/examples/matplotlib/mpl_plot_forest_ridge.py +++ b/examples/matplotlib/mpl_plot_forest_ridge.py @@ -3,6 +3,7 @@ ========= _gallery_category: Distributions """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_hdi.py b/examples/matplotlib/mpl_plot_hdi.py index 6bab3ddbed..8633263ae1 100644 --- a/examples/matplotlib/mpl_plot_hdi.py +++ b/examples/matplotlib/mpl_plot_hdi.py @@ -3,6 +3,7 @@ ======== _gallery_category: Regression or Time Series """ + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/matplotlib/mpl_plot_joint.py b/examples/matplotlib/mpl_plot_joint.py index e54b013908..9d843cc846 100644 --- a/examples/matplotlib/mpl_plot_joint.py +++ b/examples/matplotlib/mpl_plot_joint.py @@ -3,6 +3,7 @@ ========== _gallery_category: Distributions """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_kde.py b/examples/matplotlib/mpl_plot_kde.py index c43e27989f..b257d7fb44 100644 --- a/examples/matplotlib/mpl_plot_kde.py +++ b/examples/matplotlib/mpl_plot_kde.py @@ -3,6 +3,7 @@ ======== _gallery_category: Distributions """ + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/matplotlib/mpl_plot_kde_2d.py b/examples/matplotlib/mpl_plot_kde_2d.py index d6b83dbab4..a1cb3429e6 100644 --- a/examples/matplotlib/mpl_plot_kde_2d.py +++ b/examples/matplotlib/mpl_plot_kde_2d.py @@ -3,6 +3,7 @@ ====== _gallery_category: Distributions """ + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/matplotlib/mpl_plot_kde_2d_hdi.py b/examples/matplotlib/mpl_plot_kde_2d_hdi.py index bc7349f5ab..56ff338966 100644 --- a/examples/matplotlib/mpl_plot_kde_2d_hdi.py +++ b/examples/matplotlib/mpl_plot_kde_2d_hdi.py @@ -3,6 +3,7 @@ ======================== _gallery_category: Distributions """ + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/matplotlib/mpl_plot_kde_quantiles.py b/examples/matplotlib/mpl_plot_kde_quantiles.py index 614d15e68f..66360e3a09 100644 --- a/examples/matplotlib/mpl_plot_kde_quantiles.py +++ b/examples/matplotlib/mpl_plot_kde_quantiles.py @@ -3,6 +3,7 @@ ============= _gallery_category: Distributions """ + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/matplotlib/mpl_plot_khat.py b/examples/matplotlib/mpl_plot_khat.py index 199a5b5994..0fae1b05bd 100644 --- a/examples/matplotlib/mpl_plot_khat.py +++ b/examples/matplotlib/mpl_plot_khat.py @@ -3,6 +3,7 @@ ================= _gallery_category: Model Comparison """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_lm.py b/examples/matplotlib/mpl_plot_lm.py index 1f8c4f4e79..5f12ce1aba 100644 --- a/examples/matplotlib/mpl_plot_lm.py +++ b/examples/matplotlib/mpl_plot_lm.py @@ -3,6 +3,7 @@ =============== _gallery_category: Regression or Time Series """ + import matplotlib.pyplot as plt import xarray as xr import numpy as np diff --git a/examples/matplotlib/mpl_plot_loo_pit_ecdf.py b/examples/matplotlib/mpl_plot_loo_pit_ecdf.py index 4fd8d2954a..5b528a9cf0 100644 --- a/examples/matplotlib/mpl_plot_loo_pit_ecdf.py +++ b/examples/matplotlib/mpl_plot_loo_pit_ecdf.py @@ -4,6 +4,7 @@ _gallery_category: Model Checking Plot LOO predictive ECDF compared to ECDF of uniform distribution to assess predictive calibration. """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_loo_pit_overlay.py b/examples/matplotlib/mpl_plot_loo_pit_overlay.py index d979bd8173..4c4421c7c7 100644 --- a/examples/matplotlib/mpl_plot_loo_pit_overlay.py +++ b/examples/matplotlib/mpl_plot_loo_pit_overlay.py @@ -3,6 +3,7 @@ ==================== _gallery_category: Model Checking """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_mcse.py b/examples/matplotlib/mpl_plot_mcse.py index 4fb3604643..fb17f7b7ee 100644 --- a/examples/matplotlib/mpl_plot_mcse.py +++ b/examples/matplotlib/mpl_plot_mcse.py @@ -3,6 +3,7 @@ ======================================== _gallery_category: Inference Diagnostics """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_mcse_errorbar.py b/examples/matplotlib/mpl_plot_mcse_errorbar.py index b13b6834d7..80329dc897 100644 --- a/examples/matplotlib/mpl_plot_mcse_errorbar.py +++ b/examples/matplotlib/mpl_plot_mcse_errorbar.py @@ -3,6 +3,7 @@ ========================== _gallery_category: Inference Diagnostics """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_pair.py b/examples/matplotlib/mpl_plot_pair.py index 148f834573..b5656a7038 100644 --- a/examples/matplotlib/mpl_plot_pair.py +++ b/examples/matplotlib/mpl_plot_pair.py @@ -3,6 +3,7 @@ ========= _gallery_category: Inference Diagnostics """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_pair_hex.py b/examples/matplotlib/mpl_plot_pair_hex.py index 6f184a65e8..604bef9e60 100644 --- a/examples/matplotlib/mpl_plot_pair_hex.py +++ b/examples/matplotlib/mpl_plot_pair_hex.py @@ -3,6 +3,7 @@ =============== _gallery_category: Distributions """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_pair_kde.py b/examples/matplotlib/mpl_plot_pair_kde.py index ee920a1391..339a5ccd66 100644 --- a/examples/matplotlib/mpl_plot_pair_kde.py +++ b/examples/matplotlib/mpl_plot_pair_kde.py @@ -3,6 +3,7 @@ ============= _gallery_category: Distributions """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_pair_kde_hdi.py b/examples/matplotlib/mpl_plot_pair_kde_hdi.py index bfee1f5d11..1348242dd1 100644 --- a/examples/matplotlib/mpl_plot_pair_kde_hdi.py +++ b/examples/matplotlib/mpl_plot_pair_kde_hdi.py @@ -3,6 +3,7 @@ =============================== _gallery_category: Distributions """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_pair_point_estimate.py b/examples/matplotlib/mpl_plot_pair_point_estimate.py index 5c046c35d4..6bb1765f33 100644 --- a/examples/matplotlib/mpl_plot_pair_point_estimate.py +++ b/examples/matplotlib/mpl_plot_pair_point_estimate.py @@ -3,6 +3,7 @@ ======================= _gallery_category: Distributions """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_parallel.py b/examples/matplotlib/mpl_plot_parallel.py index 2c2260b447..b0febcfe3b 100644 --- a/examples/matplotlib/mpl_plot_parallel.py +++ b/examples/matplotlib/mpl_plot_parallel.py @@ -3,6 +3,7 @@ ============= _gallery_category: Inference Diagnostics """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_posterior.py b/examples/matplotlib/mpl_plot_posterior.py index 3ab5fcfcf6..ff5677656f 100644 --- a/examples/matplotlib/mpl_plot_posterior.py +++ b/examples/matplotlib/mpl_plot_posterior.py @@ -3,6 +3,7 @@ ============== _gallery_category: Distributions """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_posterior_combinedims.py b/examples/matplotlib/mpl_plot_posterior_combinedims.py index cac8c6dd44..0d22000190 100644 --- a/examples/matplotlib/mpl_plot_posterior_combinedims.py +++ b/examples/matplotlib/mpl_plot_posterior_combinedims.py @@ -3,6 +3,7 @@ ========================================== _gallery_category: Distributions """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_ppc.py b/examples/matplotlib/mpl_plot_ppc.py index 37f7e40fd9..8f7d7ca177 100644 --- a/examples/matplotlib/mpl_plot_ppc.py +++ b/examples/matplotlib/mpl_plot_ppc.py @@ -3,6 +3,7 @@ =============================== _gallery_category: Model Checking """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_ppc_cumulative.py b/examples/matplotlib/mpl_plot_ppc_cumulative.py index 7254b9dbe8..682624cda1 100644 --- a/examples/matplotlib/mpl_plot_ppc_cumulative.py +++ b/examples/matplotlib/mpl_plot_ppc_cumulative.py @@ -3,6 +3,7 @@ ========================================== _gallery_category: Model Checking """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_rank.py b/examples/matplotlib/mpl_plot_rank.py index e65e77e225..7fb27e4540 100644 --- a/examples/matplotlib/mpl_plot_rank.py +++ b/examples/matplotlib/mpl_plot_rank.py @@ -3,6 +3,7 @@ ========= _gallery_category: Inference Diagnostics """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_separation.py b/examples/matplotlib/mpl_plot_separation.py index 340e96f627..33bd11448c 100644 --- a/examples/matplotlib/mpl_plot_separation.py +++ b/examples/matplotlib/mpl_plot_separation.py @@ -3,6 +3,7 @@ =============== _gallery_category: Model Checking """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_trace.py b/examples/matplotlib/mpl_plot_trace.py index a5415535d7..582fae1853 100644 --- a/examples/matplotlib/mpl_plot_trace.py +++ b/examples/matplotlib/mpl_plot_trace.py @@ -3,6 +3,7 @@ ========= _gallery_category: Mixed Plots """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_trace_bars.py b/examples/matplotlib/mpl_plot_trace_bars.py index 4412a748c9..5713169d00 100644 --- a/examples/matplotlib/mpl_plot_trace_bars.py +++ b/examples/matplotlib/mpl_plot_trace_bars.py @@ -3,6 +3,7 @@ ============================= _gallery_category: Mixed Plots """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_trace_circ.py b/examples/matplotlib/mpl_plot_trace_circ.py index 7bce71e2f5..5008259453 100644 --- a/examples/matplotlib/mpl_plot_trace_circ.py +++ b/examples/matplotlib/mpl_plot_trace_circ.py @@ -3,6 +3,7 @@ ================================= _gallery_category: Mixed Plots """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_trace_vlines.py b/examples/matplotlib/mpl_plot_trace_vlines.py index 23782469c6..6bde848cc5 100644 --- a/examples/matplotlib/mpl_plot_trace_vlines.py +++ b/examples/matplotlib/mpl_plot_trace_vlines.py @@ -3,6 +3,7 @@ ===================== _gallery_category: Mixed Plots """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_violin.py b/examples/matplotlib/mpl_plot_violin.py index a7c199f338..25e94b673c 100644 --- a/examples/matplotlib/mpl_plot_violin.py +++ b/examples/matplotlib/mpl_plot_violin.py @@ -3,6 +3,7 @@ =========== _gallery_category: Distributions """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_plot_violin_single_sided.py b/examples/matplotlib/mpl_plot_violin_single_sided.py index 55bbff3e27..c9c3a7011c 100644 --- a/examples/matplotlib/mpl_plot_violin_single_sided.py +++ b/examples/matplotlib/mpl_plot_violin_single_sided.py @@ -3,6 +3,7 @@ ======================== _gallery_category: Distribution Comparison """ + import matplotlib.pyplot as plt import arviz as az diff --git a/examples/matplotlib/mpl_styles.py b/examples/matplotlib/mpl_styles.py index 0be19a4cd4..5017b6a0f3 100644 --- a/examples/matplotlib/mpl_styles.py +++ b/examples/matplotlib/mpl_styles.py @@ -4,6 +4,7 @@ _gallery_category: Styles _alt_text: Use Matplotlib Styles with `arviz.style.use()`. """ + import matplotlib.pyplot as plt import numpy as np from scipy import stats diff --git a/requirements-dev.txt b/requirements-dev.txt index 862322c6cb..61574f2257 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -6,5 +6,5 @@ pydocstyle pylint pytest pytest-cov -black==23.11.0 +black==24.3.0 cloudpickle<1.5.0 From beb6ad9e23c8197a220164fc7c0b2c97110b8a59 Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Tue, 26 Mar 2024 01:10:46 +0100 Subject: [PATCH 3/6] fix deprecation warnings --- arviz/plots/backends/bokeh/kdeplot.py | 4 ++-- arviz/plots/backends/matplotlib/kdeplot.py | 7 ++++--- arviz/plots/backends/matplotlib/violinplot.py | 2 +- arviz/stats/diagnostics.py | 4 ++-- arviz/stats/stats_utils.py | 5 ++++- arviz/tests/base_tests/test_plots_matplotlib.py | 8 ++++---- arviz/tests/base_tests/test_stats.py | 8 ++++---- arviz/tests/base_tests/test_utils.py | 4 ++-- arviz/tests/helpers.py | 2 +- 9 files changed, 24 insertions(+), 20 deletions(-) diff --git a/arviz/plots/backends/bokeh/kdeplot.py b/arviz/plots/backends/bokeh/kdeplot.py index 3b22c8993f..9b3f7f4fd0 100644 --- a/arviz/plots/backends/bokeh/kdeplot.py +++ b/arviz/plots/backends/bokeh/kdeplot.py @@ -6,7 +6,7 @@ import numpy as np from bokeh.models import ColumnDataSource from bokeh.models.glyphs import Scatter -from matplotlib.cm import get_cmap +from matplotlib import colormaps from matplotlib.colors import rgb2hex from matplotlib.pyplot import rcParams as mpl_rcParams @@ -188,7 +188,7 @@ def plot_kde( cmap = contourf_kwargs.pop("cmap", "viridis") if isinstance(cmap, str): - cmap = get_cmap(cmap) + cmap = colormaps[cmap] if isinstance(cmap, Callable): colors = [rgb2hex(item) for item in cmap(np.linspace(0, 1, len(levels_scaled) + 1))] else: diff --git a/arviz/plots/backends/matplotlib/kdeplot.py b/arviz/plots/backends/matplotlib/kdeplot.py index 63a204f7ff..5fff7ef9b2 100644 --- a/arviz/plots/backends/matplotlib/kdeplot.py +++ b/arviz/plots/backends/matplotlib/kdeplot.py @@ -163,10 +163,11 @@ def plot_kde( ax.grid(False) if contour: qcfs = ax.contourf(x_x, y_y, density, antialiased=True, **contourf_kwargs) - qcs = ax.contour(x_x, y_y, density, **contour_kwargs) + ax.contour(x_x, y_y, density, **contour_kwargs) if not fill_last: - qcfs.collections[0].set_alpha(0) - qcs.collections[0].set_alpha(0) + alpha = np.ones(len(qcfs.allsegs), dtype=float) + alpha[0] = 0 + qcfs.set_alpha(alpha) else: ax.pcolormesh(x_x, y_y, density, **pcolormesh_kwargs) diff --git a/arviz/plots/backends/matplotlib/violinplot.py b/arviz/plots/backends/matplotlib/violinplot.py index 640101b692..b7ae8be7ca 100644 --- a/arviz/plots/backends/matplotlib/violinplot.py +++ b/arviz/plots/backends/matplotlib/violinplot.py @@ -61,7 +61,7 @@ def plot_violin( cols, backend_kwargs=backend_kwargs, ) - fig.set_constrained_layout(False) + fig.set_layout_engine("none") fig.subplots_adjust(wspace=0) ax = np.atleast_1d(ax) diff --git a/arviz/stats/diagnostics.py b/arviz/stats/diagnostics.py index 8430479c15..3a930d8554 100644 --- a/arviz/stats/diagnostics.py +++ b/arviz/stats/diagnostics.py @@ -836,7 +836,7 @@ def _mcse_sd(ary): return np.nan ess = _ess_sd(ary) if _numba_flag: - sd = float(_sqrt(svar(np.ravel(ary), ddof=1), np.zeros(1))) + sd = float(_sqrt(svar(np.ravel(ary), ddof=1), np.zeros(1)).item()) else: sd = np.std(ary, ddof=1) fac_mcse_sd = np.sqrt(np.exp(1) * (1 - 1 / ess) ** (ess - 1) - 1) @@ -904,7 +904,7 @@ def _mc_error(ary, batches=5, circular=False): else: std = stats.circstd(ary, high=np.pi, low=-np.pi) elif _numba_flag: - std = float(_sqrt(svar(ary), np.zeros(1))) + std = float(_sqrt(svar(ary), np.zeros(1)).item()) else: std = np.std(ary) return std / np.sqrt(len(ary)) diff --git a/arviz/stats/stats_utils.py b/arviz/stats/stats_utils.py index cb05694709..7a5772f920 100644 --- a/arviz/stats/stats_utils.py +++ b/arviz/stats/stats_utils.py @@ -135,7 +135,10 @@ def _ufunc(*args, out=None, out_shape=None, **kwargs): raise TypeError(msg) for idx in np.ndindex(out.shape[:n_dims_out]): arys_idx = [ary[idx].ravel() if ravel else ary[idx] for ary in arys] - out[idx] = np.asarray(func(*arys_idx, *args[n_input:], **kwargs))[index] + out_idx = np.asarray(func(*arys_idx, *args[n_input:], **kwargs))[index] + if n_dims_out is None: + out_idx = out_idx.item() + out[idx] = out_idx return out def _multi_ufunc(*args, out=None, out_shape=None, **kwargs): diff --git a/arviz/tests/base_tests/test_plots_matplotlib.py b/arviz/tests/base_tests/test_plots_matplotlib.py index 399113ccac..8b56ed2138 100644 --- a/arviz/tests/base_tests/test_plots_matplotlib.py +++ b/arviz/tests/base_tests/test_plots_matplotlib.py @@ -55,7 +55,7 @@ eight_schools_params, models, multidim_models, - TestRandomVariable, + RandomVariableTestClass, ) rcParams["data.load"] = "eager" @@ -169,9 +169,9 @@ def test_plot_density_no_subset(): def test_plot_density_nonstring_varnames(): """Test plot_density works when variables are not strings.""" - rv1 = TestRandomVariable("a") - rv2 = TestRandomVariable("b") - rv3 = TestRandomVariable("c") + rv1 = RandomVariableTestClass("a") + rv2 = RandomVariableTestClass("b") + rv3 = RandomVariableTestClass("c") model_ab = from_dict( { rv1: np.random.normal(size=200), diff --git a/arviz/tests/base_tests/test_stats.py b/arviz/tests/base_tests/test_stats.py index 413624d5ce..3820ff364c 100644 --- a/arviz/tests/base_tests/test_stats.py +++ b/arviz/tests/base_tests/test_stats.py @@ -89,25 +89,25 @@ def test_hdi_idata(centered_eight): data = centered_eight.posterior result = hdi(data) assert isinstance(result, Dataset) - assert dict(result.dims) == {"school": 8, "hdi": 2} + assert dict(result.sizes) == {"school": 8, "hdi": 2} result = hdi(data, input_core_dims=[["chain"]]) assert isinstance(result, Dataset) - assert result.dims == {"draw": 500, "hdi": 2, "school": 8} + assert result.sizes == {"draw": 500, "hdi": 2, "school": 8} def test_hdi_idata_varnames(centered_eight): data = centered_eight.posterior result = hdi(data, var_names=["mu", "theta"]) assert isinstance(result, Dataset) - assert result.dims == {"hdi": 2, "school": 8} + assert result.sizes == {"hdi": 2, "school": 8} assert list(result.data_vars.keys()) == ["mu", "theta"] def test_hdi_idata_group(centered_eight): result_posterior = hdi(centered_eight, group="posterior", var_names="mu") result_prior = hdi(centered_eight, group="prior", var_names="mu") - assert result_prior.dims == {"hdi": 2} + assert result_prior.sizes == {"hdi": 2} range_posterior = result_posterior.mu.values[1] - result_posterior.mu.values[0] range_prior = result_prior.mu.values[1] - result_prior.mu.values[0] assert range_posterior < range_prior diff --git a/arviz/tests/base_tests/test_utils.py b/arviz/tests/base_tests/test_utils.py index 37ca78bdb2..4f03b43afe 100644 --- a/arviz/tests/base_tests/test_utils.py +++ b/arviz/tests/base_tests/test_utils.py @@ -18,7 +18,7 @@ one_de, two_de, ) -from ..helpers import TestRandomVariable +from ..helpers import RandomVariableTestClass @pytest.fixture(scope="session") @@ -124,7 +124,7 @@ def test_var_names_filter(var_args): def test_nonstring_var_names(): """Check that non-string variables are preserved""" - mu = TestRandomVariable("mu") + mu = RandomVariableTestClass("mu") samples = np.random.randn(10) data = dict_to_dataset({mu: samples}) assert _var_names([mu], data) == [mu] diff --git a/arviz/tests/helpers.py b/arviz/tests/helpers.py index faba35fdd5..15dbd95689 100644 --- a/arviz/tests/helpers.py +++ b/arviz/tests/helpers.py @@ -18,7 +18,7 @@ _log = logging.getLogger(__name__) -class TestRandomVariable: +class RandomVariableTestClass: """Example class for random variables.""" def __init__(self, name): From 868c6970cb1843cfbb828c1df6a7c5b9da077350 Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Tue, 26 Mar 2024 01:14:28 +0100 Subject: [PATCH 4/6] update changelog --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 449690b02b..2f65842210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,12 @@ ### New features - Add new example data `rugby_field` and update `rugby` example data ([2322](https://github.com/arviz-devs/arviz/pull/2322)) - -- Support for `pytree`s and robust to nested dictionaries. (2291) +- Support for `pytree`s and robust to nested dictionaries. ([2291](https://github.com/arviz-devs/arviz/pull/2291)) ### Maintenance and fixes +- Fix deprecation warnings in multiple dependencies ([2329](https://github.com/arviz-devs/arviz/pull/2329), + [2332](https://github.com/arviz-devs/arviz/pull/2332) and [2333](https://github.com/arviz-devs/arviz/pull/2333)) ### Deprecation From 07a819b02224b2264d61caf056d4acc939fa3c8f Mon Sep 17 00:00:00 2001 From: "Oriol (ProDesk)" Date: Tue, 26 Mar 2024 01:45:42 +0100 Subject: [PATCH 5/6] fix missed rename --- arviz/plots/backends/bokeh/kdeplot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arviz/plots/backends/bokeh/kdeplot.py b/arviz/plots/backends/bokeh/kdeplot.py index 9b3f7f4fd0..3b89075908 100644 --- a/arviz/plots/backends/bokeh/kdeplot.py +++ b/arviz/plots/backends/bokeh/kdeplot.py @@ -225,7 +225,7 @@ def plot_kde( else: cmap = pcolormesh_kwargs.pop("cmap", "viridis") if isinstance(cmap, str): - cmap = get_cmap(cmap) + cmap = colormaps[cmap] if isinstance(cmap, Callable): colors = [rgb2hex(item) for item in cmap(np.linspace(0, 1, 256))] else: From 12fff993df4c227e1db71670851dd4b035204917 Mon Sep 17 00:00:00 2001 From: "Oriol (ProDesk)" Date: Tue, 26 Mar 2024 15:54:55 +0100 Subject: [PATCH 6/6] fix inferencedata style.css --- arviz/static/css/style.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arviz/static/css/style.css b/arviz/static/css/style.css index c257e909b9..f2d5dc60f1 100644 --- a/arviz/static/css/style.css +++ b/arviz/static/css/style.css @@ -302,7 +302,8 @@ dl.xr-attrs { grid-template-columns: 125px auto; } -.xr-attrs dt, dd { +.xr-attrs dt, +.xr-attrs dd { padding: 0; margin: 0; float: left;