From d652e220303339931aa617b6051c77dd0f6f3971 Mon Sep 17 00:00:00 2001 From: samuelbray32 Date: Thu, 9 Oct 2025 17:49:53 -0700 Subject: [PATCH 1/6] make path return consistent type --- src/spyglass/common/common_nwbfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spyglass/common/common_nwbfile.py b/src/spyglass/common/common_nwbfile.py index 6a08973b9..96dea8b64 100644 --- a/src/spyglass/common/common_nwbfile.py +++ b/src/spyglass/common/common_nwbfile.py @@ -393,7 +393,7 @@ def get_abs_path( & f"filepath LIKE '%{analysis_nwb_file_name}'" ) if len(query) == 1: # Else try the standard way - return Path(analysis_dir) / query.fetch1("filepath") + return str(Path(analysis_dir) / query.fetch1("filepath")) logger.warning( f"Found {len(query)} files for: {analysis_nwb_file_name}" ) From 73f72f1335cd21e057755fbf7d42bffc622b0412 Mon Sep 17 00:00:00 2001 From: samuelbray32 Date: Thu, 9 Oct 2025 17:52:40 -0700 Subject: [PATCH 2/6] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d69271ae1..65e971a31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ import all foreign key references. - Common - Add tables for storing optogenetic experiment information #1312 - Remove wildcard matching in `Nwbfile().get_abs_path` #1382 + - Ensure `AnalysisNwbfile.get_abs_path` always returns same type #1429 - Decoding - Ensure results directory is created if it doesn't exist #1362 - Position From 5daa67af3529ab33ce53e031c60acbbe450f85a9 Mon Sep 17 00:00:00 2001 From: samuelbray32 Date: Fri, 10 Oct 2025 08:50:09 -0700 Subject: [PATCH 3/6] add kachery-cloud dependency --- environment.yml | 1 + environment_dlc.yml | 1 + environment_moseq_cpu.yml | 1 + environment_moseq_gpu.yml | 1 + pyproject.toml | 1 + 5 files changed, 5 insertions(+) diff --git a/environment.yml b/environment.yml index 26155a7cc..b168130f8 100644 --- a/environment.yml +++ b/environment.yml @@ -39,4 +39,5 @@ dependencies: - pip: - ghostipy # for common_filter - mountainsort4 + - kachery-cloud - . diff --git a/environment_dlc.yml b/environment_dlc.yml index df6026c18..d77e9bddd 100644 --- a/environment_dlc.yml +++ b/environment_dlc.yml @@ -39,4 +39,5 @@ dependencies: - pip: - ghostipy # for common_filter - mountainsort4 + - kachery-cloud - .[dlc] diff --git a/environment_moseq_cpu.yml b/environment_moseq_cpu.yml index b40dfb646..5728b561b 100644 --- a/environment_moseq_cpu.yml +++ b/environment_moseq_cpu.yml @@ -39,4 +39,5 @@ dependencies: - pip: - ghostipy # for common_filter - mountainsort4 + - kachery-cloud - .[moseq-cpu] diff --git a/environment_moseq_gpu.yml b/environment_moseq_gpu.yml index 3d80f42a8..f5501a8a8 100644 --- a/environment_moseq_gpu.yml +++ b/environment_moseq_gpu.yml @@ -39,4 +39,5 @@ dependencies: - pip: - ghostipy # for common_filter - mountainsort4 + - kachery-cloud - .[moseq-gpu] diff --git a/pyproject.toml b/pyproject.toml index fd87b6cca..b892c2056 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ dependencies = [ # "ghostipy", # removed from list bc M1 users need to install pyfftw first "hdmf>=3.4.6", "ipympl", + "kachery-cloud", "matplotlib", "ndx_franklab_novela>=0.1.0", "ndx-pose", From 10773cce4b2661c02ba55f56c81a25ca1fe17dfa Mon Sep 17 00:00:00 2001 From: samuelbray32 Date: Fri, 10 Oct 2025 08:52:07 -0700 Subject: [PATCH 4/6] edit config setup in tutorial --- notebooks/00_Setup.ipynb | 46 ++++++++++++++++++++++---------- notebooks/py_scripts/00_Setup.py | 46 ++++++++++++++++++++++---------- 2 files changed, 64 insertions(+), 28 deletions(-) diff --git a/notebooks/00_Setup.ipynb b/notebooks/00_Setup.ipynb index 0d28173f9..49a47b08f 100644 --- a/notebooks/00_Setup.ipynb +++ b/notebooks/00_Setup.ipynb @@ -502,30 +502,48 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import datajoint as dj\n", "from spyglass.settings import SpyglassConfig\n", "\n", - "# change to the root directory of the project\n", - "if os.path.basename(os.getcwd()) == \"notebooks\":\n", - " os.chdir(\"..\")\n", + "username = \"your username\" # replace with username made for you in the spyglass database\n", + "initial_password = (\n", + " \"your initial password\" # replace with the initial password given to you\n", + ")\n", + "new_password = (\n", + " \"your new password\" # replace with the new password you want to set\n", + ")\n", + "spyglass_base_dir = \"/path/like/stelmo/nwb/\" # replace with a path on your system where spyglass can store NWB files\n", + "database_host = \"address like: 'localhost' or 'lmf-db.cin.ucsf.edu'\"\n", "\n", - "# connect to the database\n", - "dj.conn()\n", "\n", - "# change your password\n", - "dj.admin.set_password()\n", + "dj.config.update(\n", + " {\n", + " \"database.host\": \"lmf-db.cin.ucsf.edu\",\n", + " \"database.user\": username,\n", + " \"database.password\": initial_password,\n", + " \"database.port\": 3306,\n", + " }\n", + ")\n", + "\n", + "dj.conn() # connect to the database\n", + "\n", + "# change your password from the initial password\n", + "dj.admin.set_password(new_password, update_config=True)\n", "\n", "# save the configuration\n", "SpyglassConfig().save_dj_config(\n", - " save_method=\"local\", # global or local\n", - " base_dir=\"/path/like/stelmo/nwb/\",\n", - " database_user=\"your username\",\n", - " database_password=\"your password\", # remove this line for shared machines\n", - " database_host=\"localhost or lmf-db.cin.ucsf.edu\", # only list one\n", + " save_method=\"global\", # global or local\n", + " base_dir=spyglass_base_dir,\n", + " database_user=username,\n", + " database_password=new_password,\n", + " database_host=database_host, # only list one\n", " database_port=3306,\n", " set_password=False,\n", - ")" + ")\n", + "\n", + "# ensure the configuration is saved for future use\n", + "dj.config.save_global()\n", + "dj.config.save_local()" ] }, { diff --git a/notebooks/py_scripts/00_Setup.py b/notebooks/py_scripts/00_Setup.py index 6dff1cdb5..9e472ca04 100644 --- a/notebooks/py_scripts/00_Setup.py +++ b/notebooks/py_scripts/00_Setup.py @@ -5,7 +5,7 @@ # extension: .py # format_name: light # format_version: '1.5' -# jupytext_version: 1.17.0 +# jupytext_version: 1.17.2 # kernelspec: # display_name: spyglass # language: python @@ -426,30 +426,48 @@ # # + -import os import datajoint as dj from spyglass.settings import SpyglassConfig -# change to the root directory of the project -if os.path.basename(os.getcwd()) == "notebooks": - os.chdir("..") +username = "your username" # replace with username made for you in the spyglass database +initial_password = ( + "your initial password" # replace with the initial password given to you +) +new_password = ( + "your new password" # replace with the new password you want to set +) +spyglass_base_dir = "/path/like/stelmo/nwb/" # replace with a path on your system where spyglass can store NWB files +database_host = "address like: 'localhost' or 'lmf-db.cin.ucsf.edu'" + -# connect to the database -dj.conn() +dj.config.update( + { + "database.host": "lmf-db.cin.ucsf.edu", + "database.user": username, + "database.password": initial_password, + "database.port": 3306, + } +) + +dj.conn() # connect to the database -# change your password -dj.admin.set_password() +# change your password from the initial password +dj.admin.set_password(new_password, update_config=True) # save the configuration SpyglassConfig().save_dj_config( - save_method="local", # global or local - base_dir="/path/like/stelmo/nwb/", - database_user="your username", - database_password="your password", # remove this line for shared machines - database_host="localhost or lmf-db.cin.ucsf.edu", # only list one + save_method="global", # global or local + base_dir=spyglass_base_dir, + database_user=username, + database_password=new_password, + database_host=database_host, # only list one database_port=3306, set_password=False, ) + +# ensure the configuration is saved for future use +dj.config.save_global() +dj.config.save_local() # - #
Legacy config From 934dbed78a67cb1fbeba07ce4f1f8bd1482d3982 Mon Sep 17 00:00:00 2001 From: samuelbray32 Date: Fri, 10 Oct 2025 09:01:15 -0700 Subject: [PATCH 5/6] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65e971a31..94bc1bdff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ import all foreign key references. ### Infrastructure - Auto-load within-Spyglass tables for graph operations #1368 +- Add explicit `kachery-cloud` dependency #1430 ### Pipelines From 66809832ecb7110bbbee819975309f9cd25b956f Mon Sep 17 00:00:00 2001 From: Eric Denovellis Date: Wed, 15 Oct 2025 14:08:07 -0700 Subject: [PATCH 6/6] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- notebooks/00_Setup.ipynb | 2 +- notebooks/py_scripts/00_Setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/00_Setup.ipynb b/notebooks/00_Setup.ipynb index 49a47b08f..ab706e92e 100644 --- a/notebooks/00_Setup.ipynb +++ b/notebooks/00_Setup.ipynb @@ -518,7 +518,7 @@ "\n", "dj.config.update(\n", " {\n", - " \"database.host\": \"lmf-db.cin.ucsf.edu\",\n", + " \"database.host\": database_host,\n", " \"database.user\": username,\n", " \"database.password\": initial_password,\n", " \"database.port\": 3306,\n", diff --git a/notebooks/py_scripts/00_Setup.py b/notebooks/py_scripts/00_Setup.py index 9e472ca04..d8dc2058f 100644 --- a/notebooks/py_scripts/00_Setup.py +++ b/notebooks/py_scripts/00_Setup.py @@ -442,7 +442,7 @@ dj.config.update( { - "database.host": "lmf-db.cin.ucsf.edu", + "database.host": database_host, "database.user": username, "database.password": initial_password, "database.port": 3306,