Skip to content

Conversation

@sbuergers
Copy link
Contributor

In addition to ecephys data the Axona system saves video tracking data in the .bin files containing the raw data.
Each data packet contains a header, footer and 3 samples of ecephys data for each channel. The header includes a
flag, either ADU1 or ADU2, where ADU2 denotes that video tracking data is available in this packet, which is then located
in the header.

To quote from the file format manual:

Each position sample is 20 
bytes long, and consists of a 4-byte frame counter (incremented at around 50 Hz, 
according to the camera sync signal), and then 8 2-byte words. In four-spot mode, the 8 
words are redx, redy, greenx, greeny, bluex, bluey, whitex, whitey. In two-spot mode, they 
are big_spotx, big_spoty, little_spotx, little_spoty, number_of_pixels_in_big_spot, 
number_of_pixels_in_little_spot, total_tracked_pixels, and the 8th word is unused. Each 
word is MSB-first. If a position wasn't tracked (e.g., the light was obscured), then the 
values for x and y will both be 0x3ff (= 1023).

In this PR this video tracking position (pos) data is added to axonarawio.py as a separate stream.

@pep8speaks
Copy link

pep8speaks commented Apr 23, 2021

Hello @sbuergers! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-04-26 12:42:06 UTC

@sbuergers sbuergers mentioned this pull request Apr 23, 2021
@samuelgarcia
Copy link
Contributor

Hi Steffen, tell us when it is ready to review.

@sbuergers
Copy link
Contributor Author

Hi Samuel, I think it's ready for review from my end. I am not sure if I dealt with the sampling frequency of the position data correctly. @JuliaSprenger mentioned that there is a way to incorporate non-stationary sampling frequencies, but I wasn't quite sure how. Currently I am simply assuming a fixed rate of 100Hz (which ideally is true, but empirically, at least in our sample data, is only approximately true, because there is a period during the experiment where it starts fluctuating for a while). One of the .pos data "channels" contains the actual timestamps of when a position was recorded.

Tests pass locally.

Interestingly my local linter (flake8) found a Pep8 issue that pep8speaks missed (>79 char line length).

@sbuergers sbuergers marked this pull request as ready for review April 26, 2021 13:41
@sbuergers sbuergers marked this pull request as draft April 26, 2021 17:57
@sbuergers
Copy link
Contributor Author

Julia pointed me toward how to deal with irregularly sampled signals. So converting to draft for now and trying to make appropriate changes.

@JuliaSprenger
Copy link
Member

Looking at the basefromrawio it does not seem like IrregularySampledSignals are supported on that level yet. @samuelgarcia Do you think it makes sense to find a workaround now to include these for the AxonaIO or do you want to unify AnalogSignals and IrregularlySampledSignals first?

@sbuergers
Copy link
Contributor Author

For the moment we implemented reading the position data in nwb-converion-tools, but once we figure out how to incorporate irregularly sampled signals it shouldn't be too hard to finalize this also for neo!

@JuliaSprenger
Copy link
Member

Including pos data in the AxonaRawIO will be postponed until IrregularlySampledSignals are supported on the RawIO level. Until then I close this PR. Feel free to reopen to continue working on this.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants