Depth data timeseries - How to process?
jensen
as the subject title suggests, I am currently working on timeseries of an animal tracking project. The data includes one depth reading every 30 seconds over a complete period of 2 month.
I am looking for some kind of mask or filter that marks parts within the timeseries, in which the depth values stay within a certain range for an extended period of time. For instance, the filter should only consider depth values between 20meters and 40 meters that occured for 5 minutes (10 data points) continiously.
In the end, I want to anaylse the abundance or percentage of such filtered events across the whole timeseries of 2 month.
I'd be grateful for any idea or help.
PS: I have used the "Ethographer" plugin for a similiar task previously. However, the "Ethographer mask analysis" seems to miss that duration component I am looking for, or maybe I just did not find that function yet.
Thanks in advance,
Jens
(1) use logical conditions to amplitude-mask your data, so that 'Amp_mask' is unity only when your data is between your 20 and 40 meter ranges, and 0 elsewhere.
(2) make a temporal filter wave (using your same data x-scaling) that is a unit-height square pulse 10 points wide.
(3) duplicate 'Amp_mask' into a destination wave 'wDest' , and convolve the the temporal filter wave with 'wDest', e.g.
Convolve wfilter, wDest
(4) 'wDest' should have an amplitude of 10 when the data conditions satisfy your requirement, and for as long as your 'extended period of time occurs'. It should decrease when there are less than 10 successive data points.
You should be able to refine any small details I may have over-looked.
June 29, 2017 at 10:19 am - Permalink
Next use the following function to count and locate the places where the duration (number of consecutive points in the depth range) is greater or equal to a given width (measured as the number of points of depthWave)
Wave inWave
Variable width
Variable rows=DimSize(inWave,0)
Make/FREE/N=(2*rows) w1=0
w1[0,rows-1]=inWave[p] // double width to support rotation
Duplicate/FREE w1,w2
Variable i
width-=1
for(i=0;i<width;i+=1)
rotate 1,w2
MatrixOP/O/FREE w1=w1*w2
endfor
Duplicate/FREE/O w1,w2
rotate 1,w2
MatrixOP/O locWave=greater(w1,w2)
Print "Found ",sum(locWave),"instance(s) of width >=",(width+1)
End
I hope this helps,
A.G.
WaveMetrics, Inc.
June 29, 2017 at 11:28 am - Permalink
June 29, 2017 at 11:36 am - Permalink
first of all thank you very much for your fast and helpful replies. I tested A.G's solution as it seemed very straight forward to me. However I am real beginner when it comes to IGOR programming, because I used IGOR only for data visualization so far. So please don't mind me asking very basic questions now:
(1) I executed the first command line and created a 1,0 matrix for values that apply to my chosen range (depth1 = 20, depht2 =40) with the depth wave called "D"
Just like this:
MatrixOP/O pWave=greater(D,20)*greater(40,D)
(2) I created a new procedure with A.G's function setting "width-=10". This determines the number of consecutive points to be considered for the duration filter, right?
(3) After compiling the procedure I do not get a direct output, so I would like to know which options do I have for visualization? Guess there is an easy way to get an output wave or matrix? Or could this be directly incorporated into a depth timeseries graph?
Once again looking forward to your replies,
Jens
July 1, 2017 at 06:54 am - Permalink
I think you would benefit from using the Data Browser. After executing the code you should browse through the relevant waves and display all those that interest you. In particular you should look at pWave which will contain all the instances where the depth was within the specified range. You can then display locWave for all the instances there the depth was within the specified range for the specified duration.
A.G.
July 5, 2017 at 12:21 pm - Permalink