toy example with multi columns
@@ -8,7 +8,8 @@ from probeinterface import Probe
def toy_example(duration=10, num_channels=4, num_units=10,
sampling_frequency=30000.0, num_segments=2,
average_peak_amplitude=-100, upsample_factor=13,
- dumpable=False, dump_folder=None, seed=None):
+ contact_spacing_um=40, num_columns=1,
+ seed=None):
'''
Creates toy recording and sorting extractors.
@@ -24,21 +25,15 @@ def toy_example(duration=10, num_channels=4, num_units=10,
Sampling frequency (default 30000)
num_segments: int default 2
Number of segments.
- dumpable: bool
- If True, objects are dumped to file and become 'dumpable'
- dump_folder: str or Path
- Path to dump folder (if None, 'test' is used
seed: int
Seed for random initialization
Returns
-------
recording: RecordingExtractor
- The output recording extractor. If dumpable is False it's a NumpyRecordingExtractor, otherwise it's an
- MdaRecordingExtractor
+ The output recording extractor.
sorting: SortingExtractor
- The output sorting extractor. If dumpable is False it's a NumpyRecordingExtractor, otherwise it's an
- NpzSortingExtractor
+ The output sorting extractor.
'''
if isinstance(duration, int):
@@ -56,6 +51,7 @@ def toy_example(duration=10, num_channels=4, num_units=10,
assert num_units > 0
waveforms, geometry = synthesize_random_waveforms(num_units=num_units, num_channels=num_channels,
+ contact_spacing_um=contact_spacing_um, num_columns=num_columns,
average_peak_amplitude=average_peak_amplitude,
upsample_factor=upsample_factor, seed=seed)
@@ -161,7 +157,7 @@ def enforce_refractory_period(times_in, refr):
def synthesize_random_waveforms(num_channels=5, num_units=20, width=500,
upsample_factor=13, timeshift_factor=0, average_peak_amplitude=-10,
- distance_um=40, seed=None):
+ contact_spacing_um=40, num_columns=1, seed=None):
if seed is not None:
np.random.seed(seed)
seeds = np.random.RandomState(seed=seed).randint(0, 2147483647, num_units)
@@ -177,7 +173,18 @@ def synthesize_random_waveforms(num_channels=5, num_units=20, width=500,
geom_spread_coef2 = 0.1
geometry = np.zeros((num_channels, 2))
- geometry[:, 1] = np.arange(num_channels) * distance_um
+ if num_columns == 1:
+ geometry[:, 1] = np.arange(num_channels) * contact_spacing_um
+ else:
+ assert num_channels % num_columns == 0, 'Invalid num_columns'
+ num_contact_per_column = num_channels // num_columns
+ print(num_contact_per_column)
+ j = 0
+ for i in range(num_columns):
+ print(j, j+num_contact_per_column)
+ geometry[j:j+num_contact_per_column, 0] = i * contact_spacing_um
+ geometry[j:j+num_contact_per_column, 1] = np.arange(num_contact_per_column) * contact_spacing_um
+ j += num_contact_per_column
avg_durations = np.array(avg_durations)
avg_amps = np.array(avg_amps)
