Skip to content

Commit

Permalink
Fixed noise levels propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
DradeAW committed Nov 17, 2023
1 parent 850c6dc commit 675667f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/spikeinterface/core/baserecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BaseRecording(BaseRecordingSnippets):
_main_properties = ["group", "location", "gain_to_uV", "offset_to_uV"]
_main_features = [] # recording do not handle features

_skip_properties = ["noise_level_raw", "noise_level_scaled"]
_skip_properties = ["noise_level_std_raw", "noise_level_std_scaled", "noise_level_mad_raw", "noise_level_mad_scaled"]

def __init__(self, sampling_frequency: float, channel_ids: List, dtype):
BaseRecordingSnippets.__init__(
Expand Down
18 changes: 9 additions & 9 deletions src/spikeinterface/core/tests/test_noise_levels_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ def test_skip_noise_levels_propagation():
rec = generate_recording(durations=[5.0], num_channels=4)
rec.set_property("test", ["1", "2", "3", "4"])
rec = rec.save()
noise_level_raw = get_noise_levels(rec, return_scaled=False)
assert "noise_level_raw" in rec.get_property_keys()
noise_level_raw = get_noise_levels(rec, return_scaled=False, method="mad")
assert "noise_level_mad_raw" in rec.get_property_keys()

rec_frame_slice = rec.frame_slice(start_frame=0, end_frame=1000)
assert "noise_level_raw" not in rec_frame_slice.get_property_keys()
assert "noise_level_mad_raw" not in rec_frame_slice.get_property_keys()
assert "test" in rec_frame_slice.get_property_keys()

# make scaled
rec.set_channel_gains([100] * 4)
rec.set_channel_offsets([0] * 4)
noise_level_scaled = get_noise_levels(rec, return_scaled=True)
assert "noise_level_scaled" in rec.get_property_keys()
noise_level_scaled = get_noise_levels(rec, return_scaled=True, method="std")
assert "noise_level_std_scaled" in rec.get_property_keys()

rec_frame_slice = rec.frame_slice(start_frame=0, end_frame=1000)
rec_concat = concatenate_recordings([rec] * 5)

assert "noise_level_raw" not in rec_concat.get_property_keys()
assert "noise_level_scaled" not in rec_concat.get_property_keys()
assert "noise_level_raw" not in rec_frame_slice.get_property_keys()
assert "noise_level_scaled" not in rec_frame_slice.get_property_keys()
assert "noise_level_mad_raw" not in rec_concat.get_property_keys()
assert "noise_level_std_scaled" not in rec_concat.get_property_keys()
assert "noise_level_mad_raw" not in rec_frame_slice.get_property_keys()
assert "noise_level_std_scaled" not in rec_frame_slice.get_property_keys()
assert "test" in rec_frame_slice.get_property_keys()
assert "test" in rec_concat.get_property_keys()

Expand Down

0 comments on commit 675667f

Please sign in to comment.