Skip to content

Commit

Permalink
🎨 Use built-in sets
Browse files Browse the repository at this point in the history
  • Loading branch information
shnizzedy committed Feb 3, 2024
1 parent 88e0c98 commit 2597c1f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CPAC/utils/build_data_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def get_file_list(
base_directory, creds_path=None, write_txt=None, write_pkl=None, write_info=False
) -> LIST[PATHSTR]:
"""Return a list of input and data file paths.
These paths are either stored locally or on an AWS S3 bucket on the cloud.
"""
import os
Expand Down
12 changes: 5 additions & 7 deletions CPAC/utils/extract_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,6 @@ def generate_supplementary_files(data_config_outdir, data_config_name):
import csv
import os

from sets import Set

data_config_path = os.path.join(data_config_outdir, data_config_name)

try:
Expand All @@ -465,11 +463,11 @@ def generate_supplementary_files(data_config_outdir, data_config_name):
data_config_path
)

subject_scan_set = Set()
subID_set = Set()
session_set = Set()
subject_set = Set()
scan_set = Set()
subject_scan_set = set()
subID_set = set()
session_set = set()
subject_set = set()
scan_set = set()
data_list = []

try:
Expand Down
8 changes: 3 additions & 5 deletions CPAC/utils/extract_data_multiscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,13 @@ def generate_suplimentary_files(output_path):
"""
import csv

from sets import Set

subjects_list = yaml.safe_load(
open(os.path.join(output_path, "CPAC_subject_list.yml"), "r")
)

subject_scan_set = Set()
subject_set = Set()
scan_set = Set()
subject_scan_set = set()
subject_set = set()
scan_set = set()
data_list = []

for sub in subjects_list:
Expand Down
6 changes: 2 additions & 4 deletions CPAC/utils/extract_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ def grab(output_dir, scrubbing):
import os
import re

from sets import Set

pipelines = glob.glob(os.path.join(output_dir, "pipeline*"))

for p in pipelines:
Expand All @@ -102,8 +100,8 @@ def grab(output_dir, scrubbing):
if val:
threshold_list.append(val.group(0))

scan_list = Set(scan_list)
threshold_list = Set(threshold_list)
scan_list = set(scan_list)
threshold_list = set(threshold_list)

for scan in scan_list:
for threshold in threshold_list:
Expand Down

0 comments on commit 2597c1f

Please sign in to comment.