diff --git a/.github/workflows/linux-conda.yml b/.github/workflows/linux-conda.yml index 0bbf900..945fe19 100644 --- a/.github/workflows/linux-conda.yml +++ b/.github/workflows/linux-conda.yml @@ -27,7 +27,7 @@ jobs: - name: Install mamba run: | - conda install -c conda-forge mamba + conda install -c conda-forge mamba python=3.10 conda clean -a # - name: install caiman diff --git a/.github/workflows/macos-conda.yml b/.github/workflows/macos-conda.yml index cc83e6a..ccb64e7 100644 --- a/.github/workflows/macos-conda.yml +++ b/.github/workflows/macos-conda.yml @@ -16,32 +16,21 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python '3.10' - uses: actions/setup-python@v3 + - uses: conda-incubator/setup-miniconda@v3 with: python-version: '3.10' - - name: Add conda to system path - run: | - # $CONDA is an environment variable pointing to the root of the miniconda directory - echo $CONDA/bin >> $GITHUB_PATH - - - name: Install mamba - run: | - conda install -c conda-forge mamba - conda clean -a - - # - name: install caiman - # run: | - # mamba install -c conda-forge caiman + mamba-version: "*" + channels: conda-forge,defaults + channel-priority: true + activate-environment: mescore + environment-file: environment.yml - - name: install mesmerize-core + - name: Test mesmerize-core with pytest + shell: bash -el {0} run: | - mamba env update -n base --file environment.yml + conda activate mescore + mamba install pytest caimanmanager install pip install . - - - name: Test with pytest - run: | - mamba install pytest DOWNLOAD_GROUND_TRUTHS=1 pytest -s . diff --git a/.github/workflows/windows-conda.yml b/.github/workflows/windows-conda.yml index 4d4a9e2..439b8f8 100644 --- a/.github/workflows/windows-conda.yml +++ b/.github/workflows/windows-conda.yml @@ -14,9 +14,9 @@ jobs: runs-on: "windows-latest" steps: - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 + - uses: conda-incubator/setup-miniconda@v3 with: - python-version: 3.9 + python-version: '3.10' mamba-version: "*" channels: conda-forge,defaults channel-priority: true diff --git a/environment.yml b/environment.yml index 5caddb9..aa793aa 100644 --- a/environment.yml +++ b/environment.yml @@ -1,7 +1,7 @@ channels: - conda-forge dependencies: - - caiman >= 1.9.10 + - caiman >= 1.11.2 - pandas >= 1.5.0 - requests - click diff --git a/environment_rtd.yml b/environment_rtd.yml index b51dbea..ce94dbc 100644 --- a/environment_rtd.yml +++ b/environment_rtd.yml @@ -1,7 +1,7 @@ channels: - conda-forge dependencies: - - caiman >= 1.9.10 + - caiman >= 1.11.2 - pandas >= 1.5.0 - requests - click diff --git a/mesmerize_core/algorithms/cnmf.py b/mesmerize_core/algorithms/cnmf.py index 4c71174..ca8f599 100644 --- a/mesmerize_core/algorithms/cnmf.py +++ b/mesmerize_core/algorithms/cnmf.py @@ -99,7 +99,7 @@ def run_algo(batch_path, uuid, data_path: str = None): cnm.save(str(output_path)) - Cn = cm.local_correlations(images.transpose(1, 2, 0)) + Cn = cm.local_correlations(images, swap_dim=False) Cn[np.isnan(Cn)] = 0 corr_img_path = output_dir.joinpath(f"{uuid}_cn.npy").resolve() diff --git a/mesmerize_core/algorithms/mcorr.py b/mesmerize_core/algorithms/mcorr.py index 755f697..fbfd1fd 100644 --- a/mesmerize_core/algorithms/mcorr.py +++ b/mesmerize_core/algorithms/mcorr.py @@ -90,7 +90,7 @@ def run_algo(batch_path, uuid, data_path: str = None): print("Computing correlation image") Cns = local_correlations_movie_offline( - [str(mcorr_memmap_path)], + str(mcorr_memmap_path), remove_baseline=True, window=1000, stride=1000, @@ -102,17 +102,17 @@ def run_algo(batch_path, uuid, data_path: str = None): Cn[np.isnan(Cn)] = 0 cn_path = output_dir.joinpath(f"{uuid}_cn.npy") np.save(str(cn_path), Cn, allow_pickle=False) - - # output dict for pandas series for dataframe row - d = dict() - + print("finished computing correlation image") + # Compute shifts if opts.motion["pw_rigid"] == True: x_shifts = mc.x_shifts_els y_shifts = mc.y_shifts_els shifts = [x_shifts, y_shifts] + if hasattr(mc, 'z_shifts_els'): + shifts += mc.z_shifts_els shift_path = output_dir.joinpath(f"{uuid}_shifts.npy") np.save(str(shift_path), shifts) else: @@ -120,6 +120,9 @@ def run_algo(batch_path, uuid, data_path: str = None): shift_path = output_dir.joinpath(f"{uuid}_shifts.npy") np.save(str(shift_path), shifts) + # output dict for pandas series for dataframe row + d = dict() + # save paths as relative path strings with forward slashes cn_path = str(PurePosixPath(cn_path.relative_to(output_dir.parent))) mcorr_memmap_path = str(PurePosixPath(mcorr_memmap_path.relative_to(output_dir.parent)))