See Chumbley et al (2010). A small piece (b2) is matched to a much larger piece (b1). The lag gives the index location of the best match of b2 in b1.
get_lag_max_R(b1, b2, window, b1.left)
| b1 | dataframe  | 
    
|---|---|
| b2 | dataframe  | 
    
| window | width of the window (in indices) to consider for matching  | 
    
| b1.left | left index of the matching window  | 
    
list of lag and correlation achieved. The plot shows b2 on b1.