Skip to content

Open Ephys file format - #433

Closed
Palaeocortex wants to merge 3 commits into
NeuralEnsemble:masterfrom
Palaeocortex:master
Closed

Palaeocortex wants to merge 3 commits into
NeuralEnsemble:masterfrom
Palaeocortex:master

Conversation

@Palaeocortex

Copy link
Copy Markdown

Added support for Open Ephys file format
OpenEphys.py from https://github.com/open-ephys/analysis-tools.git, with minor changes
openephysio.py
Tested with Python 3.5.2 and 2.7

@samuelgarcia

Copy link
Copy Markdown
Contributor

Thank you very much for this PR.
I also wanted to add openephys in neo.

Neo is io is moving slowly toward rawio for some format that need chunk acces and speed.

Format integrated in neo.rawio have automatically neo.io.

tridesclous and ephyviewer are already based on this rawio low level API.

I think having openephys in rawio will be important for spike sorting on long datasets.

I will have a look on thsi io but after would you mind if I try to port this Io to rawio ?

@Palaeocortex

Copy link
Copy Markdown
Author

No problem, port it to whatever you find more appropriate. Happy to contribute.

@apdavison apdavison mentioned this pull request Jan 10, 2018
@apdavison

Copy link
Copy Markdown
Member

Pending a rawio-compatible implementation, I think we should merge this.

@Palaeocortex could you provide us with a test file?

@samuelgarcia samuelgarcia added this to the 0.7.0 milestone Jan 23, 2018
@pep8speaks

Copy link
Copy Markdown

Hello @Palaeocortex! Thanks for updating the PR.

