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

RF: Simplify comprehensions, using easy-to-read var names #875

Merged
merged 1 commit into from Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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