Fix spike waveform transpose issue in Python3#36
Fix spike waveform transpose issue in Python3#36jonnew wants to merge 3 commits intoopen-ephys:masterfrom
Conversation
- Implements the same fix given in OpenEphys.py in main directory, which I guess is for Pytho2.7
|
As a side note, why are their different versions of these libraries being maintained for Python 2.7 and 3.5 when there are standard mechanisms in place to detect the interpreter being used? |
- Make use of numpy structured arrays to get rid while loop - Single call to np.fromfile - On my machine with a nice SSD, for a 40 MB .spike file, the load time went from 15.1 sec to about 7 milliseconds. - This could probably be applied to other data types (continuous and events) but I'm not interested in doing it right now. - I'm only editing one version of the OpenEphys.py file...
- Make use of numpy structured arrays to get rid while loop - Single call to np.fromfile - On my machine with a nice SSD, for a 40 MB .spike file, the load time went from 15.1 sec to about 7 milliseconds. - This could probably be applied to other data types (continuous and events) but I'm not interested in doing it right now. - I'm only editing one version of the OpenEphys.py file... - In keeping with just adding new functions to preserve backwards compatibility (instead of versioning...) I named the routine loadSpikeFast
|
I created a |
|
This looks very clean and fairly bug proof, unless someone else would like to test this on some other example files i'd say we can just merge this? |
|
OK, cool. One thing to note is that the return type is different than data = loadSpikesFaster(filename)
print(data['data']['waveform'])vs. data = loadSpikes(filename)
print(data['spikes'])to get equivalent data access. This is why I created the new function instead of just modifying existing. Ways to do this without breaking code would be best, but ideas I've had are not elegant. Of course this is also a result of returning the header with the data. Perhaps the best way around this would be to have two functions, one that returns the header only, for generic file types, and one that returns only the data. Most generic would be to have two functions |
I guess is for Python2.7