Line 30:1: E302 expected 2 blank lines, found 1
Line 31:1: W293 blank line contains whitespace
Line 40:100: E501 line too long (107 > 99 characters)
Line 41:1: W293 blank line contains whitespace
Line 44:1: E302 expected 2 blank lines, found 1
Line 44:26: E231 missing whitespace after ','
Line 48:13: E201 whitespace after '{'
Line 50:44: W291 trailing whitespace
Line 52:62: E231 missing whitespace after ','
Line 54:42: W291 trailing whitespace
Line 58:1: W293 blank line contains whitespace
Line 61:41: E231 missing whitespace after ','
Line 64:72: E231 missing whitespace after ','
Line 65:64: E231 missing whitespace after ','
Line 66:1: W293 blank line contains whitespace
Line 69:1: E302 expected 2 blank lines, found 1
Line 69:63: W291 trailing whitespace
Line 70:5: E128 continuation line under-indented for visual indent
Line 71:5: E125 continuation line with same indent as next logical line
Line 71:5: E128 continuation line under-indented for visual indent
Line 73:1: W293 blank line contains whitespace
Line 75:1: W293 blank line contains whitespace
Line 90:70: W291 trailing whitespace
Line 91:71: W291 trailing whitespace
Line 94:1: W293 blank line contains whitespace
Line 115:13: E128 continuation line under-indented for visual indent
Line 116:13: E128 continuation line under-indented for visual indent
Line 118:1: W293 blank line contains whitespace
Line 121:1: W293 blank line contains whitespace
Line 130:56: W291 trailing whitespace
Line 131:5: E125 continuation line with same indent as next logical line
Line 131:5: E128 continuation line under-indented for visual indent
Line 133:1: W293 blank line contains whitespace
Line 145:69: W291 trailing whitespace
Line 177:66: W291 trailing whitespace
Line 178:63: W291 trailing whitespace
Line 191:1: W293 blank line contains whitespace
Line 199:1: W293 blank line contains whitespace
Line 205:1: W293 blank line contains whitespace
Line 208:1: W293 blank line contains whitespace
Line 212:1: W293 blank line contains whitespace
Line 218:5: E125 continuation line with same indent as next logical line
Line 220:1: W293 blank line contains whitespace
Line 224:1: W293 blank line contains whitespace
Line 227:58: W291 trailing whitespace
Line 229:67: W291 trailing whitespace
Line 230:21: E128 continuation line under-indented for visual indent
Line 231:1: W293 blank line contains whitespace
Line 235:1: W293 blank line contains whitespace
Line 241:1: W293 blank line contains whitespace
Line 243:31: W291 trailing whitespace
Line 245:1: W293 blank line contains whitespace
Line 253:21: E128 continuation line under-indented for visual indent
Line 254:1: W293 blank line contains whitespace
Line 256:41: W291 trailing whitespace
Line 271:1: W293 blank line contains whitespace
Line 272:1: E302 expected 2 blank lines, found 1
Line 273:1: W293 blank line contains whitespace
Line 274:13: E201 whitespace after '{'
Line 275:1: W293 blank line contains whitespace
Line 277:1: W293 blank line contains whitespace
Line 278:22: E231 missing whitespace after ','
Line 280:1: W293 blank line contains whitespace
Line 283:1: W293 blank line contains whitespace
Line 284:28: W291 trailing whitespace
Line 286:20: E261 at least two spaces before inline comment
Line 287:1: W293 blank line contains whitespace
Line 295:1: W293 blank line contains whitespace
Line 297:1: W293 blank line contains whitespace
Line 299:1: W293 blank line contains whitespace
Line 300:51: E231 missing whitespace after ','
Line 300:54: E261 at least two spaces before inline comment
Line 300:55: E262 inline comment should start with '# '
Line 306:64: E231 missing whitespace after ','
Line 307:53: E231 missing whitespace after ','
Line 308:49: E231 missing whitespace after ','
Line 311:52: E231 missing whitespace after ','
Line 312:1: W293 blank line contains whitespace
Line 316:26: E231 missing whitespace after ','
Line 317:28: E231 missing whitespace after ','
Line 318:1: W293 blank line contains whitespace
Line 319:66: W291 trailing whitespace
Line 320:1: W293 blank line contains whitespace
Line 322:32: E231 missing whitespace after ','
Line 322:34: E231 missing whitespace after ','
Line 322:86: E231 missing whitespace after ','
Line 323:1: W293 blank line contains whitespace
Line 325:1: W293 blank line contains whitespace
Line 326:42: E231 missing whitespace after ','
Line 326:44: E231 missing whitespace after ','
Line 329:38: E231 missing whitespace after ','
Line 330:42: E231 missing whitespace after ','
Line 335:1: W293 blank line contains whitespace
Line 336:1: E302 expected 2 blank lines, found 1
Line 338:13: E201 whitespace after '{'
Line 339:1: W293 blank line contains whitespace
Line 341:1: W293 blank line contains whitespace
Line 342:22: E231 missing whitespace after ','
Line 344:1: W293 blank line contains whitespace
Line 347:1: W293 blank line contains whitespace
Line 348:28: W291 trailing whitespace
Line 349:1: W293 blank line contains whitespace
Line 361:1: W293 blank line contains whitespace
Line 363:1: W293 blank line contains whitespace
Line 371:1: W293 blank line contains whitespace
Line 379:1: W293 blank line contains whitespace
Line 431:1: W293 blank line contains whitespace
Line 432:1: E302 expected 2 blank lines, found 1
Line 432:21: E231 missing whitespace after ','
Line 433:46: E231 missing whitespace after ','
Line 435:1: W293 blank line contains whitespace
Line 436:1: E302 expected 2 blank lines, found 1
Line 437:1: W293 blank line contains whitespace
Line 439:20: E502 the backslash is redundant between brackets
Line 440:32: E502 the backslash is redundant between brackets
Line 441:38: E203 whitespace before ':'
Line 441:59: E502 the backslash is redundant between brackets
Line 442:40: E203 whitespace before ':'
Line 442:64: E502 the backslash is redundant between brackets
Line 443:38: E203 whitespace before ':'
Line 443:63: E502 the backslash is redundant between brackets
Line 444:32: E502 the backslash is redundant between brackets
Line 445:25: E127 continuation line over-indented for visual indent
Line 445:31: E203 whitespace before ':'
Line 445:35: E502 the backslash is redundant between brackets
Line 446:39: E203 whitespace before ':'
Line 446:62: E502 the backslash is redundant between brackets
Line 447:32: E502 the backslash is redundant between brackets
Line 448:36: E203 whitespace before ':'
Line 448:41: E502 the backslash is redundant between brackets
Line 449:63: E502 the backslash is redundant between brackets
Line 450:31: E502 the backslash is redundant between brackets
Line 451:22: E124 closing bracket does not match visual indentation
Line 451:25: E502 the backslash is redundant between brackets
Line 452:32: E502 the backslash is redundant between brackets
Line 453:29: E251 unexpected spaces around keyword / parameter equals
Line 453:31: E251 unexpected spaces around keyword / parameter equals
Line 453:45: E251 unexpected spaces around keyword / parameter equals
Line 453:47: E251 unexpected spaces around keyword / parameter equals
Line 453:60: E502 the backslash is redundant between brackets
Line 454:19: W291 trailing whitespace
Line 456:1: E302 expected 2 blank lines, found 1
Line 457:5: E128 continuation line under-indented for visual indent
Line 458:5: E125 continuation line with same indent as next logical line
Line 458:5: E128 continuation line under-indented for visual indent
Line 460:1: W293 blank line contains whitespace
Line 465:1: W293 blank line contains whitespace
Line 470:1: W293 blank line contains whitespace
Line 475:71: W291 trailing whitespace
Line 494:1: W293 blank line contains whitespace
Line 500:1: W293 blank line contains whitespace
Line 507:1: W293 blank line contains whitespace
Line 510:13: E128 continuation line under-indented for visual indent
Line 511:13: E128 continuation line under-indented for visual indent
Line 519:17: W291 trailing whitespace
Line 529:1: W293 blank line contains whitespace
Line 533:1: W293 blank line contains whitespace
Line 536:29: E231 missing whitespace after ','
Line 536:47: E231 missing whitespace after ','
Line 537:1: W293 blank line contains whitespace
Line 542:1: E302 expected 2 blank lines, found 1
Line 544:1: W293 blank line contains whitespace
Line 549:1: W293 blank line contains whitespace
Line 556:1: W293 blank line contains whitespace
Line 560:1: W293 blank line contains whitespace
Line 563:1: E302 expected 2 blank lines, found 1
Line 568:100: E501 line too long (112 > 99 characters)
Line 582:1: W293 blank line contains whitespace
Line 590:21: E128 continuation line under-indented for visual indent
Line 598:1: W293 blank line contains whitespace
Line 602:1: W293 blank line contains whitespace
Line 608:1: E302 expected 2 blank lines, found 1
Line 613:1: W293 blank line contains whitespace
Line 616:1: W293 blank line contains whitespace
Line 624:1: W293 blank line contains whitespace
Line 627:1: E302 expected 2 blank lines, found 1
Line 629:1: W293 blank line contains whitespace
Line 636:1: W293 blank line contains whitespace
Line 642:9: E116 unexpected indentation (comment)
Line 650:13: E128 continuation line under-indented for visual indent
Line 653:13: E128 continuation line under-indented for visual indent
Line 660:1: W293 blank line contains whitespace
Line 665:68: W291 trailing whitespace
Line 666:1: W293 blank line contains whitespace
Line 669:1: W293 blank line contains whitespace
Line 672:67: W291 trailing whitespace
Line 675:1: W293 blank line contains whitespace
Line 679:9: E128 continuation line under-indented for visual indent
Line 681:1: W293 blank line contains whitespace
Line 685:1: W293 blank line contains whitespace
Line 696:1: W293 blank line contains whitespace
Line 701:1: W293 blank line contains whitespace
Line 708:100: E501 line too long (108 > 99 characters)
Line 715:9: E303 too many blank lines (2)
Line 719:1: W293 blank line contains whitespace

