An open source custom Matlab Toolbox for the analysis of data consisting of a sequence of time-stamped events This code was designed and originally created by Adam King in the laboratory of Charles R Gallistel. It has been used by Gallistel and his students for 20 years to analyze behavioral and electrophysiological data. These data take the form of very long sequences of events (e.g. spikes, poke onsets, quarter turns of a running wheel, stimulus onsets, limb movements). These data naturally take the form of a 2-column long table in which 1 column is the time at which the event occurred and the other is a numerical code for the event. Adam King created 6 basic workhorse commands that take most of the tedium out of creating the code that digests such data. He was guided by three basic principles: 1) Keep it all together. 2) Make the sequence of analytic questions being posed easy to follow when reading the code. 3) Modularize the code. The guiding ideal was "One question, one line of code." That is, the analysis would consist of the user asking a question of the data and writing a single line of code that would give an answer to that question. The first principle (keep it all together) was is enforced by the basic design of the system: The raw data (the 2-column long tables, each for a given session and a given subject) are stored in the TSData fields at the third level (the Session level) of a 6-level Matlab structure. The inputs to the TS commands are the names of fields in this structure. The commands find the specified fields, read in their contents, operate on those contents, and store the results of those operations in a field within the same structure--generally, but not obligatorily, a different field from the input fields, and usually a field created by the command that operated on the data. Thus, the raw data and every result derived from that data are stored in the same Matlab structure. The analysis of the data involves the creation of a Matlab script. The intial cells in the script create the structure and read in the raw data. Subsequent cells use the high level commands in the TSsystem Toolbox to perform the analysis. Each cell poses a question and generates an answer to that question using a very few of the Toolbox commands. These commands hide the for loops and while loops that carry the analysis from subject to subject and session to session and trial to trial within session. In unmodularized code, these loops consume page after page of code and obscure the sequence of analytic ideas. The TS system makes the sequence of analytic ideas easily followed as one steps from cell to cell within the script.
crgallistel / tssystem Goto Github PK
View Code? Open in Web Editor NEWAn open source custom Matlab Toolbox for the analysis of data consisting of a sequence of time-stamped events