Skip to content

Commit

Permalink
[PEP8] Fix formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DESm1th committed Jan 17, 2025
1 parent 7341296 commit c21ecee
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions datman/exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ def handle_missing_scans(self, missing_scans, niix_log):
for scan in missing_scans:
if scan.series not in series_log:
error_msg = (
f"dcm2niix failed to create nifti for {scan}. Data may require "
"manual intervention or blacklisting.\n"
f"dcm2niix failed to create nifti for {scan}. "
"Data may require manual intervention or blacklisting.\n"
)
else:
error_msg = "\n".join(series_log[scan.series])
Expand Down Expand Up @@ -447,7 +447,9 @@ def run_dcm2bids(self, raw_data_dir, tries=2):
input_dir = self._get_scan_dir(raw_data_dir)

if self.refresh and not os.path.exists(input_dir):
logger.error(f"Cannot refresh contents of {self.output_dir}, no files found at {input_dir}.")
logger.error(
f"Cannot refresh contents of {self.output_dir}, no "
f"files found at {input_dir}.")
return

# Only run dcm2niix the first try, on the second just export the
Expand Down Expand Up @@ -500,7 +502,7 @@ def report_export_issues(self, xnat_map, local_map, series_log):
missing = {}
for scan in xnat_map:
if scan not in local_map:
#!!!!!!! Note the [0] should probably be dropped. kept for testing.
# Note the [0] should probably be dropped. kept for testing.
missing[scan] = xnat_map[scan][0]
continue
if len(xnat_map[scan]) != 1:
Expand Down Expand Up @@ -533,7 +535,8 @@ def get_local_map(self):
xnat_series_nums = [scan.series for scan in self.experiment.scans]
for acq in local_parser.acquisitions:
sidecar = acq.srcSidecar
if 'Repeat' in sidecar.data and sidecar.data['Repeat'] != self.session.session:
if ('Repeat' in sidecar.data and
sidecar.data['Repeat'] != self.session.session):
continue
if 'SeriesNumber' not in sidecar.data:
continue
Expand Down Expand Up @@ -672,7 +675,8 @@ def remove_criteria(descriptions):
for search_path in [self.output_dir, bids_tmp]:
for item in self.find_outputs(".json", start_dir=search_path):
sidecar = dcm2bids.Sidecar(item)
if 'Repeat' in sidecar.data and sidecar.data['Repeat'] != self.session.session:
if ('Repeat' in sidecar.data and
sidecar.data['Repeat'] != self.session.session):
continue
local_sidecars.append(sidecar)
local_sidecars = sorted(local_sidecars)
Expand Down Expand Up @@ -1717,7 +1721,7 @@ def parse_niix_log(niix_output, xnat_scans):
if line.startswith("Compress:"):
nii_path = line.split(" ")[-1]
series = str(int(os.path.basename(nii_path).split("_")[0]))
# Handle split series (they get '10' prepended to orig series num)
# Handle split series (they get '10' prepended to series num)
if series not in [scan.series for scan in xnat_scans]:
# drop the '10' prefix:
series = str(int(series[2:]))
Expand All @@ -1741,4 +1745,3 @@ def sort_log(log_lines):
if cur_idx >= 0:
cur_entry.append(line)
return sorted_lines

0 comments on commit c21ecee

Please sign in to comment.