APS Excellence in Physics Education Award
November 2019

Science SPORE Prize
November 2011

The Open Source Physics Project is supported by NSF DUE-0442581.

## How to record time spent in a specified zone post and replies

How to record time spent in a specified zone
Mark Teshera
2 Posts

Hello, what I need to measure is how long a snake's head spends inside a certain zone. The zone in this case is a prey trail (a few inches wide), so I want to see how long the snake's head is within the confines of this trail (i.e. how interested is the snake in the prey trail). When the head is outside the specified zone, that time doesn't count. I need to count how many seconds the head is within the prey trail. Can Tracker do this? I've been playing around with it but can't seem to figure it out. Thank you.

### Replies to How to record time spent in a specified zone

Re: How to record time spent in a specified zone -
Paul Nord
26 Posts

A logic statement like that within Tracker sounds tricky.  But it would be easy if you export the coordinates to Excel.

The statement in Excel would look like:
=IF(AND(B2>0,B2<=2,C2>0,C2<=1),1,0)

If the X coordinate is in the B column and the Y coordinate is in the C column, this defines a box where X = (0,2], and Y = (0,1] and puts a 1 in the column wherever the coordinate is in that range.

Simply sum the column to find the number of timesteps where the condition statement is true.

Attached sample excel file.

Paul

Attached File: rangecountinglogic.xlsx

Re: How to record time spent in a specified zone -
Mark Teshera
2 Posts

Ok thank you I will try this