Skip to content

Commit

Permalink
Bump [skip actions]
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 9, 2024
1 parent 20052f4 commit 55264e5
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 1,525 deletions.
1,512 changes: 2 additions & 1,510 deletions CHANGELOG.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions npc_lims
Submodule npc_lims added at 20052f
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "npc_lims"
version = "0.1.95"
version = "0.1.96"
description = "Tools to fetch and update paths, metadata and state for Mindscope Neuropixels sessions, in the cloud."
authors = [
{ name = "Arjun Sridhar", email = "[email protected]" },
Expand Down
1 change: 1 addition & 0 deletions src/npc_lims/metadata/spreadsheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from npc_lims.paths.codeocean import DR_DATA_REPO


def get_training_sqlite_paths() -> tuple[upath.UPath, ...]:
"""
Examples:
Expand Down
2 changes: 1 addition & 1 deletion src/npc_lims/paths/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from npc_lims.paths.s3 import *
from npc_lims.paths.cache import *
from npc_lims.paths.s3 import *
27 changes: 15 additions & 12 deletions src/npc_lims/paths/cache.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import typing
from typing import Literal
import typing

import npc_session
import packaging.version
Expand All @@ -26,7 +26,7 @@
"electrode_groups",
"electrodes",
"units",
#TODO licks, pupil area, xy pos, running speed (zarr?)
# TODO licks, pupil area, xy pos, running speed (zarr?)
]

CACHED_FILE_EXTENSIONS: dict[str, str] = dict.fromkeys(
Expand All @@ -41,6 +41,7 @@
v.startswith(".") for v in CACHED_FILE_EXTENSIONS.values()
), "CACHED_FILE_EXTENSIONS must have values that start with a period"


def get_cache_file_suffix(nwb_component: NWBComponentStr) -> str:
"""
>>> get_cache_file_suffix("session")
Expand Down Expand Up @@ -74,14 +75,13 @@ def _parse_cache_path(
version: str | None = None,
) -> upath.UPath:
version = _parse_version(version) if version else get_current_cache_version()
d = (
CACHE_ROOT
/ version
/ nwb_component
)
d = CACHE_ROOT / version / nwb_component
if session_id is None:
return d
return d / f"{npc_session.SessionRecord(session_id)}{get_cache_file_suffix(nwb_component)}"
return (
d
/ f"{npc_session.SessionRecord(session_id)}{get_cache_file_suffix(nwb_component)}"
)


def get_cache_path(
Expand All @@ -99,7 +99,9 @@ def get_cache_path(
>>> get_cache_path(nwb_component="units", session_id="366122_2023-12-31", version="1.0.0")
S3Path('s3://aind-scratch-data/ben.hardcastle/session-caches/v1.0.0/units/366122_2023-12-31.parquet')
"""
path = _parse_cache_path(session_id=session_id, nwb_component=nwb_component, version=version)
path = _parse_cache_path(
session_id=session_id, nwb_component=nwb_component, version=version
)
if check_exists and not path.exists():
raise FileNotFoundError(
f"Cache file for {session_id} {nwb_component} {version} does not exist"
Expand All @@ -123,13 +125,14 @@ def get_all_cache_paths(
raise FileNotFoundError(
f"Cache directory for {nwb_component} {version} does not exist"
)
return tuple(path for path in dir_path.glob(f"*{get_cache_file_suffix(nwb_component)}"))
return tuple(
path for path in dir_path.glob(f"*{get_cache_file_suffix(nwb_component)}")
)



if __name__ == "__main__":
import doctest

doctest.testmod(
optionflags=(doctest.IGNORE_EXCEPTION_DETAIL | doctest.NORMALIZE_WHITESPACE)
)
)
2 changes: 1 addition & 1 deletion src/npc_lims/status/tracked_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def cloud_path(self) -> upath.UPath | None:
@functools.cached_property
def behavior_day(self) -> int | None:
if self.is_templeton:
return None # not accessible for Templeton sessions
return None # not accessible for Templeton sessions
return self.training_info.get("ID") # row of training spreadsheet

@functools.cached_property
Expand Down

0 comments on commit 55264e5

Please sign in to comment.