Skip to content

Commit

Permalink
[FIX] api break in ppmi_downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
mathdugre committed Jul 25, 2023
1 parent 4c18c59 commit f62825e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions livingpark_utils/download/ppmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,23 +334,20 @@ def get_T1_nifti_files(
print(f"Downloading image data of {missing_patno.nunique()} subjects")

for batch in batched(missing_patno.unique(), n=batch_size):
batched_query = query[query["PATNO"].isin(batch)]
try:
ppmi_dl = ppmi_downloader.PPMIDownloader(headless=self.headless)
ppmi_dl.download_imaging_data(
batch,
batched_query,
timeout=timeout * len(batch),
)
# We map the files in each batch to limit re-download on failures.
self._map_nifti_from_cache(
query[query["PATNO"].isin(batch)], symlink=symlink
)
self._map_nifti_from_cache(batched_query, symlink=symlink)

except (TimeoutError, ReadTimeoutError):
logger.error(traceback.format_exc())

self._map_nifti_from_cache(
query[query["PATNO"].isin(batch)], symlink=symlink
)
self._map_nifti_from_cache(batched_query, symlink=symlink)
missing = self.missing_T1_nifti_files(query)
success = query[~query["PATNO"].isin(missing["PATNO"])].copy()
return success, missing
Expand Down

0 comments on commit f62825e

Please sign in to comment.