Skip to content

Commit

Permalink
Merge pull request #74 from mathdugre/fix/scraper-api-change
Browse files Browse the repository at this point in the history
[FIX] api break in ppmi_downloader
  • Loading branch information
mathdugre committed Aug 9, 2023
2 parents 4c18c59 + f62825e commit c8d5b7c
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 c8d5b7c

Please sign in to comment.