Line 86:1: E265 block comment should start with '# '
Line 87:1: E265 block comment should start with '# '
Line 88:1: E265 block comment should start with '# '
Line 93:5: E265 block comment should start with '# '
Line 94:5: E265 block comment should start with '# '
Line 95:5: E265 block comment should start with '# '
Line 99:5: E265 block comment should start with '# '
Line 100:5: E265 block comment should start with '# '
Line 104:1: E303 too many blank lines (3)
Line 115:1: E265 block comment should start with '# '
Line 154:11: E265 block comment should start with '# '

Line 30:62: E261 at least two spaces before inline comment
Line 30:63: E262 inline comment should start with '# '
Line 33:10: E401 multiple imports on one line
Line 39:1: E302 expected 2 blank lines, found 1
Line 44:23: E261 at least two spaces before inline comment
Line 45:24: E261 at least two spaces before inline comment
Line 48:22: E221 multiple spaces before operator
Line 48:27: E201 whitespace after '['
Line 48:42: E203 whitespace before ','
Line 48:57: E202 whitespace before ']'
Line 54:21: E221 multiple spaces before operator
Line 54:28: E201 whitespace after '['
Line 54:43: E203 whitespace before ','
Line 54:58: E202 whitespace before ']'
Line 56:22: E221 multiple spaces before operator
Line 56:28: E201 whitespace after '['
Line 58:15: E221 multiple spaces before operator
Line 59:19: E221 multiple spaces before operator
Line 62:5: E303 too many blank lines (2)
Line 79:17: E221 multiple spaces before operator
Line 80:9: E221 multiple spaces before operator
Line 81:15: E221 multiple spaces before operator
Line 81:28: E201 whitespace after '['
Line 81:34: E202 whitespace before ']'
Line 84:22: E203 whitespace before ','
Line 84:33: E203 whitespace before ':'
Line 93:5: E303 too many blank lines (2)
Line 98:23: E225 missing whitespace around operator
Line 98:87: E251 unexpected spaces around keyword / parameter equals
Line 98:100: E501 line too long (102 > 99 characters)
Line 102:30: E225 missing whitespace around operator
Line 111:22: E127 continuation line over-indented for visual indent
Line 112:26: E251 unexpected spaces around keyword / parameter equals
Line 112:28: E251 unexpected spaces around keyword / parameter equals
Line 113:29: E251 unexpected spaces around keyword / parameter equals
Line 113:31: E251 unexpected spaces around keyword / parameter equals
Line 114:21: E127 continuation line over-indented for visual indent
Line 114:38: E251 unexpected spaces around keyword / parameter equals
Line 114:40: E251 unexpected spaces around keyword / parameter equals
Line 115:21: E124 closing bracket does not match visual indentation
Line 139:100: E501 line too long (102 > 99 characters)
Line 158:23: E711 comparison to None should be 'if cond is not None:'
Line 165:23: E201 whitespace after '('
Line 165:28: E251 unexpected spaces around keyword / parameter equals
Line 165:30: E251 unexpected spaces around keyword / parameter equals
Line 167:38: E251 unexpected spaces around keyword / parameter equals
Line 167:100: E501 line too long (104 > 99 characters)
Line 168:100: E501 line too long (102 > 99 characters)
Line 170:27: E251 unexpected spaces around keyword / parameter equals
Line 170:29: E251 unexpected spaces around keyword / parameter equals
Line 171:24: E127 continuation line over-indented for visual indent
Line 172:24: E127 continuation line over-indented for visual indent
Line 172:38: E251 unexpected spaces around keyword / parameter equals
Line 172:100: E501 line too long (104 > 99 characters)
Line 173:24: E127 continuation line over-indented for visual indent
Line 173:100: E501 line too long (102 > 99 characters)
Line 174:24: E127 continuation line over-indented for visual indent
Line 202:100: E501 line too long (148 > 99 characters)
Line 203:38: E225 missing whitespace around operator
Line 203:100: E501 line too long (109 > 99 characters)
Line 204:38: E225 missing whitespace around operator
Line 204:72: E211 whitespace before '['
Line 204:100: E501 line too long (111 > 99 characters)
Line 211:37: E261 at least two spaces before inline comment
Line 218:38: E221 multiple spaces before operator
Line 218:38: E251 unexpected spaces around keyword / parameter equals
Line 218:50: E251 unexpected spaces around keyword / parameter equals
Line 218:63: E231 missing whitespace after ','
Line 219:37: E221 multiple spaces before operator
Line 219:37: E251 unexpected spaces around keyword / parameter equals
Line 219:50: E251 unexpected spaces around keyword / parameter equals
Line 220:45: E221 multiple spaces before operator
Line 220:45: E251 unexpected spaces around keyword / parameter equals
Line 220:50: E251 unexpected spaces around keyword / parameter equals
Line 221:36: E221 multiple spaces before operator
Line 221:36: E251 unexpected spaces around keyword / parameter equals
Line 221:50: E251 unexpected spaces around keyword / parameter equals
Line 222:45: E221 multiple spaces before operator
Line 222:45: E251 unexpected spaces around keyword / parameter equals
Line 222:50: E251 unexpected spaces around keyword / parameter equals
Line 223:43: E221 multiple spaces before operator
Line 223:43: E251 unexpected spaces around keyword / parameter equals
Line 223:50: E251 unexpected spaces around keyword / parameter equals
Line 224:43: E221 multiple spaces before operator
Line 224:43: E251 unexpected spaces around keyword / parameter equals
Line 224:50: E251 unexpected spaces around keyword / parameter equals
Line 225:58: E128 continuation line under-indented for visual indent
Line 226:35: E201 whitespace after '['
Line 226:39: E202 whitespace before ']'
Line 230:1: W391 blank line at end of file

