diff --git a/allensdk/brain_observatory/behavior/behavior_project_cache/project_apis/data_io/natural_movie_one_cache.py b/allensdk/brain_observatory/behavior/behavior_project_cache/project_apis/data_io/natural_movie_one_cache.py index 9a4557772..24750c5d0 100644 --- a/allensdk/brain_observatory/behavior/behavior_project_cache/project_apis/data_io/natural_movie_one_cache.py +++ b/allensdk/brain_observatory/behavior/behavior_project_cache/project_apis/data_io/natural_movie_one_cache.py @@ -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 @@ -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