Skip to content

NixIO does not preserve shape of empty waveforms #373

Open

Description

@JuliaSprenger

When saving a spiketrain with a waveform array of shape (0,0,0) and loading it again using the NixIO, the new shape of the waveform array is (0,).

Here is some code showing this explicitely:

from neo import Block, Segment, SpikeTrain, NixIO
import quantities as pq
import numpy as np

bl = Block()
seg = Segment()
bl.segments.append(seg)

st = SpikeTrain([1,2,3]*pq.s,t_start=0*pq.s,t_stop=10*pq.s,
                sampling_rate=1*pq.Hz)
wfs = np.array([]).reshape((0,0,0))*pq.V
st.waveforms = wfs

bl.segments[0].spiketrains.append(st)

with NixIO('test.nix','ow') as nio:
    nio.write_block(bl)
    print('waveform shape before writing {}'
          ''.format(bl.segments[0].spiketrains[0].waveforms.shape))

with NixIO('test.nix','ro') as nio:
    block = nio.read_block()
    print('waveform shape after loading {}'
          ''.format(block.segments[0].spiketrains[0].waveforms.shape))

The prints are:

waveform shape before writing (0, 0, 0)
waveform shape after loading (0,)

Activity

  1. achilleas-k commented on Aug 17, 2017

    @achilleas-k
    Contributor

    Just letting you know I've noted this issue and will fix it soon.

  2. modified the milestones: future, 0.5.2 on Sep 9, 2017
  3. apdavison commented on Sep 26, 2017

    @apdavison
    Member

    @achilleas-k any progress with this?

  4. achilleas-k commented on Sep 27, 2017

    @achilleas-k
    Contributor

    None yet. I've been working on some of the optimisation issues in NIXPY.
    I also have a PR for handling scaled and compound units that's almost ready and I'll include a fix for this when it's ready.

  5. modified the milestones: 0.5.2, future on Sep 27, 2017
  6. 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

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions