NeurodataWithoutBorders / pynwb

A Python API for working with Neurodata stored in the NWB Format
https://pynwb.readthedocs.io
Other
174 stars 85 forks source link

[Bug]: Units.waveform_mean.sampling_rate #1501

Open bendichter opened 2 years ago

bendichter commented 2 years ago

What happened?

These lines:

https://github.com/NeurodataWithoutBorders/pynwb/blob/b881c7b93b04a9d629c04f74a0e82305db1f0df4/src/pynwb/io/core.py#L74-L84

are not covered by tests according to codecov. It looks like what they are trying to do is make it so that you can get the sampling rate of waveform VectorData object via Units.waveform_mean.sampling_rate, however when I try to add this to the tests it does not work.

Steps to Reproduce

I am trying to add this to tests/unit/pynwb_tests/test_misc.py::TestUnitsIO:

    def test_get_waveform_mean(self):
        ut = self.roundtripContainer()
        self.assertEqual(ut.waveform_mean.sampling_rate, 40000.)

Traceback

Traceback (most recent call last):
  File "/Users/bendichter/dev/pynwb/tests/integration/hdf5/test_misc.py", line 77, in test_get_waveform_mean
    self.assertEqual(ut.waveform_mean.sampling_rate, 40000.)
AttributeError: 'VectorData' object has no attribute 'sampling_rate'

Operating System

macOS

Python Executable

Conda

Python Version

3.9

Package Versions

No response

Code of Conduct

bendichter commented 2 years ago

@rly it looks like you added these lines 2 years ago: https://github.com/NeurodataWithoutBorders/pynwb/pull/1146

if this helps track down the intended behavior