<jupyter_start><jupyter_text>Convolving a signal<jupyter_code>#input signal with noise
x=np.linspace(0,2*np.pi,100, dtype=np.float32)
y=np.sin(x)+0.05*np.random.randn(100)
plt.plot(x,y)
plt.title('Input signal with noise')
plt.axis([0,2*np.pi,-1.5,1.5])
plt.grid()
plt.show()<jupyter_output><empty_output><jupyter_text>Moving average filter<jupyter_code>filter_average=np.ones(20)
plt.axis([0,100,0.9,1.2])
plt.plot(filter_average, '*')
plt.title('Moving average filter')
plt.show()
smoothened_signal = signal.convolve(y, filter_average, mode='same')/sum(filter_average)
plt.plot(smoothened_signal)
plt.title('Smoothened signal with noise removal')
plt.show()
plt.plot(smoothened_signal, label='Filtered signal')
plt.plot(y, label='Input signal')
plt.legend()
plt.show()<jupyter_output><empty_output><jupyter_text>Convolving an Image<jupyter_code>img=cv2.imread('myself.jpg',0)
plt.imshow(img, cmap='gray')
plt.axis('off')
plt.show()
blurred_image = ndimage.gaussian_filter(img, sigma=8)
plt.imshow(blurred_face, cmap='gray')
plt.axis('off')
plt.show()
face = scipy.misc.face(gray=True)
plt.imshow(face, cmap='gray')
plt.axis('off')
plt.show()
blurred_face = ndimage.gaussian_filter(face, sigma=5)
plt.imshow(blurred_face, cmap='gray')
plt.axis('off')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18188854489164086, 'fraction_numerical': 0.025541795665634675, 'mean_word_length': 9.344, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '304324', 'license': 'MIT', 'n_tokens_mistral': 587, 'n_tokens_neox': 536, 'n_words': 70, 'path': 'Convolution- Basics.ipynb', 'repo_name': 'deepeshgrover/Deep-Learning-', 'size': '1292'}