Skip to content

Commit efbf8e6

Browse files
committed
flake + bump version number 2.4.2
1 parent 0fe4668 commit efbf8e6

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

phylib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
__author__ = 'Cyrille Rossant'
2626
__email__ = 'cyrille.rossant at gmail.com'
27-
__version__ = '2.4.1'
27+
__version__ = '2.4.2'
2828
__version_git__ = __version__ + _git_version()
2929

3030

phylib/io/alf.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ def make_template_and_spikes_objects(self):
239239
# and not seconds
240240
self._save_npy('spikes.times.npy', self.model.spike_times)
241241
self._save_npy('spikes.samples.npy', self.model.spike_samples)
242-
spike_amps, templates_v, template_amps = self.model.get_amplitudes_true(self.ampfactor, use='templates')
242+
spike_amps, templates_v, template_amps = self.model.get_amplitudes_true(self.ampfactor,
243+
use='templates')
243244
self._save_npy('spikes.amps.npy', spike_amps)
244245
self._save_npy('templates.amps.npy', template_amps)
245246

@@ -264,7 +265,8 @@ def make_template_and_spikes_objects(self):
264265
np.save(self.out_path.joinpath('templates.waveforms'), templates)
265266
np.save(self.out_path.joinpath('templates.waveformsChannels'), templates_inds)
266267

267-
_, clusters_v, cluster_amps = self.model.get_amplitudes_true(self.ampfactor, use='clusters')
268+
_, clusters_v, cluster_amps = self.model.get_amplitudes_true(self.ampfactor,
269+
use='clusters')
268270
n_clusters, n_wavsamps, nchall = clusters_v.shape
269271
# for some datasets, 32 may be too much
270272
ncw = min(self.model.n_closest_channels, nchall)
@@ -284,11 +286,8 @@ def make_template_and_spikes_objects(self):
284286
templates[t, ...] = clusters_v[t, :][:, templates_inds[t, :]]
285287
np.save(self.out_path.joinpath('clusters.waveforms'), templates)
286288
np.save(self.out_path.joinpath('clusters.waveformsChannels'), templates_inds)
287-
288-
# TODO check if we should save this here, will be inconsistent with what we have at the moment
289289
np.save(self.out_path.joinpath('clusters.amps'), cluster_amps)
290290

291-
292291
def rename_with_label(self):
293292
"""add the label as an ALF part name before the extension if any label provided"""
294293
if not self.label:

phylib/io/model.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ def _load_data(self):
413413
self.n_channels_loc = 0
414414

415415
# Clusters waveforms
416-
if not np.all(self.spike_clusters == self.spike_templates) and self.sparse_templates.cols is None:
416+
if not np.all(self.spike_clusters == self.spike_templates) and \
417+
self.sparse_templates.cols is None:
417418
self.merge_map, self.nan_idx = self.get_merge_map()
418419
self.sparse_clusters = self.cluster_waveforms()
419420
self.n_clusters = self.spike_clusters.max() + 1
@@ -872,7 +873,8 @@ def _template_n_channels(self, template_id, n_channels):
872873
channel_ids += [-1] * (n_channels - len(channel_ids))
873874
return channel_ids
874875

875-
def _get_template_dense(self, template_id, channel_ids=None, amplitude_threshold=None, unwhiten=True):
876+
def _get_template_dense(self, template_id, channel_ids=None, amplitude_threshold=None,
877+
unwhiten=True):
876878
"""Return data for one template."""
877879
if not self.sparse_templates:
878880
return
@@ -955,7 +957,8 @@ def get_template(self, template_id, channel_ids=None, amplitude_threshold=None,
955957
return self._get_template_sparse(template_id, unwhiten=unwhiten)
956958
else:
957959
return self._get_template_dense(
958-
template_id, channel_ids=channel_ids, amplitude_threshold=amplitude_threshold, unwhiten=unwhiten)
960+
template_id, channel_ids=channel_ids, amplitude_threshold=amplitude_threshold,
961+
unwhiten=unwhiten)
959962

960963
def get_waveforms(self, spike_ids, channel_ids=None):
961964
"""Return spike waveforms on specified channels."""
@@ -1212,7 +1215,8 @@ def get_cluster_mean_waveforms(self, cluster_id, unwhiten=True):
12121215
template = self.get_template(best_template, unwhiten=unwhiten)
12131216
channel_ids = template.channel_ids
12141217
# Get all templates from which this cluster stems from.
1215-
templates = [self.get_template(template_id, unwhiten=unwhiten) for template_id in template_ids]
1218+
templates = [self.get_template(template_id, unwhiten=unwhiten)
1219+
for template_id in template_ids]
12161220
# Construct the waveforms array.
12171221
ns = self.n_samples_waveforms
12181222
data = np.zeros((len(template_ids), ns, self.n_channels))
@@ -1313,7 +1317,8 @@ def cluster_waveforms(self):
13131317
for clust, val in self.merge_map.items():
13141318
if len(val) > 1:
13151319
mean_waveform = self.get_cluster_mean_waveforms(clust, unwhiten=False)
1316-
data[clust, :, mean_waveform.channel_ids] = np.swapaxes(mean_waveform.mean_waveforms, 0, 1)
1320+
data[clust, :, mean_waveform.channel_ids] = \
1321+
np.swapaxes(mean_waveform.mean_waveforms, 0, 1)
13171322
elif len(val) == 1:
13181323
data[clust, :, :] = self.sparse_templates.data[val[0], :, :]
13191324

phylib/io/tests/test_alf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from ..model import TemplateModel
2121

2222

23-
2423
#------------------------------------------------------------------------------
2524
# Fixture
2625
#------------------------------------------------------------------------------
@@ -236,7 +235,8 @@ def test_merger(dataset):
236235

237236
# merge the first two clusters
238237
merge_clu = clu[0:2]
239-
spike_clusters[np.bitwise_or(spike_clusters == clu[0], spike_clusters == clu[1])] = np.max(clu) + 1
238+
spike_clusters[np.bitwise_or(spike_clusters == clu[0],
239+
spike_clusters == clu[1])] = np.max(clu) + 1
240240
# split the cluster with the most spikes
241241
split_clu = clu[-1]
242242
idx = np.where(spike_clusters == split_clu)[0]

0 commit comments

Comments
 (0)