Skip to content

Commit

Permalink
Save output paths as strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbb committed Jun 7, 2024
1 parent d943d7c commit 4c346f7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
13 changes: 7 additions & 6 deletions mesmerize_core/algorithms/cnmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import pandas as pd
import traceback
from pathlib import Path
from pathlib import Path, PurePosixPath
from shutil import move as move_file
import os
import time
Expand Down Expand Up @@ -116,13 +116,14 @@ def run_algo(batch_path, uuid, data_path: str = None):
Yr._mmap.close() # accessing private attr but windows is annoying otherwise
move_file(fname_new, cnmf_memmap_path)

cnmf_hdf5_path = output_path.relative_to(output_dir.parent)
cnmf_memmap_path = cnmf_memmap_path.relative_to(output_dir.parent)
corr_img_path = corr_img_path.relative_to(output_dir.parent)
# save paths as realative path strings with forward slashes
cnmf_hdf5_path = str(PurePosixPath(output_path.relative_to(output_dir.parent)))
cnmf_memmap_path = str(PurePosixPath(cnmf_memmap_path.relative_to(output_dir.parent)))
corr_img_path = str(PurePosixPath(corr_img_path.relative_to(output_dir.parent)))
for proj_type in proj_paths.keys():
d[f"{proj_type}-projection-path"] = proj_paths[proj_type].relative_to(
d[f"{proj_type}-projection-path"] = str(PurePosixPath(proj_paths[proj_type].relative_to(
output_dir.parent
)
)))

d.update(
{
Expand Down
5 changes: 3 additions & 2 deletions mesmerize_core/algorithms/cnmfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from caiman.source_extraction.cnmf.params import CNMFParams
import psutil
import traceback
from pathlib import Path
from pathlib import Path, PurePosixPath
from shutil import move as move_file
import os
import time
Expand Down Expand Up @@ -107,7 +107,8 @@ def run_algo(batch_path, uuid, data_path: str = None):
Yr._mmap.close() # accessing private attr but windows is annoying otherwise
move_file(fname_new, cnmf_memmap_path)

cnmfe_memmap_path = cnmf_memmap_path.relative_to(output_dir.parent)
# save path as realative path strings with forward slashes
cnmfe_memmap_path = str(PurePosixPath(cnmf_memmap_path.relative_to(output_dir.parent)))

d.update(
{
Expand Down
14 changes: 7 additions & 7 deletions mesmerize_core/algorithms/mcorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import psutil
import pandas as pd
import os
from pathlib import Path
from pathlib import Path, PurePosixPath
import numpy as np
from shutil import move as move_file
import time
Expand Down Expand Up @@ -124,14 +124,14 @@ 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)

# relative paths
cn_path = cn_path.relative_to(output_dir.parent)
mcorr_memmap_path = mcorr_memmap_path.relative_to(output_dir.parent)
shift_path = shift_path.relative_to(output_dir.parent)
# save paths as realative 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)))
shift_path = str(PurePosixPath(shift_path.relative_to(output_dir.parent)))
for proj_type in proj_paths.keys():
d[f"{proj_type}-projection-path"] = proj_paths[proj_type].relative_to(
d[f"{proj_type}-projection-path"] = str(PurePosixPath(proj_paths[proj_type].relative_to(
output_dir.parent
)
)))

d.update(
{
Expand Down

0 comments on commit 4c346f7

Please sign in to comment.