Skip to content

Commit

Permalink
Merge branch 'main' into deepinterp
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoe91 authored Sep 13, 2023
2 parents d5880fd + c94c8ae commit 6a68907
Show file tree
Hide file tree
Showing 3 changed files with 438 additions and 34 deletions.
17 changes: 9 additions & 8 deletions src/spikeinterface/core/generate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import math

import warnings
import numpy as np
from typing import Union, Optional, List, Literal

Expand Down Expand Up @@ -1037,13 +1037,14 @@ def __init__(
parent_recording: Union[BaseRecording, None] = None,
num_samples: Optional[List[int]] = None,
upsample_vector: Union[List[int], None] = None,
check_borbers: bool = True,
check_borders: bool = False,
) -> None:
templates = np.asarray(templates)
if check_borbers:
# TODO: this should be external to this class. It is not the responsability of this class to check the templates
if check_borders:
self._check_templates(templates)
# lets test this only once so force check_borbers=false for kwargs
check_borbers = False
# lets test this only once so force check_borders=False for kwargs
check_borders = False
self.templates = templates

channel_ids = parent_recording.channel_ids if parent_recording is not None else list(range(templates.shape[2]))
Expand Down Expand Up @@ -1131,7 +1132,7 @@ def __init__(
"nbefore": nbefore,
"amplitude_factor": amplitude_factor,
"upsample_vector": upsample_vector,
"check_borbers": check_borbers,
"check_borders": check_borders,
}
if parent_recording is None:
self._kwargs["num_samples"] = num_samples
Expand All @@ -1144,8 +1145,8 @@ def _check_templates(templates: np.ndarray):
threshold = 0.01 * max_value

if max(np.max(np.abs(templates[:, 0])), np.max(np.abs(templates[:, -1]))) > threshold:
raise Exception(
"Warning!\nYour templates do not go to 0 on the edges in InjectTemplatesRecording.__init__\nPlease make your window bigger."
warnings.warn(
"Warning! Your templates do not go to 0 on the edges in InjectTemplatesRecording. Please make your window bigger."
)


Expand Down
Loading

0 comments on commit 6a68907

Please sign in to comment.