0.8.0.rst 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. =======================
  2. Neo 0.8.0 release notes
  3. =======================
  4. 30th September 2019
  5. Lazy loading
  6. ------------
  7. Neo 0.8 sees a major new feature, the ability to selectively load only parts of a data file
  8. (for supported file formats) into memory, for example only a subset of the signals
  9. in a segment, a subset of the channels in a signal, or even only a certain time slice of a given signal.
  10. This can lead to major savings in time and memory consumption, or can allow files that are too
  11. large to be loaded into memory in their entirety to be processed one section at a time.
  12. Here is an example, loading only certain sections of a signal::
  13. lim0, lim1 = -500*pq.ms, +1500*pq.ms
  14. seg = reader.read_segment(lazy=True) # this loads only the segment structure and metadata
  15. # but all data objects are replaced by proxies
  16. triggers = seg.events[0].load() # this loads all triggers in memory
  17. sigproxy = seg.analogsignals[0] # this is a proxy object
  18. all_sig_chunks = []
  19. for t in triggers.times:
  20. t0, t1 = (t + lim0), (t + lim1)
  21. sig_chunk = sigproxy.load(time_slice=(t0, t1)) # here the actual data are loaded
  22. all_sig_chunks.append(sig_chunk)
  23. Not all IO modules support lazy loading (but many do). To know whether a given IO class supports lazy mode,
  24. use ``SomeIO.support_lazy``.
  25. For more details, see :ref:`section-lazy`.
  26. Image sequence data
  27. -------------------
  28. Another new feature, although one that is more experimental, is support for image sequence data,
  29. coming from calcium imaging of neuronal activity, voltage-sensitive dye imaging, etc.
  30. The new :class:`ImageSequence` object contains a sequence of image frames as a 3D array.
  31. As with other Neo data objects, the object also holds metadata such as the sampling rate/frame duration
  32. and the spatial scale (physical size represented by one pixel).
  33. Three new IO modules, :class:`TiffIO`, :class:`AsciiImageIO` and :class:`BlkIO`, allow
  34. reading such data from file, e.g.::
  35. from quantities import Hz, mm, dimensionless
  36. from neo.io import TiffIO
  37. data = TiffIO(data_path).read(units=dimensionless, sampling_rate=25 * Hz,
  38. spatial_scale=0.05 * mm)
  39. images = data[0].segments[0].imagesequences[0]
  40. :class:`ImageSequence` is a subclass of the NumPy :class:`ndarray`, and
  41. so can be manipulated in the same ways, e.g.::
  42. images /= images.max()
  43. background = np.mean(images, axis=0)
  44. preprocessed_images = images - background
  45. Since a common operation with image sequences is to extract time series from regions of interest,
  46. Neo also provides various region-of-interest classes which perform this operation,
  47. returning an :class:`AnalogSignal` object::
  48. roi = CircularRegionOfInterest(x=50, y=50, radius=10)
  49. signal = preprocessed_images.signal_from_region(roi)[0]
  50. Other new features
  51. ------------------
  52. * new neo.utils module
  53. * Numpy 1.16+ compatibility
  54. * :meth:`time_shift()` method for :class:`Epoch`/:class:`Event`/:class:`AnalogSignal`
  55. * :meth:`time_slice()` method is now more robust
  56. * dropped support for Python 3.4
  57. See all `pull requests`_ included in this release and the `list of closed issues`_.
  58. Bug fixes and improvements in IO modules
  59. ----------------------------------------
  60. * Blackrock
  61. * Neuroshare
  62. * NixIOFr
  63. * NixIO (array annotation + 1d coordinates)
  64. * AsciiSignal (fix + json metadata + IrregularlySampledSignals + write proxy)
  65. * Spike2 (group same sampling rate)
  66. * Brainvision
  67. * NeuralynxIO
  68. .. Warning:: Some IOs (based on rawio) when loading can choose to split each
  69. channel into its own 1-channel :class:`AnalogSignal` or to group them
  70. in a multi-channel :class:`AnalogSignal`.
  71. The default behavior (either ``signal_group_mode='split-all'``
  72. or ``'group-same-units'``) is not the same for all IOs for backwards
  73. compatibility reasons. In the next release, all IOs will have the default
  74. ``signal_group_mode='group-same-units'``
  75. Acknowledgements
  76. ----------------
  77. Thanks to Achileas Koutsou, Chek Yin Choi, Richard C. Gerkin, Hugo van Kemenade,
  78. Alexander Kleinjohann, Björn Müller, Jeffrey Gill, Christian Kothe,
  79. Mike Sintsov, @rishidhingra, Michael Denker, Julia Sprenger, Corentin Fragnaud,
  80. Andrew Davison and Samuel Garcia for their contributions to this release.
  81. .. _`list of closed issues`: https://github.com/NeuralEnsemble/python-neo/issues?q=is%3Aissue+milestone%3A0.8.0+is%3Aclosed
  82. .. _`pull requests`: https://github.com/NeuralEnsemble/python-neo/pulls?q=is%3Apr+is%3Aclosed+merged%3A%3E2018-11-27+milestone%3A0.8.0