It is not entirely clear, but it seems that you just need to remove each bad value both from the "signals" AND "locations" array, to keep the pairs correctly matched up. The fitting itself does not change.
After the fitting, the display needs to be adapted and there are a few possibilities, e.g:
(1) Since the x is now no longer equally spaced, you just need to display the result as an x-y graph, with the "locations" as x, and the "signals" and "best fit" as y.
(2) Alternatively, If you want to keep a waveform graph, recreate the original arrays by replacing all missing values with NaN. Then make a copy and map the best fit results into it. Now display both on the same graph.
Let me know if this is not clear enough. Good luck!