# How to find an alignment between two overlapping time series?

### Context

I'm working with absorbance spectral data. I have two spectra generated for a single analyte. Each spectrum was collected over two overlapping wavelength regions e.g. 8-10 micron and 9-11 micron. The spectrums both contain a few thousand data points where each point is a real number.

### Question

Is there a method for the partial alignment of two time-series? One that would align a suffix of one spectrum to the prefix of another? Additionally, is there a way this could be paired with something like DTW? Due to the nature of the instrument, there's usually some misalignment of movement between any two spectrums.

Any general suggestions would be appreciated, however I'm currently working in python so any specific libraries would be additionally helpful.

### Edit w/ more context:

There is not a correlating wavelength for each data point. I only have the known range and the data sequence itself. The instrument has a laser which scans over a specified wavelength range. Data collection is passive and begins and stops with the laser within some negligible time difference. However, the sampling frequency can vary slightly throughout the scan which stops a linear interpolation of the correlating wavelengths from being consistent. Consequently, the resulting data then has some degree of variability in its length, usually on the order of 10s or 100s of points. This overall makes it difficult to truncate at a given point since it cannot be guaranteed that the data is being split at the correct start/end of the overlapping region - that is, without some hands on experimentation at least.

• You can only find alignment in the region of wavelength that both data sets cover. So first truncate both data sets to the common region -- in your example 9-10 microns -- and then compute a measure of overlap for that common region. Aug 17, 2022 at 23:40
• Consider using the cross-covariance of the signals as a measure of similarity that can account for a shift in time (actually frequency here) between the two signals. Aug 18, 2022 at 0:06
• @WolfgangBangerth I realize I may have omitted some details in my question that make direct truncation a bit muddy. I'd prefer something that would function automatically on the raw data sequence. (See my edit for added info) Albeit, I hadn't considered this approach and will certainly play around with it. Aug 18, 2022 at 2:07