Skip to content

Commit

Permalink
Merge pull request #3200 from h-mayorquin/remove_names_in_preprocessing
Browse files Browse the repository at this point in the history
Remove name class attribute in preprocessing module
  • Loading branch information
samuelgarcia authored Jul 15, 2024
2 parents b338357 + d886f76 commit bf4115d
Show file tree
Hide file tree
Showing 25 changed files with 1 addition and 61 deletions.
2 changes: 1 addition & 1 deletion src/spikeinterface/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class BaseExtractor:
# these properties are skipped by default in copy_metadata
_skip_properties = []

installed = True
installation_mesg = ""
installed = True

def __init__(self, main_ids: Sequence) -> None:
# store init kwargs for nested serialisation
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/align_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@


class AlignSnippets(BaseSnippets):
installed = True # check at class level if installed or not
installation_mesg = "" # err
name = "align_snippets"

def __init__(self, snippets, new_nbefore, new_nafter, mode="main_peak", interpolate=1, det_sign=0):
assert isinstance(snippets, BaseSnippets), "'snippets' must be a SnippetsExtractor"
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/average_across_direction.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@


class AverageAcrossDirectionRecording(BaseRecording):
name = "average_across_direction"
installed = True

def __init__(
self,
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/preprocessing/basepreprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class BasePreprocessor(BaseRecording):
installed = True # check at class level if installed or not
installation_mesg = "" # err

def __init__(self, recording, sampling_frequency=None, channel_ids=None, dtype=None):
Expand Down
4 changes: 0 additions & 4 deletions src/spikeinterface/preprocessing/clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class ClipRecording(BasePreprocessor):
The clipped traces recording extractor object
"""

name = "clip"

def __init__(self, recording, a_min=None, a_max=None):
value_min = a_min
value_max = a_max
Expand Down Expand Up @@ -86,8 +84,6 @@ class BlankSaturationRecording(BasePreprocessor):
"""

name = "blank_staturation"

def __init__(
self,
recording,
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/common_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ class CommonReferenceRecording(BasePreprocessor):
"""

name = "common_reference"

def __init__(
self,
recording: BaseRecording,
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/decimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class DecimateRecording(BasePreprocessor):
"""

name = "decimate"

def __init__(
self,
recording,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ class DeepInterpolatedRecording(BasePreprocessor):
The deepinterpolated recording extractor object
"""

name = "deepinterpolate"

def __init__(
self,
recording,
Expand Down
3 changes: 0 additions & 3 deletions src/spikeinterface/preprocessing/depth_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ class DepthOrderRecording(ChannelSliceRecording):
If flip is True then the order is upper first.
"""

name = "depth_order"
installed = True

def __init__(self, parent_recording, channel_ids=None, dimensions=("x", "y"), flip=False):
order_f, order_r = order_channels_by_depth(
parent_recording, channel_ids=channel_ids, dimensions=dimensions, flip=flip
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/directional_derivative.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@


class DirectionalDerivativeRecording(BasePreprocessor):
name = "directional_derivative"
installed = True

def __init__(
self,
Expand Down
8 changes: 0 additions & 8 deletions src/spikeinterface/preprocessing/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ class FilterRecording(BasePreprocessor):
The filtered recording extractor object
"""

name = "filter"

def __init__(
self,
recording,
Expand Down Expand Up @@ -193,8 +191,6 @@ class BandpassFilterRecording(FilterRecording):
The bandpass-filtered recording extractor object
"""

name = "bandpass_filter"

def __init__(self, recording, freq_min=300.0, freq_max=6000.0, margin_ms=5.0, dtype=None, **filter_kwargs):
FilterRecording.__init__(
self, recording, band=[freq_min, freq_max], margin_ms=margin_ms, dtype=dtype, **filter_kwargs
Expand Down Expand Up @@ -228,8 +224,6 @@ class HighpassFilterRecording(FilterRecording):
The highpass-filtered recording extractor object
"""

name = "highpass_filter"

def __init__(self, recording, freq_min=300.0, margin_ms=5.0, dtype=None, **filter_kwargs):
FilterRecording.__init__(
self, recording, band=freq_min, margin_ms=margin_ms, dtype=dtype, btype="highpass", **filter_kwargs
Expand Down Expand Up @@ -260,8 +254,6 @@ class NotchFilterRecording(BasePreprocessor):
The notch-filtered recording extractor object
"""

name = "notch_filter"

def __init__(self, recording, freq=3000, q=30, margin_ms=5.0, dtype=None):
# coeef is 'ba' type
fn = 0.5 * float(recording.get_sampling_frequency())
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/filter_gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class GaussianFilterRecording(BasePreprocessor):
The filtered recording extractor object.
"""

name = "gaussian_filter"

def __init__(
self, recording: BaseRecording, freq_min: float = 300.0, freq_max: float = 5000.0, margin_sd: float = 5.0
):
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/filter_opencl.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class FilterOpenCLRecording(BasePreprocessor):
"""

name = "filter"

def __init__(
self,
recording,
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/highpass_spatial_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ class HighpassSpatialFilterRecording(BasePreprocessor):
https://www.internationalbrainlab.com/repro-ephys
"""

name = "highpass_spatial_filter"

def __init__(
self,
recording,
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/interpolate_bad_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class InterpolateBadChannelsRecording(BasePreprocessor):
The recording object with interpolated bad channels
"""

name = "interpolate_bad_channels"

def __init__(self, recording, bad_channel_ids, sigma_um=None, p=1.3, weights=None):
BasePreprocessor.__init__(self, recording)

Expand Down
8 changes: 0 additions & 8 deletions src/spikeinterface/preprocessing/normalize_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ class NormalizeByQuantileRecording(BasePreprocessor):
The rescaled traces recording extractor object
"""

name = "normalize_by_quantile"

def __init__(
self,
recording,
Expand Down Expand Up @@ -145,8 +143,6 @@ class ScaleRecording(BasePreprocessor):
The transformed traces recording extractor object
"""

name = "scale"

def __init__(self, recording, gain=1.0, offset=0.0, dtype="float32"):
if dtype is None:
dtype = recording.get_dtype()
Expand Down Expand Up @@ -204,8 +200,6 @@ class CenterRecording(BasePreprocessor):
The centered traces recording extractor object
"""

name = "center"

def __init__(self, recording, mode="median", dtype="float32", **random_chunk_kwargs):
assert mode in ("median", "mean")
random_data = get_random_data_chunks(recording, **random_chunk_kwargs)
Expand Down Expand Up @@ -261,8 +255,6 @@ class ZScoreRecording(BasePreprocessor):
The centered traces recording extractor object
"""

name = "zscore"

def __init__(
self,
recording,
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/phase_shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class PhaseShiftRecording(BasePreprocessor):
The phase shifted recording object
"""

name = "phase_shift"

def __init__(self, recording, margin_ms=40.0, inter_sample_shift=None, dtype=None):
if inter_sample_shift is None:
assert "inter_sample_shift" in recording.get_property_keys(), "'inter_sample_shift' is not a property!"
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/preprocessing/preprocessinglist.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,4 @@
UnsignedToSignedRecording,
]

installed_preprocessers_list = [pp for pp in preprocessers_full_list if pp.installed]
preprocesser_dict = {pp_class.name: pp_class for pp_class in preprocessers_full_list}
1 change: 0 additions & 1 deletion src/spikeinterface/preprocessing/rectify.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class RectifyRecording(BasePreprocessor):
name = "rectify"

def __init__(self, recording):
BasePreprocessor.__init__(self, recording)
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/remove_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ class RemoveArtifactsRecording(BasePreprocessor):
The recording extractor after artifact removal
"""

name = "remove_artifacts"

def __init__(
self,
recording,
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class ResampleRecording(BasePreprocessor):
"""

name = "resample"

def __init__(
self,
recording,
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/silence_periods.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ class SilencedPeriodsRecording(BasePreprocessor):
The recording extractor after silencing some periods
"""

name = "silence_periods"

def __init__(self, recording, list_periods, mode="zeros", noise_levels=None, seed=None, **random_chunk_kwargs):
available_modes = ("zeros", "noise")
num_seg = recording.get_num_segments()
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/unsigned_to_signed.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class UnsignedToSignedRecording(BasePreprocessor):
For example, a `bit_depth` of 12 will correct for an offset of `2**11`
"""

name = "unsigned_to_signed"

def __init__(
self,
recording,
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/whiten.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class WhitenRecording(BasePreprocessor):
The whitened recording extractor
"""

name = "whiten"

def __init__(
self,
recording,
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/preprocessing/zero_channel_pad.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ def get_num_samples(self):


class ZeroChannelPaddedRecording(BaseRecording):
name = "zero_channel_pad"
installed = True

def __init__(self, recording: BaseRecording, num_channels: int, channel_mapping: Union[list, None] = None):
"""Pads a recording with channels that contain only zero.
Expand Down

0 comments on commit bf4115d

Please sign in to comment.