Skip to content

Commit f854a7c

Browse files
committed
Fix discovery of paths
1 parent 8f94d86 commit f854a7c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/npc_ephys/spikeinterface.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def get_json(self, filename: str) -> dict:
167167
assert self.root is not None
168168
return self.read_json(self.get_correct_path(self.root, filename))
169169

170-
def get_path(self, dirname: str, probe: str | None = None) -> upath.UPath:
170+
def get_path(self, dirname: str, probe: str | None = None, extra_name_component: str | None = None) -> upath.UPath:
171171
"""Return a path to a single dir or file: either `self.root/dirname` or, if `probe` is specified,
172172
the probe-specific sub-path within `self.root/dirname`."""
173173
assert self.root is not None
@@ -182,9 +182,10 @@ def get_path(self, dirname: str, probe: str | None = None) -> upath.UPath:
182182
path = next(
183183
(
184184
path
185-
for path in self.get_correct_path(self.root, dirname).iterdir()
185+
for path in sorted(self.get_correct_path(self.root, dirname).iterdir())
186186
if npc_session.ProbeRecord(probe)
187187
== npc_session.ProbeRecord(path.as_posix())
188+
and (extra_name_component is None or extra_name_component in path.name)
188189
),
189190
None,
190191
)
@@ -206,8 +207,8 @@ def get_path(self, dirname: str, probe: str | None = None) -> upath.UPath:
206207
# dirs
207208
drift_maps = functools.partialmethod(get_path, "drift_maps")
208209
output = functools.partialmethod(get_path, "output")
209-
postprocessed = functools.partialmethod(get_path, "postprocessed")
210-
spikesorted = functools.partialmethod(get_path, "spikesorted")
210+
postprocessed = functools.partialmethod(get_path, "postprocessed", "experiment")
211+
spikesorted = functools.partialmethod(get_path, "spikesorted", "experiment")
211212

212213
@functools.cache
213214
def curated(self, probe: str) -> upath.UPath:

0 commit comments

Comments
 (0)