Aligning multiple waves to the same timescale

I have data that is on an exact one-second timescale. Then I have another set of data that's a bit messier... 

1. its not on exact one-second timescale (ie. 1:00:01.34589, 1:00:02.47638, 1:00:03.69284, etc) 

2. the time is no continuous- there is missing time when the instrument was down. (ie: skips from 01:00:04.0936 to 05:00:00.1836) 

My goal is to get the 2nd, "messy" data spread out on a continuous timescale (with -9999 replacing where there's no data) that counts up by exactly one second so that I can run a correlation of the first and second datasets as a function of time. 

 

So far, I have (1) identified the missing times and added in the correct number of missing points and (2) tried using "round", "floor" and "ceil" to get the timescale into exact seconds. The problem is that this sometimes results in double-counting of seconds based off which rounding mechanism I use (ie: 1:00:01.5673 and 1:00:02.1346 both round to 1:00:02). I have put the code as it stands below (sorry it's a bit messy). 

Code for the process described above

i think you want > rather than >> in your code.

Have you considered using interpolate to clean up your data?

Look under Analysis - Interpolate... for the interpolate dialog. If you have a wave containing the 'clean' times, interpolate can fill in corresponding values from the messy readings.

In reply to by hrodstein

hrodstein wrote:

In 2012 (how time flies:) Tony posted a worked out snippet which does not use /I=3 here: https://www.wavemetrics.com/code-snippet/interpolate-path-equal-steps

I think that code snippet from 2012 aims to do something slightly different. It was a workaround for producing an interpolated path where the distances between successive points in the x-y plane are equal. Here I think the desire is for interpolation where x-coordinates are taken from a 'cleaned-up' wave, so Interpolate2 with the /I=3 flag is appropriate.

If you're using the Interpolate dialog you should choose 'from Dest Wave' in the 'Dest X Coordinates' dropdown menu, or, as Howard wrote, use the /I=3 flag in the coded version.