Skip to content

Commit

Permalink
style: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrugman committed May 20, 2022
1 parent df79ffd commit 6adcb8e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
12 changes: 7 additions & 5 deletions popmon/analysis/functions.py
Expand Up @@ -59,11 +59,13 @@ def pull(row, suffix_mean="_mean", suffix_std="_std", cols=None):
x = {
m: np.nan
if (
any(r not in rdict or pd.isnull(rdict[r]) for r in [m, m + suffix_mean, m + suffix_std])
any(
r not in rdict or pd.isnull(rdict[r])
for r in [m, m + suffix_mean, m + suffix_std]
)
or rdict[m + suffix_std] == 0.0
)
else
(rdict[m] - rdict[m + suffix_mean]) / rdict[m + suffix_std]
else (rdict[m] - rdict[m + suffix_mean]) / rdict[m + suffix_std]
for m in cols
}

Expand Down Expand Up @@ -408,7 +410,7 @@ def normalized_hist_mean_cov(x, hist_name=""):
o = {
hist_name + "_mean": None,
hist_name + "_cov": None,
hist_name + "_binning": None
hist_name + "_binning": None,
}

# basic checks
Expand Down Expand Up @@ -463,7 +465,7 @@ def relative_chi_squared(
"chi2": np.nan,
"naive_pvalue": np.nan,
"naive_zscore": np.nan,
"max_res": np.nan
"max_res": np.nan,
}

required = [
Expand Down
9 changes: 3 additions & 6 deletions popmon/analysis/hist_numpy.py
Expand Up @@ -287,20 +287,17 @@ def get_consistent_numpy_entries(hist_list, get_bin_labels=False):

# collect list of consistent bin_entries
if all_num:
kwargs = {'xvalues': labels}
kwargs = {"xvalues": labels}
else:
# PATCH: deal with boolean labels, which get bin_labels() returns as strings
cat_labels = labels
props = get_hist_props(hist_list[0])
if props["is_bool"]:
cat_labels = [lab == "True" for lab in cat_labels]

kwargs = {'labels': cat_labels}
kwargs = {"labels": cat_labels}

entries_list = [
hist.bin_entries(**kwargs)
for hist in hist_list
]
entries_list = [hist.bin_entries(**kwargs) for hist in hist_list]

if get_bin_labels:
return entries_list, labels
Expand Down
1 change: 0 additions & 1 deletion popmon/config.py
Expand Up @@ -17,7 +17,6 @@
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import multiprocessing
from fnmatch import fnmatch

from popmon.analysis.comparison.comparisons import Comparisons
Expand Down
4 changes: 2 additions & 2 deletions popmon/hist/hist_utils.py
Expand Up @@ -22,14 +22,14 @@
import histogrammar.specialized
import numpy as np
import pandas as pd
from histogrammar.util import get_hist_props
from histogrammar.specialized import (
CategorizeHistogramMethods,
HistogramMethods,
SparselyHistogramMethods,
SparselyTwoDimensionallyHistogramMethods,
TwoDimensionallyHistogramMethods,
SparselyTwoDimensionallyHistogramMethods
)
from histogrammar.util import get_hist_props

COMMON_HIST_TYPES = (
histogrammar.Categorize,
Expand Down
4 changes: 2 additions & 2 deletions popmon/stitching/hist_stitcher.py
Expand Up @@ -281,8 +281,8 @@ def _find_max_time_bin_index(self, hists_basis, features_basis, time_axis):
hist_list = list(hists_basis.values())

all_sparse = all(isinstance(h, hg.SparselyBin) for h in hist_list)
all_cat = (
not all_sparse and all(isinstance(h, hg.Categorize) for h in hist_list)
all_cat = not all_sparse and all(
isinstance(h, hg.Categorize) for h in hist_list
)

max_time_bin_idx = None
Expand Down

0 comments on commit 6adcb8e

Please sign in to comment.