Skip to content

Commit 262734f

Browse files
committed
Address ruff's concerns.
1 parent b39f054 commit 262734f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Diff for: src/fmripost_aroma/utils/utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ def classification(features_df: pd.DataFrame):
116116

117117
# Check the classifications
118118
is_motion = (features_df['csf_fract'] > THR_CSF) | (features_df['HFC'] > THR_HFC) | (proj > 0)
119-
assert np.array_equal(is_motion, (clf_df['classification'] == 'rejected').values)
119+
if not np.array_equal(is_motion, (clf_df['classification'] == 'rejected').values):
120+
raise ValueError('Classification error: classifications do not match criteria.')
120121

121122
# Remove trailing semicolons
122123
clf_df['rationale'] = clf_df['rationale'].str.rstrip(';')

Diff for: src/fmripost_aroma/workflows/aroma.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,11 @@ def _select_melodic_files(melodic_dir):
532532
import os
533533

534534
mixing = os.path.join(melodic_dir, 'melodic_mix')
535-
assert os.path.isfile(mixing), f'Missing MELODIC mixing matrix: {mixing}'
535+
if not os.path.isfile(mixing):
536+
raise FileNotFoundError(f'Missing MELODIC mixing matrix: {mixing}')
537+
536538
component_maps = os.path.join(melodic_dir, 'melodic_IC.nii.gz')
537-
assert os.path.isfile(component_maps), f'Missing MELODIC ICs: {component_maps}'
539+
if not os.path.isfile(component_maps):
540+
raise FileNotFoundError(f'Missing MELODIC ICs: {component_maps}')
541+
538542
return mixing, component_maps

0 commit comments

Comments
 (0)