Coder Social home page Coder Social logo

neuralensemble / python-neo Goto Github PK

View Code? Open in Web Editor NEW
312.0 312.0 244.0 110.72 MB

Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats

Home Page: http://neo.readthedocs.io/en/latest/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

python-neo's People

Contributors

achilleas-k avatar alejoe91 avatar amchagas avatar apdavison avatar cboulay avatar dguarino avatar grg2rsr avatar h-mayorquin avatar hfragnaud avatar hkchekc avatar hugovk avatar jpgill86 avatar juliasprenger avatar kleinjohann avatar legouee avatar lepmik avatar mdenker avatar mgr0dzicki avatar msenoville avatar muellerbjoern avatar nxniki avatar rjurkus avatar rproepp avatar samuelgarcia avatar sbuergers avatar shashwatsridhar avatar teogale avatar thperret avatar toddrjen avatar zm711 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-neo's Issues

Some io tests errors should be more informative

When running io tests without the pytbales module installed, I received the following non-informative error:

{{{

ERROR: test_assert_readed_neo_object_is_compliant (io.test_hdf5io.HDF5Commontests)

Traceback (most recent call last):
File "/home/jaillet.f/sync_work/code/neo_svn/neo/trunk/neo/test/io/test_hdf5io.py", line 120, in setUp
BaseTestIO.setUp(self)
File "/home/jaillet.f/sync_work/code/neo_svn/neo/trunk/neo/test/io/common_io_test.py", line 63, in setUp
self.local_test_dir = self.create_local_dir_if_not_exists()
File "/home/jaillet.f/sync_work/code/neo_svn/neo/trunk/neo/test/io/common_io_test.py", line 76, in create_local_dir_if_not_exists
shortname = self.ioclass.name.lower().strip('io')
AttributeError: 'NoneType' object has no attribute 'name'
}}}

After installation of the pytables modules, which is required by hdf5io, I received a different error for this test, meaning that the error above is due to the missing pytables module.

It would be much butter if common_io_test.py could throw an informative error, saying that the package is missing, or at least that hdf5io.py could not be loaded.

I didn't have a look at the code to see how it could be done yet.


Imported from Trac ticket:48

Opened: 2012-02-01 10:14:34
Last modified: 2012-02-02 16:01:00
Component: tests
Priority: minor
Owner:
Reporter: jaillet

Some IOs cannot handle multi-segment blocks and fail tests

When I run nosetests on current r373, I get two failures, one in PyNNIO and one in BlackrockIO. There used to be the same error in TDTio but it is now fixed.

In my case in blackrockio, the problem is that the data file format is continuous and does not support segment boundaries. My solution is to concatenate all segments when writing to disk. But that means that the common_io_test fails to reload 3 segments after writing them. Maybe the same is true for PyNNIO? I am not familiar with that format.

I propose some alternatives:

  1. Skip that common io test, since the data file format cannot support it
  2. I could rewrite the IO to write one file per Segment, but I do not think this is a solution I would like to use, because it would be too many small files.
  3. We could agree on a common standard for writing the time boundaries of each Segment. This would not be an official change to Neo schema, but rather a use of annotations to add on this extra info. If we write this information to the Block.annotations, we can reconstruct Segments.

I prefer change #3. I think we previously agreed that we should discuss Neo extensions as a group, so that we do not implement the same idea in multiple different ways.


Imported from Trac ticket:34

Opened: 2011-10-04 22:51:08
Last modified: 2011-10-28 15:14:40
Component: io
Priority: major
Owner: somebody
Reporter: crodger

Slice `AnalogSignal`, `AnalogSignalArray` and `SpikeTrain` by time

In addition to slicing data by index as at present, we should support slicing by time, e.g. if s is an AnalogSignal and the sampling period is 10 ms, then

s[4:10]

would be equivalent to

s[40*ms:100*ms]

This would be a particularly nice feature for SpikeTrain. I'm not sure this can be implemented in Python 2, since numpy array has a __getslice__ method, so that s[i:j] requires i and j to be integers, but it should work in Python 3 (where __getslice__ has been removed).


Imported from Trac ticket:27

Opened: 2011-09-23 13:58:20
Last modified: 2011-09-24 00:07:41
Component: core
Priority: major
Owner: somebody
Reporter: apdavison

reference to relationship is bidirectional. Bloc.segments <-> Segment.block.

