# Selecting Data for mouse measures

Suppose I want to calculate total distance after a certain timestamp (e.g. after 600 ms since the start of the trial). Is there any (easy) way in Mousetrap library for it?

Thank you!

Suppose I want to calculate total distance after a certain timestamp (e.g. after 600 ms since the start of the trial). Is there any (easy) way in Mousetrap library for it?

Thank you!

## Comments

Hi!

that is in principle possible, but the specific implementation depends on the measure you want to use.

The following code gives an example how you can calculate the Euclidean distance traveled from the beginning of the trajectory until timestamp 600 (ms):

Hope this helps. If you have any additional questions, feel free to ask!

Best,

Pascal

Thank you so much! It really does help!

I have one additional question: how do I summarize these measures by subjID (and possibly, by some other factors)?

thank you!

This is how I did it:

You can use the mt_aggregate_per_subject function for this. If you specify a condition variable in use2_variables, the measures will be summarized per participant and condition.

Best,

Pascal

thank you!

I have another question. Should I want to calculate other measures, like acceleration and velocity, will setting trajectories to zero be sufficient? In other words, if i want to calculate say velocity after certain time period, do I only need to change total_dist to vel_max?

Thank you!

You would have to make a few changes:

Instead of the second line, you could also run mt_measures afterwards. It will automatically calculate the total_dist and vel_max based on the modified values, so the resulting values for total_dist an vel_max will be the ones for the first 600 ms.