Skip to content

Commit

Permalink
Merge branch 'master' into contour-nan-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbb committed Sep 3, 2024
2 parents 65a38e3 + c995096 commit bf1c09e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 10 additions & 21 deletions .github/workflows/macos-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
4 changes: 2 additions & 2 deletions .github/workflows/windows-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
channels:
- conda-forge
dependencies:
- caiman >= 1.9.10
- caiman >= 1.11.2
- pandas >= 1.5.0
- requests
- click
Expand Down
2 changes: 1 addition & 1 deletion environment_rtd.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
channels:
- conda-forge
dependencies:
- caiman >= 1.9.10
- caiman >= 1.11.2
- pandas >= 1.5.0
- requests
- click
Expand Down
2 changes: 1 addition & 1 deletion mesmerize_core/algorithms/cnmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
13 changes: 8 additions & 5 deletions mesmerize_core/algorithms/mcorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -102,24 +102,27 @@ 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:
shifts = mc.shifts_rig
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)))
Expand Down

0 comments on commit bf1c09e

Please sign in to comment.