diff --git a/element_interface/caiman_loader.py b/element_interface/caiman_loader.py index a87d9eb..e245abd 100644 --- a/element_interface/caiman_loader.py +++ b/element_interface/caiman_loader.py @@ -293,8 +293,10 @@ def _get_image(self, img_type): ) else: img_ = np.dstack( - pln_cm.motion_correction[img_type][...] - for pln_cm in self.planes.values() + [ + pln_cm.motion_correction[img_type][...] + for pln_cm in self.planes.values() + ] ) return img_ diff --git a/element_interface/run_caiman.py b/element_interface/run_caiman.py index d45eda0..d45765c 100644 --- a/element_interface/run_caiman.py +++ b/element_interface/run_caiman.py @@ -1,6 +1,7 @@ -import pathlib - import cv2 +import os +import pathlib +import shutil try: cv2.setNumThreads(0) @@ -65,6 +66,11 @@ def run_caiman( cnmf_output_file = pathlib.Path(cnmf_output.mmap_file[:-4] + "hdf5") assert cnmf_output_file.exists() - assert cnmf_output_file.parent == pathlib.Path(output_dir) + output_files = os.listdir(cnmf_output_file.parent) + for output_file in output_files: + try: + shutil.copy(cnmf_output_file.parent / output_file, output_dir) + except FileExistsError: + print(f"File {output_file.name} already exists in {output_dir}. Skipping.") _save_mc(mc_output, cnmf_output_file.as_posix(), parameters["is3D"])