From 011dcaaca1f1dc20f1cc75c0edd8f2a85ad48ce4 Mon Sep 17 00:00:00 2001 From: acomrie <46034181+acomrie@users.noreply.github.com> Date: Thu, 18 May 2023 11:14:13 -0700 Subject: [PATCH] LFPBand and LFP bug fixes (#504) * LFP fetch1 query bug fix Address issue #485 * use filter_name instead of hard coding LFP() filter --- src/spyglass/lfp/v1/lfp.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/spyglass/lfp/v1/lfp.py b/src/spyglass/lfp/v1/lfp.py index 2c25fd0a7..ed94b55fe 100644 --- a/src/spyglass/lfp/v1/lfp.py +++ b/src/spyglass/lfp/v1/lfp.py @@ -132,7 +132,7 @@ def make(self, key): # get the LFP filter that matches the raw data filter = ( FirFilter() - & {"filter_name": "LFP 0-400 Hz"} + & {"filter_name": key["filter_name"]} & {"filter_sampling_rate": sampling_rate} ).fetch(as_dict=True) @@ -769,8 +769,10 @@ def make(self, key): lfp_band_elect_id = lfp_band_elect_id[lfp_sort_order] lfp_band_ref_id = lfp_band_ref_id[lfp_sort_order] - lfp_sampling_rate = (LFP() & {"nwb_file_name": key["nwb_file_name"]}).fetch1( - "lfp_sampling_rate" + lfp_sampling_rate = ( + LFPOutput() + .get_lfp_object({"lfp_id": key["lfp_id"]}) + .fetch1("lfp_sampling_rate") ) interval_list_name, lfp_band_sampling_rate = (LFPBandSelection() & key).fetch1( "target_interval_list_name", "lfp_band_sampling_rate" @@ -784,8 +786,10 @@ def make(self, key): ).fetch1("valid_times") # the valid_times for this interval may be slightly beyond the valid times for the lfp itself, # so we have to intersect the two - lfp_interval_list = (LFP() & {"nwb_file_name": key["nwb_file_name"]}).fetch1( - "interval_list_name" + lfp_interval_list = ( + LFPOutput() + .get_lfp_object({"lfp_id": key["lfp_id"]}) + .fetch1("interval_list_name") ) lfp_valid_times = ( IntervalList()