Skip to content

Commit

Permalink
Merge pull request #875 from effigies/fix/style_checks
Browse files Browse the repository at this point in the history
RF: Simplify comprehensions, using easy-to-read var names
  • Loading branch information
effigies committed Dec 13, 2020
2 parents 1ce22ba + dc48c3b commit 57dfda9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
7 changes: 3 additions & 4 deletions mriqc/classifier/data.py
Expand Up @@ -243,10 +243,9 @@ def read_dataset(
)

# Inform about ratings distribution
labels = sorted(list(set(x_df[rate_label].values.ravel().tolist())))
ldist = []
for l in labels:
ldist.append(int(np.sum(x_df[rate_label] == l)))
labels = sorted(set(x_df[rate_label].values.ravel().tolist()))
ldist = [int(np.sum(x_df[rate_label] == label))
for label in labels]

config.loggers.interface.info(
"Ratings distribution: %s (%s, %s)",
Expand Down
7 changes: 2 additions & 5 deletions mriqc/workflows/functional.py
Expand Up @@ -739,11 +739,8 @@ def _parse_tqual(in_file):
import numpy as np
with open(in_file, 'r') as fin:
lines = fin.readlines()
# remove general information
lines = [l for l in lines if l[:2] != '++']
# remove general information and warnings
return np.mean([float(l.strip()) for l in lines])
raise RuntimeError('AFNI 3dTqual was not parsed correctly')
return np.mean([float(line.strip()) for line in lines
if not line.startswith("++")])


def _parse_tout(in_file):
Expand Down

0 comments on commit 57dfda9

Please sign in to comment.