diff --git a/bebi103/__init__.py b/bebi103/__init__.py index d56be3b..42c0895 100644 --- a/bebi103/__init__.py +++ b/bebi103/__init__.py @@ -47,4 +47,4 @@ __author__ = """Justin Bois""" __email__ = "bois@caltech.edu" -__version__ = "0.1.3" +__version__ = "0.1.4" diff --git a/bebi103/gp.py b/bebi103/gp.py index d5eb194..260422d 100644 --- a/bebi103/gp.py +++ b/bebi103/gp.py @@ -445,7 +445,7 @@ def _d1_se_kernel(x1, x2, alpha, rho): x_diff = x1 - x2 rho2 = rho ** 2 - return -alpha ** 2 * x_diff * np.exp(-x_diff ** 2 / 2.0 / rho2) / rho2 + return -(alpha ** 2) * x_diff * np.exp(-(x_diff ** 2) / 2.0 / rho2) / rho2 @numba.njit @@ -457,10 +457,10 @@ def _d2_se_kernel(x1, x2, alpha, rho): @numba.njit def _d1_d2_se_kernel(x1, x2, alpha, rho): """Derivative of first variable of squared exponential kernel.""" - x_diff2 = (x1 - x2)**2 - rho2 = rho**2 + x_diff2 = (x1 - x2) ** 2 + rho2 = rho ** 2 - return (alpha / rho)**2 * np.exp(-x_diff2 / 2.0 / rho2) * (1 - x_diff2 / rho2) + return (alpha / rho) ** 2 * np.exp(-x_diff2 / 2.0 / rho2) * (1 - x_diff2 / rho2) def _matern_kernel(x1, x2, alpha, rho, nu): @@ -951,4 +951,3 @@ def _solve_mean_cov(y, Ky, Kstar, Kstarstar, delta): ) return mstar, Sigmastar - diff --git a/bebi103/image.py b/bebi103/image.py index 5632447..87b5b64 100644 --- a/bebi103/image.py +++ b/bebi103/image.py @@ -21,6 +21,7 @@ from . import viz from . import utils + def imshow( im, cmap=None, diff --git a/bebi103/stan.py b/bebi103/stan.py index 91996b5..111bb44 100644 --- a/bebi103/stan.py +++ b/bebi103/stan.py @@ -53,6 +53,7 @@ from . import viz + def StanModel( file=None, charset="utf-8", @@ -447,7 +448,7 @@ def df_to_datadict_hier( return data, new_df -def arviz_to_dataframe(data, var_names=None, diagnostics=('diverging',)): +def arviz_to_dataframe(data, var_names=None, diagnostics=("diverging",)): """Convert ArviZ InferenceData to a Pandas data frame. Any multi-dimensional parameters are converted to one-dimensional @@ -502,12 +503,14 @@ def arviz_to_dataframe(data, var_names=None, diagnostics=('diverging',)): diag_dict = {} if diagnostics is not None and len(diagnostics) > 0: if not hasattr(data, "sample_stats"): - raise RuntimeError("Asking for diagnostics, but input has not attribute sample_stats") + raise RuntimeError( + "Asking for diagnostics, but input has not attribute sample_stats" + ) for diag in diagnostics: if hasattr(data.sample_stats, diag): diag_dict[diag + "__"] = np.ravel(data.sample_stats[diag]) else: - raise RuntimeError(f'{diag} not in data.sample_stats.') + raise RuntimeError(f"{diag} not in data.sample_stats.") cols, data_as_ndarray = _xarray_to_ndarray(data.posterior, var_names=var_names) @@ -1715,7 +1718,9 @@ def _xarray_to_ndarray(ds, var_names=None, omit_dunders=True): """ - names, vals = arviz.plots.plot_utils.xarray_to_ndarray(ds, var_names=var_names, combined=True) + names, vals = arviz.plots.plot_utils.xarray_to_ndarray( + ds, var_names=var_names, combined=True + ) names = [ name.replace("\n", "[").replace(", ", ",") + "]" if "\n" in name else name