Update py-elephant to 1.1.0
1 unresolved thread
1 unresolved thread
Merge request reports
Activity
Filter activity
thanks @moritzkern :)
from what I can see in the logs one test fails:
elephant/test/test_spike_train_synchrony.py:454: elephant/spike_train_synchrony.py:359: TypeError E TypeError: 'SpikeTrainList' object does not support item assignment
Full failed test log
=================================== FAILURES =================================== _ SynchrofactDetectionTestCase.test_correct_transfer_of_spiketrain_attributes __ self = <elephant.test.test_spike_train_synchrony.SynchrofactDetectionTestCase testMethod=test_correct_transfer_of_spiketrain_attributes> def test_correct_transfer_of_spiketrain_attributes(self): # for delete=True the spiketrains in the block are changed, # test if their attributes remain correct sampling_rate = 1 / pq.s spiketrain = neo.SpikeTrain([1, 1, 5, 0] * pq.s, t_stop=10 * pq.s) block = neo.Block() group = neo.Group(name='Test Group') block.groups.append(group) group.spiketrains.append(spiketrain) segment = neo.Segment() block.segments.append(segment) segment.block = block segment.spiketrains.append(spiketrain) spiketrain.segment = segment spiketrain.annotate(cool_spike_train=True) spiketrain.array_annotate( spike_number=np.arange(len(spiketrain.times.magnitude))) spiketrain.waveforms = np.sin( np.arange(len(spiketrain.times.magnitude))[:, np.newaxis] + np.arange(len(spiketrain.times.magnitude))[np.newaxis, :]) correct_mask = np.array([False, False, True, True]) # store the correct attributes correct_annotations = spiketrain.annotations.copy() correct_waveforms = spiketrain.waveforms[correct_mask].copy() correct_array_annotations = {key: value[correct_mask] for key, value in spiketrain.array_annotations.items()} # perform a synchrofact search with delete=True synchrofact_obj = Synchrotool( [spiketrain], spread=0, sampling_rate=sampling_rate, binary=False) synchrofact_obj.delete_synchrofacts( mode='delete', in_place=True, threshold=2) elephant/test/test_spike_train_synchrony.py:454: self = <elephant.spike_train_synchrony.Synchrotool object at 0x7f8b6373e9d0> threshold = 2, in_place = True, mode = 'delete' def delete_synchrofacts(self, threshold, in_place=False, mode='delete'): """ Delete or extract synchronous spiking events. Parameters ---------- threshold : int Threshold value for the deletion of spikes engaged in synchronous activity. * `deletion_threshold >= 2` leads to all spikes with a larger or equal complexity value to be deleted/extracted. * `deletion_threshold <= 1` leads to a ValueError, since this would delete/extract all spikes and there are definitely more efficient ways of doing so. in_place : bool, optional Determines whether the modification are made in place on ``self.input_spiketrains``. Default: False mode : {'delete', 'extract'}, optional Inversion of the mask for deletion of synchronous events. * ``'delete'`` leads to the deletion of all spikes with complexity >= `threshold`, i.e. deletes synchronous spikes. * ``'extract'`` leads to the deletion of all spikes with complexity < `threshold`, i.e. extracts synchronous spikes. Default: 'delete' Raises ------ ValueError If `mode` is not one in {'delete', 'extract'}. If `threshold <= 1`. Returns ------- list of neo.SpikeTrain List of spiketrains where the spikes with ``complexity >= threshold`` have been deleted/extracted. * If ``in_place`` is True, the returned list is the same as ``self.input_spiketrains``. * If ``in_place`` is False, the returned list is a deepcopy of ``self.input_spiketrains``. """ if not self.annotated: self.annotate_synchrofacts() if mode not in ['delete', 'extract']: raise ValueError(f"Invalid mode '{mode}'. Valid modes are: " f"'delete', 'extract'") if threshold <= 1: raise ValueError('A deletion threshold <= 1 would result ' 'in the deletion of all spikes.') if in_place: spiketrain_list = self.input_spiketrains else: spiketrain_list = deepcopy(self.input_spiketrains) for idx, st in enumerate(spiketrain_list): mask = st.array_annotations['complexity'] < threshold if mode == 'extract': mask = np.invert(mask) new_st = st[mask] if in_place and st.segment is not None: segment = st.segment try: # replace link to spiketrain in segment new_index = self._get_spiketrain_index( segment.spiketrains, st) segment.spiketrains[new_index] = new_st E TypeError: 'SpikeTrainList' object does not support item assignment elephant/spike_train_synchrony.py:359: TypeError
Any ideas?
Hey @elmath ,
Sry, I forgot to update Elephants requirement for neo>0.13.0. .
Related to issues in !486 (merged) .
Edited by Moritz Kern
OK, in that case, I'll need to merge !486 (merged) first. Thanks!
- Resolved by Eleni Mathioulaki
Thanks, for resolving !486 (merged) so promptly. Please let me know if there is anything else