Skip to content

Commit

Permalink
Update src/spyglass/spikesorting/v1/recording.py
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Brozdowski <CBrozdowski@yahoo.com>
  • Loading branch information
khl02007 and CBroz1 authored Dec 8, 2023
1 parent e7a2abb commit 724c504
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions src/spyglass/spikesorting/v1/recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,45 +337,35 @@ def _get_sort_interval_valid_times(self, key: dict):
(start, end) times for valid intervals in the sort interval
"""
# FETCH:
# - sort interval
# - valid times
# - preprocessing parameters
# FETCH: - sort interval - valid times - preprocessing parameters
nwb_file_name, sort_interval_name, params = (
SpikeSortingPreprocessingParameters * SpikeSortingRecordingSelection
& key
).fetch1("nwb_file_name", "interval_list_name", "preproc_params")

sort_interval = (
IntervalList
& {
"nwb_file_name": (SpikeSortingRecordingSelection & key).fetch1(
"nwb_file_name"
),
"interval_list_name": (
SpikeSortingRecordingSelection & key
).fetch1("interval_list_name"),
"nwb_file_name": nwb_file_name,
"interval_list_name": sort_interval_name,
}
).fetch1("valid_times")

valid_interval_times = (
IntervalList
& {
"nwb_file_name": (SpikeSortingRecordingSelection & key).fetch1(
"nwb_file_name"
),
"nwb_file_name": nwb_file_name,
"interval_list_name": "raw data valid times",
}
).fetch1("valid_times")
params = (
SpikeSortingPreprocessingParameters * SpikeSortingRecordingSelection
& key
).fetch1("preproc_params")

# DO:
# - take intersection between sort interval and valid times
valid_sort_times = interval_list_intersect(
# DO: - take intersection between sort interval and valid times
return interval_list_intersect(
sort_interval,
valid_interval_times,
min_length=params["min_segment_length"],
)

return valid_sort_times

def _get_preprocessed_recording(self, key: dict):
"""Filters and references a recording.
- Loads the NWB file created during insertion as a spikeinterface Recording
Expand Down

0 comments on commit 724c504

Please sign in to comment.