User Tools

Site Tools


ephys_pipeline:6_synchronization

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ephys_pipeline:6_synchronization [2022/01/12 13:10] – [Internal RCO deriving state onsets and trial information] lukas.schneiderephys_pipeline:6_synchronization [2022/03/17 14:10] (current) – removed lukas.schneider
Line 1: Line 1:
-======= Synchronization ======= 
-This section describes how synchronization is achieved. 
-  * TDT data is stored as a continuous data (starting from start of recording)  
-  * behavioral data is stored per trial (starting from first trial) 
-Synchronization is enabled by sending state and trial information from monkeypsych to TDT ([[ephys_pipeline:6_synchronization#Synchronization during recording|Online communication]]). 
-Both state and trial information is sent through the same 8 pins, a little trick allows using the same channel for both purposes ([[ephys_pipeline:6_synchronization#Resulting 8 pin state signal|State signal]] ). 
-For combining both, we first convert TDT data to trial format (function TDT_trial_struct.m) preferentially using epocs store (Tnum and SVal) information.  
-There is a flag in TDT_trial_struct for using the continous state information stream (stream_state_info), but it is permanently turned off, as the epoc information is already extracted from the continuous state information within the TDT circuit (see [[ephys_pipeline:6_synchronization#Internal RCO deriving state onsets and trial information|RCO]] ) 
-Finally, when fitting TDT data into a trial structure, certain timing conventions have proved useful: [[ephys_pipeline:6_synchronization#Snippet and Stream synchronization in the combined trial structure 
-|Trial structure timing]] 
-====== Synchronization during recording ====== 
-{{:ephys_pipeline:monkeypsych_dev_to_tdt_snychronization.png|}} 
  
-Note that pins are only switched either to send trial information or after a state change (AND after the flip happened!) 
-The idea is that both trial information and state information can be sent via the same channel. 
-Details are described below. 
-====== Resulting 8 pin state signal ====== 
- 
-{{:ephys_pipeline:digital_communication_monkeypsych_to_tdt.png |}} 
- 
-Values of 252 to 255 are preserved for indicating start of trial/state information and in-between trial information stoppers: 
-  * 252: indicates start of trial information 
-  * 254: in between trial information to define trialinfo packages 
-  * 253: end of trial information 
-  * 255: start of state information 
- 
-Note that due to preserved values, a trial information package maximum value is limited. For example, to encode the date first package would be first 2 digits of the year, second package the last 2 digits of the year, third package the month and fourth package the day. That way none of the packages reaches a value of over 100. 
-Trial information is sent during INI (state 1), during the other states the stat value reflects the current state. 
- 
-====== TDT Internal RCO ====== 
-{{:ephys_pipeline:tdt_stored_data.png |}} 
- 
-====== Snippet and Stream synchronization in the combined trial structure ====== 
-{{:ephys_pipeline:tdt_mp_timing.png |}} 
- 
-\\ Importantly, trial start reference is STATE 2 (fixation acquisition). Trial end is STATE 2 of the next trial.  
-\\ Therefore, ITI between trial 1 and 2 as well as STATE 1 (initiation) of trial 2 are found at the end of trial 1.  
-\\ This also means that data recorded before 1st trial's state 2 can not be stored in the trial structure and is saved in a separate variable (First_trial_INI) instead. Everything before first trials INI is discarded. 
ephys_pipeline/6_synchronization.1641993053.txt.gz · Last modified: 2022/12/29 07:15 (external edit)