Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Cutting trajectories at a particular time point

Hi all

I have some mouse tracking trajectories where participants hear "Click on the X" where X is a word, that changes across a number of trials. As this is naturalistic speech, the length of the carrier phrase 'Click on the' is variable, and I want to remove the portion of the trajectories that before participants hear X.

I have the lengths of the carrier phrases stored in a data file. I can match across mouse tracking data (mt_data$data) and trajectories (mt_data$trajectories) by mt_id, so no problem there. However, I don't know how to cut the trajectories, being unfamiliar with arrays.

How would one go about this? Having performed this analysis, only then would I want to calculate measures etc

Comments

  • Hi there,

    excluding variable parts of a trajectory is not directly implemented in mousetrap and is indeed challeging to implement in the underlying arrays. In this case, having trajectories in a long format might actually be easier.

    I don't know how you collected your data and if the raw data are originally in a long format (which would be the case if you are using mt_import_long to import them, http://pascalkieslich.github.io/mousetrap/reference/mt_import_long.html). If they are not in a long format, one workaround could be to export the trajectories into a long format (using mt_export_long, http://pascalkieslich.github.io/mousetrap/reference/mt_export_long.html, specifying the variable that contains the length information via the use2_variables argument), then filtering the exported trajectories only retaining the recorded positions where the timestamp is larger than the length, then importing the trajectories back into mousetrap using mt_import_long. This is somewhat cumbersome but it probably is still easier than trying to implement the filtering in the arrays.

    Best,

    Pascal

Sign In or Register to comment.