import numpy as np
import matplotlib.pyplot as plt

from astropy.convolution import Gaussian1DKernel, convolve

fig, ax = plt.subplots()

# Generate fake data
rng = np.random.default_rng(963)
x = np.arange(1000).astype(float)
y = np.sin(x / 100.) + rng.normal(0., 1., x.shape)
y[::3] = np.nan

# Create kernel
g = Gaussian1DKernel(stddev=50)

# Convolve data
z = convolve(y, g)

# Plot data before and after convolution
ax.plot(x, y, label='Data')
ax.plot(x, z, label='Convolved Data', linewidth=2)
ax.legend(loc='best')
plt.show()