I'm looking for a method to determine the most likely offset of a measured 1-dimensional signal to a reference signal. The reference signal does not need to be generalized and always has a similar shape, where only the base width may vary, but the steepness of the arms do not:
Cross correlation seems a likely candidate to find this reference signal within a sample (in blue), and generally produces a reasonable result, but often emphasizes on one of both peaks:
I've played with normalizing the signal/reference between 0..1 and -1..+1 but found that this will help on some samples, but break on others.
For my usage, I'm rather looking at 'centering' the reference around or within the bucket (depending on width of the reference). .
Is there a suitable way of achieving this using cross correlation, or are there alternative methods available that'll work for my use case?