I want to carry out some experiments on some time-series data with the [KM](https://scikit-learn.org/stable/auto_examples/cluster/plot_cluster_iris.html#sphx-glr-auto-examples-cluster-plot-cluster-iris-py) approach has been suggested in this [paper](https://www.mdpi.com/1996-1073/8/11/12337). The problem is I don't access the data in the paper but I have similar type data which has no outliers and I need to generate some outliers artificially/manually in form of the impulse (top & bottom) so that meet the requirements as it is shown in the following picture from this paper achievement:

![img](https://i.imgur.com/edo1BPw.png)

In the worst case, I was wondering if I could generate something like this on the periodic perfect train of pulse or Sin function to apply to the available data.
So far, my implementation is limited to these [post1](https://stackoverflow.com/a/61131627/10452700), [post2](https://stackoverflow.com/a/55352417/10452700) and [Welch](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.welch.html#scipy.signal.welch) but in order to generate right outliers, I was thinking of identifying/detecting high and low states and then add outliers frequently for further experiments of outlier detectors.

I'm unsure that convolving impulses as noise to target outliers is the right way to contaminate periodic data I access or not.

So far I have generated a train of impulses but I have no idea how I can include to one periodic signal or data:

```py
import scipy.signal as signal
import matplotlib.pyplot as plt
imp = signal.unit_impulse(200, [10,50,60])

fig, ax = plt.subplots(1,1, figsize=(8,6))

ax.set_xlabel('Cycles')
plt.plot(imp)
plt.title('Generating impulse outliers in desired cycles: 10, 50 & 60')
plt.ylim((0.0, 1.4))
plt.show()

```

![img](https://i.imgur.com/lkjPc2P.png)

Any helps will be appreciated since many people are working on topics like Anomaly and outlier detection.