Skip to content

Commit

Permalink
Add option to define dtype externally for highpass-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoe91 committed May 21, 2024
1 parent 54d3f92 commit 8b622cc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/spikeinterface/preprocessing/highpass_spatial_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numpy as np

from .basepreprocessor import BasePreprocessor, BasePreprocessorSegment
from .filter import fix_dtype
from ..core import order_channels_by_depth, get_chunk_with_margin
from ..core.core_tools import define_function_from_class

Expand Down Expand Up @@ -47,6 +48,8 @@ class HighpassSpatialFilterRecording(BasePreprocessor):
Order of spatial butterworth filter
highpass_butter_wn : float, default: 0.01
Critical frequency (with respect to Nyquist) of spatial butterworth filter
dtype : dtype, default: None
The dtype of the output traces. If None, the dtype is the same as the input traces
Returns
-------
Expand All @@ -73,6 +76,7 @@ def __init__(
agc_window_length_s=0.1,
highpass_butter_order=3,
highpass_butter_wn=0.01,
dtype=None,
):
BasePreprocessor.__init__(self, recording)

Expand Down Expand Up @@ -117,7 +121,7 @@ def __init__(
butter_kwargs = dict(btype="highpass", N=highpass_butter_order, Wn=highpass_butter_wn)
sos_filter = scipy.signal.butter(**butter_kwargs, output="sos")

dtype = recording.get_dtype()
dtype = fix_dtype(recording, dtype)

for parent_segment in recording._recording_segments:
rec_segment = HighPassSpatialFilterSegment(
Expand Down

0 comments on commit 8b622cc

Please sign in to comment.