I have the following signal to process ( raw data ):

I would like to process the signal to eliminate outliers in order to get a “smooth” curve. Note. I do not want to change any actual values, I'm only interested in deleting false points. A special requirement is that the curve “wraps around” (ie the beginning of the curve must be adjacent to its end). An image might be more useful (I illustrated the black line manually):

, , . , . , ? - , , . Python/NumPy/SciPy.