|
1 |
| -from .autocorrplot import autocorrplot |
2 |
| -from .compareplot import compareplot |
3 |
| -from .forestplot import forestplot |
4 |
| -from .kdeplot import kdeplot |
5 |
| -from .posteriorplot import plot_posterior, plot_posterior_predictive_glm |
6 |
| -from .traceplot import traceplot |
7 |
| -from .energyplot import energyplot |
8 |
| -from .densityplot import densityplot |
9 |
| -from .pairplot import pairplot |
| 1 | +try: |
| 2 | + import arviz as az |
| 3 | +except ImportError: # arviz is optional, throw exception when used |
| 4 | + |
| 5 | + class _ImportWarner: |
| 6 | + def __init__(self, attr): |
| 7 | + self.attr = attr |
| 8 | + |
| 9 | + def __call__(self, *args, **kwargs): |
| 10 | + raise ImportError( |
| 11 | + f"ArviZ is not installed. In order to use `{self.attr}`:\npip install arviz" |
| 12 | + ) |
| 13 | + |
| 14 | + class _ArviZ: |
| 15 | + def __getattr__(self, attr): |
| 16 | + return _ImportWarner(attr) |
| 17 | + |
| 18 | + az = _ArviZ() |
| 19 | + |
| 20 | + |
| 21 | +autocorrplot = az.plot_autocorr |
| 22 | +compareplot = az.plot_compare |
| 23 | +forestplot = az.plot_forest |
| 24 | +kdeplot = az.plot_kde |
| 25 | +plot_posterior = az.plot_posterior |
| 26 | +traceplot = az.plot_trace |
| 27 | +energyplot = az.plot_energy |
| 28 | +densityplot = az.plot_density |
| 29 | +pairplot = az.plot_pair |
| 30 | + |
| 31 | +from .posteriorplot import plot_posterior_predictive_glm |
0 commit comments