Skip to content

Commit

Permalink
Merge pull request #84 from nel-lab/master
Browse files Browse the repository at this point in the history
lots-of-stuff <- master
  • Loading branch information
kushalkolar authored Jul 29, 2022
2 parents 1aeaa74 + 29a5869 commit 740766b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 271 deletions.
2 changes: 0 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ dependencies:
- caiman >= 1.9.10
- pandas
- requests
- qtpy
- pyqt
- click

2 changes: 0 additions & 2 deletions mesmerize_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from .batch_utils import (
COMPUTE_BACKENDS,
COMPUTE_BACKEND_QPROCESS,
COMPUTE_BACKEND_SLURM,
COMPUTE_BACKEND_SUBPROCESS,
set_parent_raw_data_path,
Expand All @@ -14,7 +13,6 @@

__all__ = [
"COMPUTE_BACKENDS",
"COMPUTE_BACKEND_QPROCESS",
"COMPUTE_BACKEND_SLURM",
"COMPUTE_BACKEND_SUBPROCESS",
"set_parent_raw_data_path",
Expand Down
15 changes: 2 additions & 13 deletions mesmerize_core/batch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,12 @@
"cnmfe": cnmfe,
}

try:
import PyQt5

HAS_PYQT = True
except ImportError:
HAS_PYQT = False

COMPUTE_BACKEND_QPROCESS = "qprocess" #: QProcess backend for use in napari
COMPUTE_BACKEND_SUBPROCESS = "subprocess" #: subprocess backend, for use output a Qt application such as a notebook
COMPUTE_BACKEND_SUBPROCESS = "subprocess" #: subprocess backend
COMPUTE_BACKEND_SLURM = "slurm" #: SLURM backend, not yet implemented

COMPUTE_BACKENDS = [COMPUTE_BACKEND_SUBPROCESS, COMPUTE_BACKEND_SLURM]

if HAS_PYQT:
COMPUTE_BACKENDS += [COMPUTE_BACKEND_QPROCESS]

DATAFRAME_COLUMNS = ["algo", "name", "input_movie_path", "params", "outputs", "uuid"]
DATAFRAME_COLUMNS = ["algo", "name", "input_movie_path", "params", "outputs", "comments", "uuid"]


def set_parent_raw_data_path(path: Union[Path, str]) -> Path:
Expand Down
42 changes: 2 additions & 40 deletions mesmerize_core/caiman_extensions/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
get_parent_raw_data_path,
PathsDataFrameExtension,
PathsSeriesExtension,
HAS_PYQT,
)
from ..utils import validate_path, IS_WINDOWS, make_runfile, warning_experimental

if HAS_PYQT:
from PyQt5 import QtCore
from caiman import load_memmap


Expand Down Expand Up @@ -108,6 +104,7 @@ def add_item(self, algo: str, name: str, input_movie_path: str, params: dict):
"input_movie_path": str(input_movie_path),
"params": params,
"outputs": None, # to store dict of output information, such as output file paths
"comments": None,
"uuid": str(
uuid4()
), # unique identifier for this combination of movie + params
Expand Down Expand Up @@ -137,42 +134,7 @@ class CaimanSeriesExtensions:

def __init__(self, s: pd.Series):
self._series = s
self.process: [Union, QtCore.QProcess, Popen] = None

def _run_qprocess(
self,
runfile_path: str,
callbacks_finished: List[callable],
callback_std_out: Optional[callable] = None,
) -> QtCore.QProcess:

# Create a QProcess
self.process = QtCore.QProcess()
self.process.setProcessChannelMode(QtCore.QProcess.MergedChannels)

# Set the callback function to read the stdout
if callback_std_out is not None:
self.process.readyReadStandardOutput.connect(
partial(callback_std_out, self.process)
)

# connect the callback functions for when the process finishes
if callbacks_finished is not None:
for f in callbacks_finished:
self.process.finished.connect(f)

parent_path = self._series.paths.resolve(self._series.input_movie_path).parent

# Set working dir for the external process
self.process.setWorkingDirectory(str(parent_path))

# Start the external process
if IS_WINDOWS:
self.process.start("powershell.exe", [runfile_path])
else:
self.process.start(runfile_path)

return self.process
self.process: Popen = None

def _run_subprocess(
self,
Expand Down
Loading

0 comments on commit 740766b

Please sign in to comment.