@Palaeocortex

Copy link
Copy Markdown
Author

I've just uploaded a test data file (2017-05-19_20-25-32 DAT wt 271 testfile.tar.gz
) to my python-neo branch.

@samuelgarcia

Copy link
Copy Markdown
Contributor

@Palaeocortex:
files must not be upload directly in the neo git.

They should be uploaded here at gin gnode

See doc.

Best.

@samuelgarcia

Copy link
Copy Markdown
Contributor

Hi @Palaeocortex
I am back on this.
I plan to rewrite this directly at neo.rawio level
So user of tridesclous could also use this IO.

I will do a lot od copy/paste from your code.

I will open a separate PR.
Could you send me the file for testing ?

When the new implementaion will be done could you help me by rewriwing it ?

best

Samuel

@samuelgarcia

Copy link
Copy Markdown
Contributor

I got your file.
It was in your branch.

@samuelgarcia

Copy link
Copy Markdown
Contributor

hi @Palaeocortex
I have started look at the dataset you provide in your PR.
I have read the the format doc
And I have some questions:

  • Where does the xml files come from ?
    Are they part of open ephys ?
  • Why does some files have the following naming 100_CH1 and some other 100_CH1_2 ?
    Does the _2 have a meaning of a new Segment ?
    If so it is not present in your code.

Thank you for helping.

best

@Palaeocortex

Copy link
Copy Markdown
Author

Hi Samuel! Sorry for uploading data in the wrong place, I forgot to correct.

The xml files are part of OpenEphys and carry information about GUI settings and channel info.

The _2 says that the measurement has been interrupted and restarted. 100_CH1 is the first measuring session, then recording stopped and started again. The second session is called 100_CH1_2, the third 100_CH1_3 and so on. My code checks the timestamps and puts the snips together, adding zeros inbetween, for the duration of the brake. The example file shows one such interruption. I can happen if the experimenter wants to interrupt or when occasionaly the OpenEphys GUI breaks and needs to be restarted.

@samuelgarcia

Copy link
Copy Markdown
Contributor

Hi Cristian,
Thank you for clarification.
I did not get that from code nor it is explain in format documentation.
I will change this behavior to be more neo compatible with creating several neo.Segment
This will avoid to create to much zeros in between "session" (segment)
Best,

@samuelgarcia

Copy link
Copy Markdown
Contributor

@Palaeocortex
If you have time please have a look to #580
For the moment the multi segment is not taken in account but it won't be difficult.

@Palaeocortex

Copy link
Copy Markdown
Author

I'll check the code in #580. Maybe both behaviors should be implemented? In my case, it was desirable to have a single segment because data belongs to a single experiment with important timing. With several neo Segments I'd have to stick them together manually and add zeros. With software crashes you lack any other choice.

@samuelgarcia

Copy link
Copy Markdown
Contributor

Yep. But guleing with zeros could be done outside this IO.
It is generic for all IO with multi segment support.

It is more tools that could be( or not) in neo but I don't think to add this option specifically to this IO

The new way of neo is : load from disk only the necessary chunks to save memory bandwith.
So the fragmentation is kept as close as possible from the datset.

@samuelgarcia

Copy link
Copy Markdown
Contributor

@Palaeocortex
Hi.
I implementing teh multi segment stuff in openephys io.
I experience some problem with the datset you provide.

For a given segment all channel files do not have the lenght.
How is possible ?
And worst than than the filesize is a not multiple of 1024 as it should be.
How is it possible. There is no garanty of atomic buffer writing at acquisition in OE ?

@samuelgarcia

Copy link
Copy Markdown
Contributor

superseded by #580

@Palaeocortex

Copy link
Copy Markdown
Author

Hi! Yes, the file length is not consistent and this occurs often, especially when the OpenEphys GUI freezes. I'm still loading the data because just one data point is missing (if I remember correctly), that means an interval of 1/sampling rate. It is not the official behavior of the OpenEphys GUI though, at least from what I understand from the documentation. I made the consistency checks in my code a bit more flexible to deal with this minor events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants