Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

KINARM Data Analysis


Our General Workflow

Analysis Pipeline

create_csv Explained

Creating your own create_csv:


Clean Coding Practices

Writing clean code is an essential skill to have, not only does it help other lab members understand your code, it will help your future self as well. In the spirit of readability and clean coding, here are some important aspects to apply to any analysis or pre-processing code you write!

For more tips and details, check out Diedrichsen’s Writing Clean Code and Google Python Style Guide


Practical Notes


KINARM Data Structure — Quick Reference

This is a quick look-up / cheat sheet of where the most important data can be found within the kinarm data structure. This is the structure that is created within matlab, after exam_load is called. Make sure to also call KINARM_add_hand_kinematics() on the data structure to have all measures available.

Below is what the Workspace and Command Windows look like. Matlab variable names are based on this:

Exam Load Example

To call the specific data that you want, you have to index by trial number into the data structure. This can be done by doing data.c3d(n), where n is the trial number. If you called the output of exam_load something besides data, just replace the word in the data call with the name.

Here are some examples of the most common that you’ll want to export, how to access the field within the data structure, and how to access it within matlab.

Kinematic Data (all samples for the nth trial)

MeasureFieldMatlab variable
X PositionRight_HandXdata.c3d(n).Right_HandX
Y positionRight_HandYdata.c3d(n).Right_HandY
X velocityRight_HandXVeldata.c3d(n).Right_HandXVel
Y velocityRight_HandYVeldata.c3d(n).Right_HandYVel
X accelerationRight_HandXAccdata.c3d(n).Right_HandXAcc
Y accelerationRight_HandYAccdata.c3d(n).Right_HandYAcc

Trial Information

MeasureFieldMatlab variable
TP numberTPdata.c3d(n).TRIAL.TP
Trial numberTRIAL_NUMdata.c3d(n).TRIAL.TRIAL_NUM
Sample rateRATEdata.c3d(n).HAND.RATE
Load rowLoaddata.c3d(n).TP_TABLE.Load

Tables

Tables are a snapshot of the trial protocol as it was on that specific trial. Unless the protocol changes mid-experiment, the table contents will be identical across trials — but you still need to index by both trial number AND TP number to pull the value that was actually used on that trial. Replace <Field> with the field you would like to access:

MeasureMatlab variable
Target Tabledata.c3d(n).TARGET_TABLE.<Field>
Load Tabledata.c3d(n).LOAD_TABLE.<Field>
Task-Wide Parametersdata.c3d(n).TASK_WIDE_PARAMS.`
TP Tabledata.c3d(n).TP_TABLE.<Field>

Events

Always make sure to match the label with the times for each trial. KINARM has built-in event codes that can appear at any order, so don’t just rely on indexing from previous trials to match labels and times

MeasureMatlab variable
Event Labeldata.c3d(n).EVENTS.LABELS
Event Timedata.c3d(n).EVENTS.TIMES