Skip to content

Commit

Permalink
Merge branch 'master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
CBroz1 authored Dec 14, 2023
2 parents 45710f8 + 0d66ea9 commit 4a1aa6c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
- Add Mixin class to centralize `fetch_nwb` functionality. #692
- Minor fixes to LinearizedPositionV1 pipeline #695
- Add SpikeSorting V1 pipeline #651
- Refactor restriction use in `delete_downstream_merge`
- Refactor restriction use in `delete_downstream_merge` #703
- Minor fixes to LFPBandV1 populator #706

## [0.4.3] (November 7, 2023)

Expand Down
3 changes: 2 additions & 1 deletion src/spyglass/common/common_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ def filter_data(
frm, to = self._time_bound_check(
a_start, a_stop, timestamps, n_samples
)

if np.isclose(frm, to, rtol=0, atol=1e-8):
continue
indices.append((frm, to))

shape, _ = gsp.filter_data_fir(
Expand Down
3 changes: 3 additions & 0 deletions src/spyglass/lfp/analysis/v1/lfp_band.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ def make(self, key):
}
)
else:
lfp_band_valid_times = interval_list_censor(
lfp_band_valid_times, new_timestamps
)
# check that the valid times are the same
assert np.isclose(
tmp_valid_times[0], lfp_band_valid_times
Expand Down
13 changes: 7 additions & 6 deletions src/spyglass/lfp/v1/lfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ class LFPSelection(dj.Manual):
The interval list is used to select the times from the raw data that will be
filtered. The user can also specify the filter to be used.
The LFP data is filtered and downsampled to 1 KHz. The filtered data is stored
in the AnalysisNwbfile table. The valid times for the filtered data are stored
in the IntervalList table.
The LFP data is filtered and downsampled to the user-defined sampling rate, specified
as lfp_sampling_rate. The filtered data is stored in the AnalysisNwbfile table.
The valid times for the filtered data are stored in the IntervalList table.
"""

definition = """
-> LFPElectrodeGroup # the group of electrodes to be filtered
-> IntervalList.proj(target_interval_list_name='interval_list_name') # the original set of times to be filtered
-> FirFilterParameters # the filter to be used
---
target_sampling_rate = 1000 : float # the desired output sampling rate, in HZ
"""


Expand All @@ -58,7 +60,6 @@ class LFPV1(SpyglassMixin, dj.Computed):
"""

def make(self, key):
DECIMATION_FACTOR = 1000
# get the NWB object with the data
nwbf_key = {"nwb_file_name": key["nwb_file_name"]}
rawdata = (Raw & nwbf_key).fetch_nwb()[0]["raw"]
Expand Down Expand Up @@ -94,8 +95,8 @@ def make(self, key):
f"LFP: found {len(valid_times)} intervals > {MIN_LFP_INTERVAL_DURATION} sec long."
)

# target 1 KHz sampling rate
decimation = sampling_rate // DECIMATION_FACTOR
# target user-specified sampling rate
decimation = sampling_rate // key["target_sampling_rate"]

# get the LFP filter that matches the raw data
filter = (
Expand Down
5 changes: 1 addition & 4 deletions src/spyglass/spikesorting/v1/curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,7 @@ def insert_metric_curation(cls, key: Dict, apply_merge=False):
labels=MetricCuration.get_labels(key) or None,
merge_groups=MetricCuration.get_merge_groups(key) or None,
apply_merge=apply_merge,
description=(
"metric curation of sorting id "
+ f"{sorting_id}, curation id {parent_curation_id}"
),
description=(f"metric_curation_id: {key['metric_curation_id']}"),
)

return curation_key
Expand Down

0 comments on commit 4a1aa6c

Please sign in to comment.