Skip to content

Commit

Permalink
WIP: error specificity
Browse files Browse the repository at this point in the history
  • Loading branch information
CBroz1 committed Jan 9, 2025
1 parent 558f38b commit 54a3ca1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/spyglass/common/common_nwbfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,16 @@ def get_abs_path(
analysis_nwb_file_abspath : str
The absolute path for the given file name.
"""
if from_schema: # Skips checksum and file existence checks
return f"{analysis_dir}/" + (
if from_schema: # Skips checksum check
query = (
schema.external["analysis"]
& f'filepath LIKE "%{analysis_nwb_file_name}"'
).fetch1("filepath")
& f"filepath LIKE '%{analysis_nwb_file_name}'"
)
if len(query) != 1:
raise FileNotFoundError(
f"Found {len(query)} files for: {analysis_nwb_file_name}"
)
return f"{analysis_dir}/" + query.fetch1("filepath")

# If an entry exists in the database get the stored datajoint filepath
file_key = {"analysis_file_name": analysis_nwb_file_name}
Expand Down
7 changes: 5 additions & 2 deletions src/spyglass/common/common_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
from spyglass.settings import test_mode
from spyglass.utils import SpyglassMixin, SpyglassMixinPart, logger
from spyglass.utils.dj_graph import RestrGraph
from spyglass.utils.dj_helper_fn import (make_file_obj_id_unique, unique_dicts,
update_analysis_for_dandi_standard)
from spyglass.utils.dj_helper_fn import (
make_file_obj_id_unique,
unique_dicts,
update_analysis_for_dandi_standard,
)
from spyglass.utils.nwb_helper_fn import get_linked_nwbs
from spyglass.utils.sql_helper_fn import SQLDumpHelper

Expand Down

0 comments on commit 54a3ca1

Please sign in to comment.