From f62825e4366bf82e68bf61e9da2405664392d1b9 Mon Sep 17 00:00:00 2001 From: mathdugre Date: Mon, 24 Jul 2023 23:10:39 -0400 Subject: [PATCH] [FIX] api break in ppmi_downloader See https://github.com/LivingPark-MRI/ppmi-scraper/pull/7[FIX] api break in ppmi_downloader See https://github.com/LivingPark-MRI/ppmi-scraper/pull/766 --- livingpark_utils/download/ppmi.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/livingpark_utils/download/ppmi.py b/livingpark_utils/download/ppmi.py index 1f38fe8..48bdd73 100644 --- a/livingpark_utils/download/ppmi.py +++ b/livingpark_utils/download/ppmi.py @@ -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