The ValueError at this line needs to be updated for values which result in the same pixel indices. For example I got the following error for left_index == right_index True:
ValueError: Lower region, 60.41062077854714 Hz, appears to be greater than the upper region, 61.934802777038556 Hz.