Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
khl02007 committed Jan 23, 2024
2 parents 3fe7f86 + 0c8dcb3 commit b1ae3e2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Increase pytest coverage for `common`, `lfp`, and `utils`. #743
- Update docs to reflect new notebooks. #776
- Add overview of Spyglass to docs. #779
- LFPV1: Fix error for multiple lfp settings on same data #775

### Pipelines

Expand Down
29 changes: 21 additions & 8 deletions src/spyglass/lfp/v1/lfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def make(self, key):
# need to censor the valid times to account for the downsampling
lfp_valid_times = interval_list_censor(valid_times, timestamp_interval)

# add an interval list for the LFP valid times, skipping duplicates
# add an interval list for the LFP valid times, or check that it matches the existing one
key["interval_list_name"] = "_".join(
(
"lfp",
Expand All @@ -164,15 +164,28 @@ def make(self, key):
"valid times",
)
)
IntervalList.insert1(
{

tmp_valid_times = (
IntervalList
& {
"nwb_file_name": key["nwb_file_name"],
"interval_list_name": key["interval_list_name"],
"valid_times": lfp_valid_times,
"pipeline": "lfp_v1",
},
replace=True,
)
}
).fetch("valid_times")
if len(tmp_valid_times) == 0:
IntervalList.insert1(
{
"nwb_file_name": key["nwb_file_name"],
"interval_list_name": key["interval_list_name"],
"valid_times": lfp_valid_times,
"pipeline": "lfp_v1",
},
replace=True,
)
elif not np.allclose(tmp_valid_times[0], lfp_valid_times):
raise ValueError(
"previously saved lfp times do not match current times"
)
self.insert1(key)

# finally, we insert this into the LFP output table.
Expand Down

0 comments on commit b1ae3e2

Please sign in to comment.