{"id":21607,"library":"neo","title":"Neo","description":"Neo is a Python package for representing electrophysiology data, with support for reading a wide range of neurophysiology file formats. Current version 0.14.4, requires Python >=3.10. Release cadence is irregular.","status":"active","version":"0.14.4","language":"python","source_language":"en","source_url":"https://github.com/NeuralEnsemble/python-neo","tags":["electrophysiology","neuroscience","data-format","spikes","signals"],"install":[{"cmd":"pip install neo","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Numerical arrays and mathematical operations","package":"numpy","optional":false},{"reason":"Physical quantities with units","package":"quantities","optional":false}],"imports":[{"note":"Block is now in neo.core, not top-level since 0.10.0.","wrong":"from neo import Block","symbol":"Block","correct":"from neo.core import Block"},{"note":"Segment moved to neo.core.","wrong":"from neo import Segment","symbol":"Segment","correct":"from neo.core import Segment"},{"note":"AnalogSignal moved to neo.core.","wrong":"from neo import AnalogSignal","symbol":"AnalogSignal","correct":"from neo.core import AnalogSignal"},{"note":"SpikeTrain moved to neo.core.","wrong":"from neo import SpikeTrain","symbol":"SpikeTrain","correct":"from neo.core import SpikeTrain"}],"quickstart":{"code":"import neo\nfrom neo.core import Block, Segment, AnalogSignal, SpikeTrain\nimport quantities as pq\nimport numpy as np\n\n# Create a Block with a Segment\nblock = Block(name='example')\nseg = Segment(name='segment1')\nblock.segments.append(seg)\n\n# Create an AnalogSignal (1 second of data, 100 Hz)\nsignal = AnalogSignal(np.random.rand(100), sampling_rate=100*pq.Hz, units='mV', name='test')\nseg.analogsignals.append(signal)\n\n# Create a SpikeTrain\nst = SpikeTrain([0.1, 0.2, 0.3, 0.5]*pq.s, t_stop=1.0*pq.s, units='s', name='test_spikes')\nseg.spiketrains.append(st)\n\nprint('Block:', block)\nprint('Signals:', seg.analogsignals)\nprint('Spike trains:', seg.spiketrains)","lang":"python","description":"Quickstart: creating a basic hierarchical data structure with Block, Segment, AnalogSignal, and SpikeTrain."},"warnings":[{"fix":"Change 'from neo import Block' to 'from neo.core import Block'.","message":"In version 0.10.0, core classes were moved from neo.core to neo.core, but the top-level imports (e.g., from neo import Block) were removed. Use from neo.core import ...","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Always use quantities (e.g., 1.0*pq.s) for time and amplitude values.","message":"Units handling changed: quantities become mandatory for signal and spike train objects. Passing plain numbers without units may raise errors or produce unexpected behavior.","severity":"breaking","affected_versions":">=0.12.0"},{"fix":"Use 'from neo.io import ...' instead of 'from neo.file_io import ...'.","message":"The 'file_io' subpackage is deprecated in favor of 'io'. Importing from neo.file_io will emit a deprecation warning.","severity":"deprecated","affected_versions":">=0.14.0"},{"fix":"Ensure signal data is 2D, e.g., np.random.rand(100, 1).","message":"Data arrays for AnalogSignal must be 2D (time x channel) even for single-channel data. If you pass a 1D array, it may automatically reshape but check shape.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from neo.core import Block'.","cause":"Block and other core classes moved from neo top-level to neo.core in version 0.10.0.","error":"ImportError: cannot import name 'Block' from 'neo'"},{"fix":"Add units='mV' or similar using quantities (import quantities as pq).","cause":"AnalogSignal requires units parameter as a quantities object.","error":"ValueError: Must supply units for AnalogSignal"},{"fix":"Convert units to a common base before arithmetic, e.g., signal.rescale('mV').","cause":"Mixing incompatible units in operations.","error":"TypeError: unsupported operand type(s) for /: 'Quantity' and 'Quantity'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}