mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-16 20:43:41 +02:00
Merge branch 'develop' into documentation
This commit is contained in:
commit
83a9ff2b4a
2 changed files with 22 additions and 2 deletions
|
@ -571,9 +571,15 @@ class Obs:
|
||||||
plt.title(e_name + f'\nskew: {skew(y_test):.3f} (p={skewtest(y_test).pvalue:.3f}), kurtosis: {kurtosis(y_test):.3f} (p={kurtosistest(y_test).pvalue:.3f})')
|
plt.title(e_name + f'\nskew: {skew(y_test):.3f} (p={skewtest(y_test).pvalue:.3f}), kurtosis: {kurtosis(y_test):.3f} (p={kurtosistest(y_test).pvalue:.3f})')
|
||||||
plt.draw()
|
plt.draw()
|
||||||
|
|
||||||
def plot_piechart(self):
|
def plot_piechart(self, save=None):
|
||||||
"""Plot piechart which shows the fractional contribution of each
|
"""Plot piechart which shows the fractional contribution of each
|
||||||
ensemble to the error and returns a dictionary containing the fractions."""
|
ensemble to the error and returns a dictionary containing the fractions.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
save : str
|
||||||
|
saves the figure to a file named 'save' if.
|
||||||
|
"""
|
||||||
if not hasattr(self, 'e_dvalue'):
|
if not hasattr(self, 'e_dvalue'):
|
||||||
raise Exception('Run the gamma method first.')
|
raise Exception('Run the gamma method first.')
|
||||||
if np.isclose(0.0, self._dvalue, atol=1e-15):
|
if np.isclose(0.0, self._dvalue, atol=1e-15):
|
||||||
|
@ -584,6 +590,8 @@ class Obs:
|
||||||
ax1.pie(sizes, labels=labels, startangle=90, normalize=True)
|
ax1.pie(sizes, labels=labels, startangle=90, normalize=True)
|
||||||
ax1.axis('equal')
|
ax1.axis('equal')
|
||||||
plt.draw()
|
plt.draw()
|
||||||
|
if save:
|
||||||
|
fig1.savefig(save)
|
||||||
|
|
||||||
return dict(zip(self.e_names, sizes))
|
return dict(zip(self.e_names, sizes))
|
||||||
|
|
||||||
|
|
|
@ -278,6 +278,18 @@ def test_matrix_corr():
|
||||||
corr_0.matrix_symmetric()
|
corr_0.matrix_symmetric()
|
||||||
|
|
||||||
|
|
||||||
|
def test_matrix_symmetric():
|
||||||
|
corr_aa = _gen_corr(1)
|
||||||
|
corr_ab = _gen_corr(0.3)
|
||||||
|
corr_ba = _gen_corr(0.2)
|
||||||
|
corr_bb = _gen_corr(0.8)
|
||||||
|
corr_mat = pe.Corr(np.array([[corr_aa, corr_ab], [corr_ba, corr_bb]]))
|
||||||
|
|
||||||
|
sym_corr_mat = corr_mat.matrix_symmetric()
|
||||||
|
|
||||||
|
assert np.all([np.all(o == o.T) for o in sym_corr_mat])
|
||||||
|
|
||||||
|
|
||||||
def test_hankel():
|
def test_hankel():
|
||||||
corr_content = []
|
corr_content = []
|
||||||
for t in range(8):
|
for t in range(8):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue