In fit_peaks(), the moving average values to test list (ma_perc_list) starts at 5 %. Signals with high DC values related to the AC component (e.g. some PPG signals) add a high value to test so that the starting 5% leads to moving average values higher than any of the peaks of the signal.
Please, consider add fine grained values to the ma_perc_list: 0, 1, 2, 3, 4 %. Otherwise it does not work.