Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor bug fixes #314

Merged
merged 20 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1f905e3
version bump to 2.0.1
lukashergt Jul 17, 2023
1f479b7
add test for `beta` kwarg in WeightedDataFrame method `neff`
lukashergt Jul 17, 2023
a42b981
fix missing `beta` kwarg in `WeightedDataFrame.neff`
lukashergt Jul 17, 2023
e38462e
remove the ylabel from `plot_1d`, otherwise pandas adds in the label …
lukashergt Jul 17, 2023
026f156
Merge branch 'master' into fix_missing_kwarg_in_neff
williamjameshandley Jul 19, 2023
5dc430a
Merge branch 'master' into fix_missing_kwarg_in_neff
lukashergt Jul 19, 2023
f810b83
remove the 1d ylabel also from `plot_2d`, otherwise pandas again puts…
lukashergt Jul 20, 2023
4418cd0
add `kind=fastkde` shortcut to `plot_2d`
lukashergt Jul 20, 2023
0085b4c
add test that checks that the 1d ylabels are indeed empty
lukashergt Jul 20, 2023
ffca273
add `fig.align_labels()` to 2d plots, which aligns labels independent…
lukashergt Jul 20, 2023
9925b07
Neater way to correct for Frequency
williamjameshandley Jul 24, 2023
f83e132
Removed blank lines
williamjameshandley Jul 24, 2023
b02eb54
Added a test to check for frequency
williamjameshandley Jul 24, 2023
8cad72b
Removed previous fix
williamjameshandley Jul 24, 2023
4c5d32b
Fix for ranges
williamjameshandley Jul 24, 2023
28fc103
Added tests to explictly check axes are adjusting correctly
williamjameshandley Jul 24, 2023
5267daa
no support for horizontal
williamjameshandley Jul 24, 2023
50601e4
Corrected ranges
williamjameshandley Jul 24, 2023
c4410fa
Merge branch 'master' into fix_missing_kwarg_in_neff
williamjameshandley Jul 26, 2023
b3dfee7
Bumped version
williamjameshandley Jul 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
anesthetic: nested sampling post-processing
===========================================
:Authors: Will Handley and Lukas Hergt
:Version: 2.0.0
:Version: 2.0.1
:Homepage: https://github.com/handley-lab/anesthetic
:Documentation: http://anesthetic.readthedocs.io/

Expand Down
2 changes: 1 addition & 1 deletion anesthetic/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0.0'
__version__ = '2.0.1'
1 change: 1 addition & 0 deletions anesthetic/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def plot_1d(self, axes=None, *args, **kwargs):
self[x].plot(ax=ax, xlabel=xlabel,
*args, **kwargs)
ax.set_xlabel(xlabel)
ax.set_ylabel("")
else:
ax.plot([], [])

Expand Down
6 changes: 3 additions & 3 deletions anesthetic/weighted_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pandas.util._exceptions import find_stack_level
from pandas.util import hash_pandas_object
from numpy.ma import masked_array
from anesthetic.utils import (compress_weights, neff as neff_, quantile,
from anesthetic.utils import (compress_weights, neff, quantile,
temporary_seed, adjust_docstrings)
from pandas.core.dtypes.missing import notna

Expand Down Expand Up @@ -222,10 +222,10 @@ def reset_index(self, level=None, drop=False, inplace=False,
else:
return answer.__finalize__(self, "reset_index")

def neff(self, axis=0):
def neff(self, axis=0, beta=1):
"""Effective number of samples."""
if self.isweighted(axis):
return neff_(self.get_weights(axis))
return neff(self.get_weights(axis), beta=beta)
else:
return self.shape[axis]

Expand Down
20 changes: 12 additions & 8 deletions tests/test_weighted_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,18 @@ def test_WeightedDataFrame_sample(frame):


def test_WeightedDataFrame_neff(frame):
neff = frame.neff()
assert isinstance(neff, float)
assert neff < len(frame)
assert neff > len(frame) * np.exp(-0.25)

neff = frame.neff(1)
assert isinstance(neff, int)
assert neff == len(frame.T)
N_eff = frame.neff()
assert isinstance(N_eff, float)
assert N_eff < len(frame)
assert N_eff > len(frame) * np.exp(-0.25)

N_eff = frame.neff(1)
assert isinstance(N_eff, int)
assert N_eff == len(frame.T)

# beta kwarg
for beta in [0.5, 1, 2, np.inf, '0.5', 'equal', 'entropy', 'kish']:
assert frame.neff(beta=beta) == neff(frame.get_weights(), beta=beta)


def test_WeightedDataFrame_compress(frame):
Expand Down