NeuralEnsemble / python-neo

Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats
http://neo.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
325 stars 248 forks source link

Deprecation in pq.Quantity of the copy argument #1529

Closed mscheltienne closed 1 month ago

mscheltienne commented 2 months ago

Spotted today on CIs in MNE-Python: https://github.com/mne-tools/mne-python/actions/runs/10577451925/job/29305474492?pr=12815#step:17:5232

 neo/io/proxyobjects.py:296: in load
    anasig = AnalogSignal(
neo/core/analogsignal.py:202: in __new__
    obj = pq.Quantity(signal, units=units, dtype=dtype, copy=copy).view(cls)
quantities/quantity.py:120: in __new__
    warnings.warn(("The 'copy' argument in Quantity is deprecated and will be removed in the future. "
E   quantities.QuantitiesDeprecationWarning: The 'copy' argument in Quantity is deprecated and will be removed in the future. The argument has no effect since quantities-0.16.0 (to aid numpy-2.0 support).
apdavison commented 2 months ago

@zm711 can you handle this?

zm711 commented 2 months ago

Sure looks like a pretty quick fix. I'll assign myself. I'm busy today, but will work on this week!

zm711 commented 2 months ago

@apdavison,

We have a huge portion of our object model that relies on copy vs view of the data. The new default is now always a view, so we have some test failures here because we are testing for copy vs view. Do we want to try to maintain this behavior at the Neo level instead of the quantities level. I think we could just add some deepcopies into the Neo code instead of passing copy to Quantities. I think I will actually move discussion to my issue #1534 for us to strategize.