reference to relationship is bidirectional. Bloc.segments <-> Segment.block. A method in neo.tool will help IOs to do this (neo.io.tools.create_many_to_one_relationship)


Imported from Trac ticket:12

Opened: 2011-09-12 16:52:26
Last modified: 2012-02-01 15:05:36
Component: core
Priority: major
Owner: somebody
Reporter: sgarcia

version check error with a scipy from SVN

during installation of neo from the 0.2 version, an error is raised when checking version.

{{{

~/libs/neuralensemble/neo0.2 $ python setup.py install
Traceback (most recent call last):
File "setup.py", line 21, in
from neo import version as neov
File "/Users/lup/libs/neuralensemble/neo0.2/neo/init.py", line 2, in
from .io import *
File "/Users/lup/libs/neuralensemble/neo0.2/neo/io/init.py", line 136, in
from .neomatlabio import NeoMatlabIO
File "/Users/lup/libs/neuralensemble/neo0.2/neo/io/neomatlabio.py", line 35, in
if version.StrictVersion(scipy.version.version) < '0.8':
File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/version.py", line 40, in init
self.parse(vstring)
File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/version.py", line 107, in parse
raise ValueError, "invalid version number '%s'" % vstring
ValueError: invalid version number '0.11.0.dev-0496569'
}}}


Imported from Trac ticket:35

Opened: 2011-10-06 17:27:56
Last modified: 2011-10-28 11:04:40
Component: core
Priority: minor
Owner: somebody
Reporter: LaurentPerrinet

copy = False by default for AnalogSIgnal, SpikeTrain and AnalogSIgnalArray

copy = False by default for AnalogSIgnal, SpikeTrain and AnalogSIgnalArray.

This is the default for nnumpy.ndarray but not for Quantity.
I prefer numpy default behavior.


Imported from Trac ticket:17

Opened: 2011-09-13 12:21:55
Last modified: 2011-09-16 18:19:01
Component: core
Priority: minor
Owner: somebody
Reporter: sgarcia

Default values for core class constructors

At present, some of the core Neo classes have a default value for the first argument, e.g.:
{{{

st = SpikeTrain()
}}}
produces an empty SpikeTrain, while others do not have a default value
{{{
sig = AnalogSignal()
TypeError: new() takes at least 2 arguments (1 given)
}}}

This should be consistent. Either we remove the default value from SpikeTrain, etc., or add one to AnalogSignal. Please give your opinion below.


Imported from Trac ticket:3

Opened: 2011-09-01 15:32:34
Last modified: 2011-09-14 02:48:21
Component: core
Priority: major
Owner: somebody
Reporter: apdavison

Relationship change between RecordingChannelGroup and RecordingChannel and Unit

Chris added a new point of view. This need to be discussed very soon. It will not change any IOs :
The many_to_many relation ship have been introduced for spike sorting case of N-Trodes. It is logical and it works.
But but but:
For dense array people do spike sorting with overlapping RecordingChannel.
RCG1=RC1+RC2
RCG2=RC2+RC3
Then define RCG1 have Unit A and RCG2 have Unit B and Unit C.
In that case our data model fails because RC2 is in two group!!
Proposal (< is one_to_many rel and <> is many to many rel):
Last:
RecordingChannelGroup < RecordingChannel
RecordingChannel <> Unit
New:
RecordingChannelGroup <> RecordingChannel
RecordingChannelGroup < Unit
This is more brilliant and very easier for spikesorting. (thank you Chris).


Imported from Trac ticket:16

Opened: 2011-09-12 16:56:14
Last modified: 2011-10-03 17:28:56
Component: core
Priority: major
Owner: somebody
Reporter: sgarcia

Add neuralynxIO


Imported from Trac ticket:42

Opened: 2011-11-02 17:47:25
Last modified: 2011-11-02 17:47:25
Component: io
Priority: major
Owner: somebody
Reporter: sgarcia

Error with AnalogSignal

It seems that when I create a new AnalogSignal and set-up sampling rate in Hz but leave t_start dimensionless the class breaks down. Please see trace for details:

/home/sobolev/apps/neo_gnode/neo/core/analogsignal.pyc in t_stop(self)
97 @Property
98 def t_stop(self):
---> 99 return self.t_start + self.duration
100
101 @Property

