Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew McCluskey committed Apr 23, 2020
1 parent f7b2e65 commit 10dc169
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion uravu/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def __str__(self):
representation += "{}\n".format(ufloat(self.n, self.s))
else:
representation += "{:.2e}+{:.2e}-{:.2e}\n".format(
self.n, self.con_int[1]-self.n, self.n-self.con_int[0]
self.n, self.con_int[1] - self.n, self.n - self.con_int[0]
)
representation += "Unit: {}\n".format(self.unit)
representation += "Normal: {}\n".format(self.normal)
Expand Down
1 change: 0 additions & 1 deletion uravu/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,3 @@ def ln_likelihood(
else:
sigma2 = dy_data ** 2 + model ** 2 * np.exp(2 * log_f)
return -0.5 * np.sum((model - y_data) ** 2 / sigma2 + np.log(sigma2))

7 changes: 5 additions & 2 deletions uravu/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
from scipy.stats import gaussian_kde
from uravu import UREG, _fig_params
from uravu.distribution import Distribution

try:
import matplotlib.pyplot as plt
from corner import corner
except ModuleNotFoundError:
print("The matplotlib and corner packages are necessary for the use of "
"the plotting module, please install these.")
print(
"The matplotlib and corner packages are necessary for the use of "
"the plotting module, please install these."
)


def plot_relationship(
Expand Down
12 changes: 6 additions & 6 deletions uravu/relationship.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ def __init__(
if ordinate_uncertainty is None:
self.unaccounted_uncertainty = True
self.ordinate = ordinate
else:
else:
if ordinate_uncertainty.shape != ordinate.shape:
raise ValueError(
"The number of data points in the ordinate does not "
"match that in the ordinate uncertainty."
)
"The number of data points in the ordinate does not "
"match that in the ordinate uncertainty."
)
else:
ordinate_uncertainty = np.array(ordinate_uncertainty)
self.ordinate = unp.uarray(ordinate, ordinate_uncertainty)
self.ordinate = unp.uarray(ordinate, ordinate_uncertainty)
self.ordinate *= ordinate_unit

self.abscissa = abscissa
Expand Down Expand Up @@ -480,7 +480,7 @@ def mcmc(
n_samples=500,
n_burn=500,
progress=True,
seed=None
seed=None,
):
"""
Perform MCMC to get the posterior probability distributions for the variables of the relationship. *Note*, running this method will populate the :py:attr:`~uravu.relationship.Relationship.variables` attribute with :py:class:`~uravu.distribution.Distribution` objects.
Expand Down
6 changes: 5 additions & 1 deletion uravu/tests/test_optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ def test_ln_likelihood_b(self):
)
expected_lnl = -45.21054955719477
actual_lnl = optimize.ln_likelihood(
test_rel.variables, test_rel.function, test_rel.x, test_rel.y, unaccounted_uncertainty=test_rel.unaccounted_uncertainty
test_rel.variables,
test_rel.function,
test_rel.x,
test_rel.y,
unaccounted_uncertainty=test_rel.unaccounted_uncertainty,
)
assert_almost_equal(actual_lnl, expected_lnl)

Expand Down
3 changes: 1 addition & 2 deletions uravu/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""
A few additional utility functions to improve the usability of
``uravu``.
A few additional utility functions to improve the usability of :py:mod`uravu`.
"""

# Copyright (c) Andrew R. McCluskey
Expand Down

0 comments on commit 10dc169

Please sign in to comment.