Skip to content

Commit

Permalink
Update subsampling.py
Browse files Browse the repository at this point in the history
  • Loading branch information
xiki-tempula authored Sep 11, 2021
1 parent b068776 commit a056728
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/alchemlyb/preprocessing/subsampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def slicing(df, lower=None, upper=None, step=None, force=False):


def statistical_inefficiency(df, series=None, lower=None, upper=None, step=None,
conservative=True, drop_duplicates=False, sort=False):
conservative=True, drop_duplicates=False, sort=False,
method='dhdl'):
"""Subsample a DataFrame based on the calculated statistical inefficiency
of a timeseries.
Expand Down Expand Up @@ -123,6 +124,19 @@ def statistical_inefficiency(df, series=None, lower=None, upper=None, step=None,
end up with correlated data.
"""

if method == 'dhdl':
# Find the current column index
# Select the first row and remove the first column (Time)
key = u_nk.index.values[0][1:]
if len(key) > 1:
# Multiple keys
col = u_nk[key]
else:
# Single key
col = u_nk[key[0]]
subsample = statistical_inefficiency(u_nk, col, sort=True,
drop_duplicates=True)
if _check_multiple_times(df):
if drop_duplicates:
if isinstance(df, pd.Series):
Expand Down

0 comments on commit a056728

Please sign in to comment.