title: How to correlate two time series with gaps and different time bases?
body: <p>I have two time series of 3D accelerometer data that have different time bases (clocks started at different times, with some very slight creep during the sampling time), as well as containing many gaps of different size (due to delays associated with writing to separate flash devices).</p>
  
  <p>The accelerometers I'm using are the inexpensive <a href="http://www.gcdataconcepts.com/x250-2.html" rel="noreferrer">GCDC X250-2</a>.  I'm running the accelerometers at their highest gain, so the data has a significant noise floor.</p>
  
  <p>The time series each have about 2 million data points (over an hour at 512 samples/sec), and contain about 500 events of interest, where a typical event spans 100-150 samples (200-300 ms each).  Many of these events are affected by data outages during flash writes.</p>
  
  <p>So, the data isn't pristine, and isn't even very pretty.  But my eyeball inspection shows it clearly contains the information I'm interested in.  (I can post plots, if needed.)</p>
  
  <p>The accelerometers are in similar environments but are only moderately coupled, meaning that I can tell by eye which events match from each accelerometer, but I have been unsuccessful so far doing so in software.  Due to physical limitations, the devices are also mounted in different orientations, where the axes don't match, but they are as close to orthogonal as I could make them.  So, for example, for 3-axis accelerometers A &amp; B, +Ax maps to -By (up-down), +Az maps to -Bx (left-right), and +Ay maps to -Bz (front-back).</p>
  
  <p>My initial goal is to correlate shock events on the vertical axis, though I would eventually like to a) automatically discover the axis mapping, b) correlate activity on the mapped aces, and c) extract behavior differences between the two accelerometers (such as twisting or flexing).</p>
  
  <p>The nature of the times series data makes Python's numpy.correlate() unusable.  I've also looked at R's Zoo package, but have made no headway with it.  I've looked to different fields of signal analysis for help, but I've made no progress.</p>
  
  <p>Anyone have any clues for what I can do, or approaches I should research?</p>
  
  <p>Update 28 Feb 2011: Added some plots <a href="https://picasaweb.google.com/FlyMyPG/VibData?authkey=Gv1sRgCLPo0u-7jafQjwE#" rel="noreferrer"><strong>here</strong></a> showing examples of the data.</p>