0
$\begingroup$

I have two files with accelerator readings and I want to get some metric/ measurement to get the similarity between these two files. I have tried Pearson’s R coefficient, dtw distance, dtw score. Pearson’s r gives returns a value 1 if the files are identical, the dtw score and path are 0 if the files are identical.

But I need a solution if the files are as the ones in the figures, similar, with a little time lag. They are readings from two different accelerators who were attached to the same source. The sampling frequency and amplitude is not same. Even the number of readings are not same. Time stamps could be different.

How do I measure the similarity between such files? Is there some metric or measurement I can get using Python? Because dtw score and dtw distance do give some output, but there is no way I can say the files are similar using those values.

File 1

File 2

$\endgroup$
0
$\begingroup$

What you could do is

  • downsample both series to match sampling rate between them
  • crop the longest series to match the shorter one

Then, there is a variety of methods to estimate similarity between the two series. Some of those are:

  • cross correlation: this will be affected by the amplitude and will not be able to estimate lagged correlations, prone to noise.
  • coherence: normalised frequency based correlation (cross-spectrum), not prone to amplitude or noise.
  • wavelet coherence: similar to above but based on wavelet transformations instead of STFFT.
  • dynamic time warping: measuring similarity between two temporal sequences, which may vary in speed.
$\endgroup$
3
  • $\begingroup$ Thank you for your response. DTW gives score and output but there is no threshold value that can say that they are highly similar. Are there any libraries you suggest for coherence and wavelet coherence in Python? $\endgroup$ – Chaitra Dec 8 '20 at 15:09
  • $\begingroup$ Unfortunately, not aware of any substantial libraries for DSP in python. Not sure if familiar, but I would suggest going with MATLAB or Octave if you do not have a license for it. $\endgroup$ – hH1sG0n3 Dec 8 '20 at 15:17
  • $\begingroup$ Thanks. But I will have to search for something in Python. $\endgroup$ – Chaitra Dec 8 '20 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.