Skip to content

Commit

Permalink
Change to modifying data_path instead of download_data.
Browse files Browse the repository at this point in the history
  • Loading branch information
morriscb committed Oct 10, 2023
1 parent 4160632 commit 7df3c6f
Showing 1 changed file with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,41 @@ def _list_all_manifests(self) -> list:
"""
return None

def download_data(self) -> pathlib.Path:
def data_path(self, file_id) -> dict:
"""
Return the local path to a data file, downloading the file
if necessary
Return the local path to a data file, and test for the
file's existence
Parameters
----------
file_id:
The unique identifier of the file to be accessed
Returns
-------
pathlib.Path
The path indicating where the file is stored on the
local system
dict
'local_path' will be a pathlib.Path pointing to the file's location
'exists' will be a boolean indicating if the file
exists in a valid state
'file_attributes' is a CacheFileAttributes describing the file
in more detail
Raises
------
RuntimeError
If the file cannot be downloaded
"""
was_downloaded = self._download_file(self._file_attributes)
if was_downloaded:
self._update_list_of_downloads(self._file_attributes)
return self._file_attributes.local_path
file_attributes = self._file_attributes
exists = self._file_exists(file_attributes)
local_path = file_attributes.local_path
output = {'local_path': local_path,
'exists': exists,
'file_attributes': file_attributes}

return output

def get_raw_movie(self):
"""Download the raw movie data from the cloud and return it as a numpy
Expand All @@ -63,7 +78,7 @@ def get_raw_movie(self):
-------
raw_movie : np.ndarray
"""
return np.load(self.download_data())
return np.load(self.download_data(None))

def get_processed_template_movie(self, n_workers=None):
"""Download the movie if needed and process it into warped and unwarped
Expand Down

0 comments on commit 7df3c6f

Please sign in to comment.