From f87f94b3eef261ba5e84099cf2bc52a52c1263e2 Mon Sep 17 00:00:00 2001 From: ReiHashimoto <42664619+ReiHashimoto@users.noreply.github.com> Date: Wed, 27 Mar 2024 21:53:34 +0900 Subject: [PATCH 1/3] update microscope lib settings --- docs/gui/workflow.md | 4 +++- studio/app/dir_path.py | 3 +++ studio/app/optinist/wrappers/optinist/conda/microscope.yaml | 3 +++ studio/config/.env.example | 3 +++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/gui/workflow.md b/docs/gui/workflow.md index 676196add..4e1bcca89 100644 --- a/docs/gui/workflow.md +++ b/docs/gui/workflow.md @@ -229,7 +229,9 @@ You may not want to modify your original data folder, or you may want to make yo - get the C library files from the manufacturer's support. - use OptiNiSt by :ref:`developer mode `. - - put the libraries into ``optinist/studio/app/optinist/microscopes/dll/{nikon | olympus}/{linux | windows}/`` + - set environment value ``MICROSCOPES_LIBRARY_DIR`` in ``studio/config/.env`` to your library path. + - put the libraries into ``MICROSCOPES_LIBRARY_DIR/dll/{nikon | olympus}/{linux | windows}/`` + - If you use Linux, open ``studio/app/optinist/wrappers/optinist/conda/microscope.yaml`` and uncomment the ``- gcc=12`` line. ```

diff --git a/studio/app/dir_path.py b/studio/app/dir_path.py index edaac3c2b..4f36ddc94 100644 --- a/studio/app/dir_path.py +++ b/studio/app/dir_path.py @@ -1,6 +1,8 @@ import os from enum import Enum +from dotenv import load_dotenv + _DEFAULT_DIR = "/tmp/studio" _ENV_DIR = os.environ.get("OPTINIST_DIR") @@ -27,6 +29,7 @@ class DIRPATH: CONDAENV_DIR = ( f"{os.path.dirname(os.path.dirname(os.path.dirname(__file__)))}/conda" ) + load_dotenv(f"{CONFIG_DIR}/.env") SNAKEMAKE_FILEPATH = f"{APP_DIR}/Snakefile" EXPERIMENT_YML = "experiment.yaml" diff --git a/studio/app/optinist/wrappers/optinist/conda/microscope.yaml b/studio/app/optinist/wrappers/optinist/conda/microscope.yaml index 89eac8977..e6250feaf 100644 --- a/studio/app/optinist/wrappers/optinist/conda/microscope.yaml +++ b/studio/app/optinist/wrappers/optinist/conda/microscope.yaml @@ -1,5 +1,8 @@ +channels: + - conda-forge dependencies: - python=3.9 + # NOTE: Uncomment the following line if you want to use .nd2 .oir files on linux # - gcc=12 - pip - pip: diff --git a/studio/config/.env.example b/studio/config/.env.example index 1bb1cd886..07ac7179e 100644 --- a/studio/config/.env.example +++ b/studio/config/.env.example @@ -10,3 +10,6 @@ IS_STANDALONE=True # MYSQL_DATABASE=studio # MYSQL_USER=studio_db_user # MYSQL_PASSWORD=studio_db_password + +# NOTE: Uncomment and set your own values when using .nd2 or .oir reader +# MICROSCOPES_LIBRARY_DIR="/app/studio/app/optinist/microscopes/dll" From 3cd6902f1e6d72adcd65854c776e26cefe9b50b4 Mon Sep 17 00:00:00 2001 From: ReiHashimoto <42664619+ReiHashimoto@users.noreply.github.com> Date: Wed, 27 Mar 2024 21:56:29 +0900 Subject: [PATCH 2/3] check .env file existance --- studio/app/dir_path.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/studio/app/dir_path.py b/studio/app/dir_path.py index 4f36ddc94..8ea1af0fb 100644 --- a/studio/app/dir_path.py +++ b/studio/app/dir_path.py @@ -29,7 +29,8 @@ class DIRPATH: CONDAENV_DIR = ( f"{os.path.dirname(os.path.dirname(os.path.dirname(__file__)))}/conda" ) - load_dotenv(f"{CONFIG_DIR}/.env") + if os.path.isfile(f"{CONDAENV_DIR}/.env"): + load_dotenv(f"{CONFIG_DIR}/.env") SNAKEMAKE_FILEPATH = f"{APP_DIR}/Snakefile" EXPERIMENT_YML = "experiment.yaml" From 6911c33a6405bf47024f0ca5f149c636b02d06cd Mon Sep 17 00:00:00 2001 From: ReiHashimoto <42664619+ReiHashimoto@users.noreply.github.com> Date: Wed, 27 Mar 2024 21:57:31 +0900 Subject: [PATCH 3/3] fix typo --- studio/app/dir_path.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/studio/app/dir_path.py b/studio/app/dir_path.py index 8ea1af0fb..7926989a5 100644 --- a/studio/app/dir_path.py +++ b/studio/app/dir_path.py @@ -25,12 +25,12 @@ class DIRPATH: STUDIO_DIR = os.path.dirname(os.path.dirname(__file__)) APP_DIR = os.path.dirname(__file__) CONFIG_DIR = f"{STUDIO_DIR}/config" + if os.path.isfile(f"{CONFIG_DIR}/.env"): + load_dotenv(f"{CONFIG_DIR}/.env") CONDAENV_DIR = ( f"{os.path.dirname(os.path.dirname(os.path.dirname(__file__)))}/conda" ) - if os.path.isfile(f"{CONDAENV_DIR}/.env"): - load_dotenv(f"{CONFIG_DIR}/.env") SNAKEMAKE_FILEPATH = f"{APP_DIR}/Snakefile" EXPERIMENT_YML = "experiment.yaml"