Skip to content

SpikeTrain waveform as AnalogSignalArray #105

Open

Description

@toddrjen

Originally from #62 Remove sampling_rate from SpikeTrain

crodger wrote on 2011-09-28 01:15:59:

Actually it has not been clarified exactly what waveforms should be yet. Let me propose this:

* `waveforms` is a list of AnalogSignalArray
* len(sptr.waveforms) = len(sptr)
* sptr.waveforms[n].shape = (N_channels, spike_duration_in_channels)
* sptr.waveforms[n].t_start = sptr[n] - left_sweep
* sptr.waveforms[n].sampling_rate = sampling_rate

Then we do not need sampling rate or left sweep in sptr. It makes sense because these are properties of the waveforms, not the spike times. We also allow flexibility: each spike can be sliced differently.

Also, since t_start and sampling_rate are required (or highly recommended) for AnalogSignalArray, we will have to specify these attributes for each entry in sptr.waveforms anyway.

We can even define a property of SpikeTrain for left_sweep and sampling rate.

@property
def left_sweep(self):
  x = np.unique([self - wf.t_start for wf in self.waveforms])
  if len(x) == 1:
    return x[0]
  else: 
    raise ValueError("sampling rates are not consistent")

If the user knows that left_sweep should be consistent, this property confirms it. If left_sweep is not supposed to be consistent, the user should not be accessing the property anyway, so it appropriate to raise an exception. We can add another property without error checking if desired.

Actually it will need to be slightly more complicated because these values are floats, but you get the idea.

Activity

  1. modified the milestones: 0.5, 0.4 on Jul 4, 2016
  2. modified the milestones: 0.5, 0.5.1 on Mar 24, 2017
  3. modified the milestones: 0.5.1, 0.5.2 on Jun 15, 2017
  4. JuliaSprenger commented on Jun 20, 2017

    @JuliaSprenger
    Member

    Is this idea still up to date?
    Looking at the current order of dimensions in the AnalogSignal, the proposed change would also imply a reordering of dimensions for the spiketrain waveforms from (n_spike X channel_index X time) [see Issue #62] to (time X channel_id X n_spike). This would imply not only changes for all the IOs, but basically at any point where waveforms are used.

  5. samuelgarcia commented on Jun 21, 2017

    @samuelgarcia
    Contributor

    See issue #343

  6. apdavison commented on Jun 21, 2017

    @apdavison
    Member

    There seemed to be a strong feeling in #62 that waveforms should be a 3D array for efficiency reasons. However, I still feel that many attributes that should belong to waveforms have been added to SpikeTrain, and I think we should clean this up before releasing Neo 1.0.

    We have been considering adding support in Neo for optical imaging signals (e.g. calcium imaging). This would require an image-sequence class based on a 3D array. Perhaps we could have a base 3D array class, then subclass for image sequence and for waveforms.

    In each case, the first dimension should be time, for consistency with AnalogSignal.

  7. modified the milestones: future, 0.5.2 on Sep 9, 2017
  8. self-assigned this
    on Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions