Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Neuropixels] Add time shift to processed behavior data timestamp columns #32

Merged
merged 5 commits into from
Dec 5, 2024

Conversation

weiglszonja
Copy link
Collaborator

To align with Bpod, this PR implements the shifting of timestamp columns in the processed behavior data.
The columns that need to be shifted:

  • "Cled"
  • "Lled"
  • "Rled"
  • "l_opt"
  • "r_opt"

See #31

This PR also includes the changes how we are storing "Lled", "Rled","l_opt" and "r_opt" columns.
Before we added the 4 timestamp for each trial in the same column, just as:
Screenshot 2024-12-02 at 18 36 15 (2)

The 4 timestamp for each trial is from:

e.g. Lled = [left reward side light on, left reward side light off, left reward side light flash on, left reward side light flash off]

l_opt = [left side light turns on, left side light turns off, right port turns off, side light turns off]

During the delay between the center light turning off and the reward arriving, the side light turns on. The side light turns off when the reward is available, then stays off until the animal collects the reward. When the animal nose pokes to collect the reward, the light flashes on/off.
Alternatively, if the animal opts out, there is a flash on the opt out port on/off. Then the reward port turns off.

I think it is better not to store them as arrays in the trials table but break them into separate columns, e.g.

rewarded_port_onset_time -> corresponds to the first timestamp of "Lled" if the rewarded side for that trials was the left port
rewarded_port_offset_time -> corresponds to the second timestamp of "Lled" if the rewarded side for that trials was the left port
rewarded_port_flash_onset_time -> corresponds to the third timestamp of "Lled" if the rewarded side for that trials was the left port
rewarded_port_flash_offset_time -> corresponds to the fourth timestamp of "Lled" if the rewarded side for that trials was the left port

We populate rewarded_port_onset_time, rewarded_port_offset_time, rewarded_port_flash_onset_time, rewarded_port_flash_offset_time etc. for each trial depending on which side was the rewarded side.

@weiglszonja
Copy link
Collaborator Author

Example file

Screenshot of the trials table:
Screenshot 2024-12-02 at 18 45 09 (2)

@weiglszonja weiglszonja self-assigned this Dec 2, 2024
Copy link
Contributor

@alessandratrapani alessandratrapani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor comment, the rest looks good

@weiglszonja weiglszonja merged commit 2cacfe4 into main Dec 5, 2024
@weiglszonja weiglszonja deleted the Neuropixels/fix-timeshift-processed-trials branch December 5, 2024 08:52
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.

2 participants