/usr/local/lib/python2.6/dist-packages/quantities-0.9.0-py2.6.egg/quantities/quantity.pyc in g(self, other, *args)
59 other = other.view(type=Quantity)
60 if other._dimensionality != self._dimensionality:
---> 61 other = other.rescale(self.units)
62 return f(self, other, *args)
63 return g

/usr/local/lib/python2.6/dist-packages/quantities-0.9.0-py2.6.egg/quantities/quantity.pyc in rescale(self, units)
193 raise ValueError(
194 'Unable to convert between units of "%s" and "%s"'
--> 195 %(from_u._dimensionality, to_u._dimensionality)
196 )
197 return Quantity(cf*self.magnitude, to_u)

ValueError: Unable to convert between units of "dimensionless" and "1/Hz"


Imported from Trac ticket:2

Opened: 2011-03-22 13:21:40
Last modified: 2011-11-02 17:51:01
Component: core
Priority: major
Owner: sgarcia
Reporter: andrey

Complete AlphaOmegaIO

It is a proof of concept for the moment.


Imported from Trac ticket:40

Opened: 2011-11-02 17:46:11
Last modified: 2012-02-02 16:01:10
Component: io
Priority: major
Owner: somebody
Reporter: sgarcia

AxonIO read_block: segments are read twice

In AxonIO segments are read in two runs. First run creates a list and second uses this list to create the actual segments. I changed the code slightly to do it in just one run; see patch. I did some testing with ABF files and it seems to work fine.


Imported from Trac ticket:23

Opened: 2011-09-19 22:09:11
Last modified: 2011-11-02 17:50:24
Component: io
Priority: major
Owner: somebody
Reporter: jnowacki

Remove __getattr__ from BaseNeo

Currently BaseNeo.__getattr__(key) is written to return self._annotations[key] if it exists and otherwise return self.key. From the code you would assume that self._annotations[key] takes precedence over self.key. However, since __getattr__ is not even called unless self.key does not exist, this doesn't actually do what the code looks like it does. (self.key still takes precedence over self._annotations[key].)

It's easy enough to fix, but I think we should just remove __getattr__ entirely. At best it saves the user a little typing. At worst it is a recipe for bugs because it is hard to follow the logic. Now that recommended attributes have been moved out of _annotations anyway, there is less reason for this shortcut to exist.

I temporarily removed __getattr__ and ran the test suite. (I did not commit the change.) The only tests that failed are:[[BR]]

neo.test.io.test_pynnio.TestPyNNTextIO_Spikes[[BR]]

neo.test.io.test_pynnio.TestPyNNTextIO_Signals[[BR]]

If the change is accepted by you all, I can edit those tests myself to remove the dependency on__getattr__.


Imported from Trac ticket:19

Opened: 2011-09-15 01:29:30
Last modified: 2011-09-22 19:58:06
Component: core
Priority: minor
Owner: crodger
Reporter: crodger

Add ElphyIO

ElphyIO was in neo1 but not in neo2 because Thierry left the lab. We hsould ad this again neo3


Imported from Trac ticket:41

Opened: 2011-11-02 17:46:59
Last modified: 2011-11-02 17:46:59
Component: io
Priority: major
Owner: somebody
Reporter: sgarcia

Add simple example

Add file in /examples and put them in doc.


Imported from Trac ticket:47

Opened: 2012-02-01 10:14:31
Last modified: 2012-02-01 21:41:49
Component: documentation
Priority: major
Owner: jaillet
Reporter: sgarcia

Tests should create temporary directories for test files

otherwise you can't run installed tests if neo is installed in somewhere that needs root permissions


Imported from Trac ticket:50

Opened: 2012-02-01 17:12:45
Last modified: 2012-02-02 16:01:39
Component: tests
Priority: minor
Owner:
Reporter: apdavison

Typical use cases

Doc

Spike sorting

EEG

Neural simulation


Imported from Trac ticket:44

Opened: 2012-01-04 15:40:52
Last modified: 2012-02-02 16:01:05
Component: documentation
Priority: major
Owner:
Reporter: sgarcia

neo0.2 - can't create "analogsignalarray"

/apps/neo/branches/neo0.2/neo/core/analogsignalarray.pyc in array_finalize(self, obj)
70
71 def array_finalize(self, obj):
---> 72 super(AnalogSignal, self).array_finalize(obj)
73 self.t_start = getattr(obj, 't_start', 0*pq.s)
74 self.sampling_rate = getattr(obj, 'sampling_rate', None)
NameError: global name 'AnalogSignal' is not defined

Thanks

Andrey


Imported from Trac ticket:1

Opened: 2011-03-17 10:06:19
Last modified: 2011-11-02 17:51:18
Component: core
Priority: major
Owner: samuel
Reporter: andrey
CC: sgarcia

remove _ for relationship.

remove _ for relationship. Ex Segment.analosignals instead of Segement._analosignals. More pythonic.


Imported from Trac ticket:9

Opened: 2011-09-12 16:49:16
Last modified: 2011-09-13 11:47:53
Component: core
Priority: major
Owner: somebody
Reporter: sgarcia

Fill-in TODOs in documentation


Imported from Trac ticket:31

Opened: 2011-09-27 13:03:56
Last modified: 2012-02-02 15:23:44
Component: documentation
Priority: critical
Owner:
Reporter: apdavison

_annotations attribute name is confusing

It appears that a new attribute has been introduced in Python 3 to annotate functions. In the following "what's new" [http://docs.python.org/release/3.0.1/whatsnew/3.0.html#new-syntax] we can read:

PEP 3107: Function argument and return value annotations. This provides a standardized way of annotating a function’s parameters and return value. There are no semantics attached to such annotations except that they can be introspected at runtime using the !annotations! attribute. The intent is to encourage experimentation through metaclasses, decorators or frameworks.

I think that the name similarity of this standardized attribute and our _annotations attributes in neo could be a source of confusion.

Should'nt we change the name of the _annotations attribute in neo?


Imported from Trac ticket:7

Opened: 2011-09-05 11:46:03
Last modified: 2011-09-22 12:38:43
Component: core
Priority: minor
Owner: somebody
Reporter: jaillet

Cannot easily plot AnalogSignal

The bug I've found was that I cannot plot easily analogue signals. Namely, if array provided to matplotlib is 1d (ndim = 1), then it tries to change it into a column vector. It does that by using newaxis. Let say that we have vector v, which v.shape = (n,), then to get column vector we do vc = v[:,newaxis], which is, in fact equivalent to vc = v[:,None]. Both numpy and quantities sorts this out well, but not neo's BaseAnalogSignal. It doesn't know how to handle None correctly and throws an exception, namely, that method i.start does not exist. I've attached a patch that solves it for me. I'm not sure it is the most elegant way, but when v[:,None] is called, the i in __getitem__(i) is a tuple, usually i = (slice(None, None, None), None). I went around it and delegate the job back to quantities, which works as I've checked. If you have other ways of dealing with that, please feel free to change it, but it has to be addressed in my opinion. A workaround without modifying the code is to cast BaseAnalogSignal to numpy array and then plot it.


Imported from Trac ticket:20

Opened: 2011-09-15 11:11:09
Last modified: 2011-11-02 17:50:49
Component: core
Priority: major
Owner: somebody
Reporter: jnowacki

All IOs MUST return a block even if it is one segment.

All IOs MUST return a block even if it is one segment. SomeIO.read() give a block now. (before it was the higher container)


Imported from Trac ticket:14

Opened: 2011-09-12 16:53:59
Last modified: 2011-09-13 14:16:24
Component: core
Priority: major
Owner: somebody
Reporter: sgarcia

_check_time_in_range provoque rounding problem when using times with float32

In some IOs, times for SpikeTrain are coded in float32 but t_start and t_stop are float64 so _check_time_in_range can raise error for the last spike for rounding reasons.

What to do ?

  • Force each IO to be float 64
  • Force t_start and t_sop to be same dtype as times
  • accept rounding in _check_time_in_range

Imported from Trac ticket:38

Opened: 2011-10-28 10:52:39
Last modified: 2012-02-01 16:03:52
Component: core
Priority: major
Owner: sgarcia
Reporter: sgarcia

Version requirements in Developer's Guide are very strict

Do we really need bleeding-edge versions of the dependencies listed in the Developer's Guide? I am using Ubuntu 10.04 (current LTS version) and I installed everything with Synaptic or pip install. I often have older versions of the dependencies than what is listed.

Preferably, I think we should require >= the version in Ubuntu LTS Synaptic. This will make installation for new users much much easier (trust me!!). Many users will be newcomers to linux and they will be easily discouraged by complicated installation requirements.

If we need a newer version, we should put the reason and a one-line terminal command for installation in the Developer's Guide. Post it here and I'll change it in the svn for you!

Here are the versions that are different. I put the version on my system first, and then the version that is listed as minimally acceptable in the Developer's Guide next.
nose 0.11.1 0.11.4
distribute (setuptools) 0.6 0.6.14
sphinx 0.6.4 1.0
coverage 2.85.20080914 3.3.1

Everything seems (?) to be working on my system, so if there is no reason stated to use the newer version, I'll change the requirement to the older version.


Imported from Trac ticket:18

Opened: 2011-09-15 00:51:39
Last modified: 2011-09-22 20:25:03
Component: documentation
Priority: minor
Owner: crodger
Reporter: crodger

hdf5 backend doesn't save empty SpikeTrains

hdf5 backend doesn't save empty !SpikeTrains


Imported from Trac ticket:49

Opened: 2012-02-01 14:16:12
Last modified: 2012-02-02 15:19:41
Component: io
Priority: major
Owner: samuel
Reporter: antolikjan

Put documentation on readthedocs.org

We should perhaps consider putting our docs on readthedocs.org


Imported from Trac ticket:46

Opened: 2012-02-01 10:06:18
Last modified: 2012-02-01 10:06:18
Component: documentation
Priority: minor
Owner:
Reporter: apdavison

remove _ for relationship.

remove _ for relationship.

Ex Segment.analosignals instead of Segement._analosignals. More pythonic.


Imported from Trac ticket:8

Opened: 2011-09-12 16:48:27
Last modified: 2011-09-12 17:02:02
Component: core
Priority: major
Owner: somebody
Reporter: sgarcia

Restrictions on data types allowed in "annotations"

Where possible, when converting from one data file format to another, we should try to preserve as many of the annotations as possible, preferably all of them.

This would be much easier if only certain data types were allowed in annotations (e.g. int, float, string, datetime, lists/arrays containing only simple types, maybe dicts containing only simple types).


Imported from Trac ticket:5

Opened: 2011-09-01 16:22:28
Last modified: 2012-02-01 12:03:41
Component: core
Priority: major
Owner: somebody
Reporter: apdavison

Specifying units prevents returning a view with `copy=False`

I believe that at the moment it is not possible to create a view of a Quantity array if you also specify the units. This problem seems to be related to a limitation in Quantity. Therefore it extends to all of our objects that inherit from Quantity.

Note that in this example I specify copy=False, which should give me a view, but instead I get a copy. This is because I specified units, even though in this case there is no change of units.

{{{
In [41]: data = [3,4,5] * pq.s

In [42]: data2 = pq.Quantity(data, units=data.units, copy=False)

In [43]: data2[0] = 99

In [44]: data2
Out[44]: array([ 99., 4., 5.]) * s

In [45]: data
Out[45]: array([ 3., 4., 5.]) * s

}}}

This problem also occurs whenever quantity.rescale is called because this method returns a copy.

If it is important for Neo to be able to use views instead of copies, we should try to come up with a workaround. We can be clever about our call signature to Quantity.__new__ and overcome the limitation in some cases. But if the user wishes to rescale the units, I do not think it will be possible to return a view.

I committed some tests of SpikeTrain today which will fail until we decide how to handle this.


Imported from Trac ticket:22

Opened: 2011-09-17 01:11:23
Last modified: 2012-02-02 09:59:49
Component: core
Priority: major
Owner: crodger
Reporter: crodger

Need to require scipy.io version in neomatlabio

I have scipy 0.7.0 and neomatlabio fails. The Matlab interface changed a lot from scipy 0.7 to scipy 0.8. The specific error is that oned_as is not a valid argument to savemat, but even if I remove this argument, I get a huge number of errors in the test.

I think we should require scipy version >= 0.8.0 in neomatlabio. But I can't figure out how to do this. I tried adding this code.

{{{
import inspect
if not 'oned_as' in inspect.getargspec(sio.matlab.savemat).args:
raise ImportError("your scipy version is too old to support MatlabIO")
}}}

But now I get this error ::

{{{

ERROR: Failure: ImportError (cannot import name NeoMatlabIO)

Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/nose/loader.py", line 379, in loadTestsFromName
addr.filename, addr.module)
File "/usr/lib/pymodules/python2.6/nose/importer.py", line 39, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/lib/pymodules/python2.6/nose/importer.py", line 86, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/chris/neo2_dev/neo0.2/neo/test/io/test_neomatlabio.py", line 13, in
from neo.io import NeoMatlabIO
ImportError: cannot import name NeoMatlabIO

}}}

The weird thing is that I don't have this Nose problem with hdf5io, even though that module also fails with an ImportError because I don't have pytables installed.

Summary: please suggest the best way to require scipy version in neomatlabio.


Imported from Trac ticket:25

Opened: 2011-09-22 20:30:45
Last modified: 2011-09-26 17:05:45
Component: io
Priority: minor
Owner: somebody
Reporter: crodger

Remove default value for sampling rate in `AnalogSignal` and `AnalogSignalArray`

To properly define an AnalogSignal requires all of (data, units, sampling rate). There are no sensible default values for any of these, and so they should all be required on construction.

For units, there are two possible ways to supply the value: (1) if data is a Quantity array, (2) using the units argument.

Similarly, sampling rate can be supplied either as sampling_rate or sampling_period.

This is why units and sampling_rate must be keyword arguments (with default None), not positional arguments.

However, we need to check that units and sampling_rate do end up getting provided somehow, and raise an Exception if they do not. Mainly this means removing the default value of 1*Hz from _get_sampling_rate and adding a check that units has a value (we should not use None for dimensionless, rather using pq.dimensionless.


Imported from Trac ticket:28

Opened: 2011-09-23 15:08:51
Last modified: 2011-09-28 15:03:09
Component: core
Priority: major
Owner: somebody
Reporter: apdavison

Read chunk in Segment

Some IOs like BlackrockIO propose to read a file in chunk of data.

Instead of having one Block with one big segment it propose to have one block with many small segment.

I think we should add a feature in IO API to get only chunk of data for long analogSignal.

It is related to streaming a big instead of reading it entirely.


Imported from Trac ticket:39

Opened: 2011-10-28 15:17:13
Last modified: 2011-10-28 15:17:13
Component: io
Priority: major
Owner: somebody
Reporter: sgarcia

List recommended attributes explicitly in constructor signature

Currently, Neo class constructors use **kwargs for both recommended attributes (name, file_origin, etc.) and for optional annotations.

For me, **kwargs should only be used when we do not know in advance what the argument names will be, which is not the case here. Used otherwise, it is a very good way to hide useful information from the user.

I propose that all recommended attributes are listed explicitly in the argument list to each class' __init__ method. These arguments can then be passed onto the BaseNeo constructor, which handles assigning the arguments to attributes.

e.g.
{{{

!python

class SomeClass(BaseNeo):

def __init__(self, req_arg1, req_arg2, name=None, file_origin=None, file_datetime=None, **annotations):
    BaseNeo.__init__(name=name, file_origin=file_origin, file_datetime=file_datetime, **annotations)

class BaseNeo(object):

def __init__(self, name=None, file_origin=None, file_datetime=None, **annotations):
    self.name = name
    self.file_origin = file_origin
    self.file_datetime = file_datetime
    self.annotations = annotations

}}}
This way, the implementation is centralised in BaseNeo, but the interface definition is explicit in every class. I agree this is a little more work (although mostly copy-and-paste), but I think it is worth it for increasing code clarity and making a clear distinction between recommended attributes and user-defined annotations. In any case, if we add, delete or change a common attribute, we already have to change the documentation for every derived class, so why not change the argument list at the same time?


Imported from Trac ticket:32

Opened: 2011-09-27 13:43:46
Last modified: 2011-09-28 14:52:03
Component: core
Priority: major
Owner: somebody
Reporter: apdavison

Add MultiChannelSystemIO


Imported from Trac ticket:43

Opened: 2011-11-02 17:47:55
Last modified: 2011-11-02 17:47:55
Component: io
Priority: major
Owner: somebody
Reporter: sgarcia

hdf5 IO does not seem to properly save (or read data)

A simple script that saves analogsignal data using the hdf5io IOManager does not seem to work. No segments seem to be retrieved. Also even though it is not possible for me
to test due to the above error, inspecting the hdf5io implementation suggests that the annotations are not being saved.

Also the code examples in the help of the hdf5io.py should be updated to not use underscores in some of the neo core variables such as segment or analogsignal anymore.


Imported from Trac ticket:33

Opened: 2011-09-27 23:35:38
Last modified: 2012-02-01 13:46:36
Component: core
Priority: major
Owner: andrey
Reporter: antolikjan

AxonIO: extending header for protocol reading

Just some header description extension for protocol reading. I think I still cannot access SVN, therefore, can someone just commit this patch. I've tested it and it should not cause any damage.


Imported from Trac ticket:26

Opened: 2011-09-23 00:33:34
Last modified: 2011-11-02 17:50:11
Component: core
Priority: major
Owner: somebody
Reporter: jnowacki

Implement an IO plugin system

It is inefficient to have to edit neo.io.__init__ whenever you create a new IO. Instead, we should have a plugin system, where IOs register themselves with a central IO registry.


Imported from Trac ticket:24

Opened: 2011-09-22 10:59:17
Last modified: 2011-09-22 10:59:17
Component: io
Priority: minor
Owner: somebody
Reporter: apdavison

HDF5 error "createHardLink"

On my ubuntu 11.10
Hdf5IO raise this error.

Is is due to a version of pytables and createHardLink ?

Traceback (most recent call last):
File "/home/sgarcia/Documents/projet/neo/branches/neo0.2/neo/test/io/test_hdf5io.py", line 120, in setUp
BaseTestIO.setUp(self)
File "/home/sgarcia/Documents/projet/neo/branches/neo0.2/neo/test/io/common_io_test.py", line 66, in setUp
self.generate_files_for_io_able_to_write()
File "/home/sgarcia/Documents/projet/neo/branches/neo0.2/neo/test/io/common_io_test.py", line 141, in generate_files_for_io_able_to_write
writer.write_block(ob)
File "/home/sgarcia/Documents/projet/neo/branches/neo0.2/neo/io/hdf5io.py", line 267, in _write_entity
self.save(obj, where, cascade, lazy)
File "/home/sgarcia/Documents/projet/neo/branches/neo0.2/neo/io/hdf5io.py", line 432, in save
self.save(child, where=ch._v_pathname)
File "/home/sgarcia/Documents/projet/neo/branches/neo0.2/neo/io/hdf5io.py", line 432, in save
self.save(child, where=ch._v_pathname)
File "/home/sgarcia/Documents/projet/neo/branches/neo0.2/neo/io/hdf5io.py", line 431, in save
self._data.createHardLink(ch._v_pathname, new_name, target)
AttributeError: 'File' object has no attribute 'createHardLink'


Imported from Trac ticket:45

Opened: 2012-01-04 15:59:32
Last modified: 2012-02-02 15:24:13
Component: io
Priority: major
Owner: andrey
Reporter: sgarcia

Specifics extensions

For IOs adding free attributes via _annotations dict : in neo documentation there will be chapter for specifics extensions to avoid that 2 IO add the same attr with 2 different names.


Imported from Trac ticket:15

Opened: 2011-09-12 16:54:57
Last modified: 2011-10-28 12:05:21
Component: documentation
Priority: major
Owner:
Reporter: sgarcia

Cannot do numpy.diff on AnalogSignal

There is an issue with AnalogSignal slicing. Namely, running numpy.diff on an analog signal gives the below error. The fast solution is to cast to numpy.array, which then works. Nontheless, the issue with slice should be solved. I'll try to look into it later but if someone have a instant solution please feel free to fix it.

{{{
/home/enxjn/work/hippocampus/from_andy/CA3 current clamp/plot_exp_neo.py in plot_with_threshold(abf_file, segment)
13 t = np.arange(a.t_start, a.t_stop, a.sampling_period)
14 # To find threshold we're looking for dvdt

---> 15 dv = np.diff(a)/np.diff(t)
16
17 # Creat a plot

/usr/local/epd-7.1-2/lib/python2.7/site-packages/numpy/lib/function_base.pyc in diff(a, n, axis)
975 return diff(a[slice1]-a[slice2], n-1, axis=axis)
976 else:
--> 977 return a[slice1]-a[slice2]
978
979 def interp(x, xp, fp, left=None, right=None):

/home/enxjn/Projects/neo/neo/core/analogsignal.pyc in getitem(self, i)
111 elif isinstance(i, tuple) and len(i) == 2:
112 slice_start = i[0].start
--> 113 if slice_start:
114 obj.t_start = self.t_start + slice_start*self.sampling_period
115 return obj

UnboundLocalError: local variable 'slice_start' referenced before assignment
}}}


Imported from Trac ticket:36

Opened: 2011-10-11 17:52:05
Last modified: 2011-10-12 14:33:18
Component: core
Priority: major
Owner: somebody
Reporter: jnowacki

Add links from Block -> Unit

A common task in data analysis is analyzing spike times contained in a recording session. Often you no longer care about the analog signals from which the spikes were detected, or the exact channels on which the unit was detected.

Therefore, rather than require the user to descend the hierarchy Block -> RCG -> RC -> Unit, I proposed a link Block._units which is a list of Unit contained in the block. As always, Unit can contain many SpikeTrain from different Segment within the Block.

Any comments?


Imported from Trac ticket:6

Opened: 2011-09-02 02:10:52
Last modified: 2011-09-13 12:13:51
Component: core
Priority: major
Owner: crodger
Reporter: crodger

Annotations should be accessible as "annotations"

The annotations dictionary of a Neo object is likely to be of interest to other classes (e.g. IO classes). Therefore, it should be accessible using the name "annotations", not "_annotations" (which implies a private attribute that should only be accessed by the object itself).

Concerning implementation, it is fine to keep "_annotations" for the actual storage - we can add "annotations" as a property.


Imported from Trac ticket:4

Opened: 2011-09-01 16:17:02
Last modified: 2011-09-22 12:48:20
Component: core
Priority: major
Owner: somebody
Reporter: apdavison

Remove `sampling_rate` from `SpikeTrain`

I think we should remove the sampling_rate attribute from SpikeTrain.

As a SpikeTrain is a list of spike times with, in theory, arbitrary precision, sampling_rate is not necessary for the object to function. If anything, it is metadata, and so could be put in annotations, if it is too cumbersome to navigate to the associated AnalogSignal via a Unit. For simulations in particular, there may not even be a fixed sampling period (e.g. with adaptive time step methods).


Imported from Trac ticket:29

Opened: 2011-09-26 09:53:09
Last modified: 2012-02-01 11:10:59
Component: core
Priority: minor
Owner: somebody
Reporter: apdavison

lazy = True size returned as info

A point that was discussed in gif but finalized:
Actually in neo.io when lazy=True, an IO return all array or Quantities with size =0

In that case, We suggested to return to user the real size if lazy was False.

Solutions (ob is SpikeTrain or AnalogSIgnal):

  1. with a specific dictionnary : ob.data_description['size'] = XXX
  2. In annotations. sp.annotate(sizeofarray = XXXX)
  3. in an attribute : ob.size_if_not_lazy = XXX

Imported from Trac ticket:30

Opened: 2011-09-26 17:34:11
Last modified: 2011-11-02 17:43:14
Component: io
Priority: minor
Owner: somebody
Reporter: sgarcia

SpikeTrain args: t_start, t_stop, sort, units

  1. Currently t_start and t_stop are listed as "required" arguments to SpikeTrain, meaning it should fail if they are not provided. The way it is currently implemented is softer: it uses 0.0*pq.s as the default for t_start, and the max spike time as the default for t_stop. This seems reasonable to me. Should we change description to list them as recommended, or change SpikeTrain to fail if they are not provided?

  2. Can we use a default of 'seconds' for units if the user passes a bare numpy array without units?

  3. Also, currently sort is an extra argument (default True) that will sort the spike times and waveforms. I think it makes more sense to remove this, and add a sort() method that the user can call if he wants. It is more similar to numpy.array that way. At the least I think we should change the default to False, because most users probably have already sorted their spike times if that is what they want.


Imported from Trac ticket:21

Opened: 2011-09-16 07:47:11
Last modified: 2011-09-28 15:01:08
Component: core
Priority: major
Owner: crodger
Reporter: crodger

Neo pickling

Currently it is not possible to pickle Neo AnalogSignal and SpikeTrain objects,
due to the way they are inherited from quantities object and consequently how the new is written. The attached patch rectifies this via reduce method. Also I have attached a simple script demonstrating how pickling Neo AnalogSignal crashes, while it works once the patch is applied.


Imported from Trac ticket:37

Opened: 2011-10-26 14:52:08
Last modified: 2012-02-01 16:30:41
Component: core
Priority: minor
Owner: somebody
Reporter: antolikjan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.