<jupyter_start><jupyter_text>Read and process image<jupyter_code>image = plt.imread('./c0911b81ee5266fa.jpg')
image = np.sum(image, axis=2)
image = image[:np.min(image.shape),:np.min(image.shape)]
image = image.astype('float')
image = image[180:-181,180:-181 ]

image = image - image.mean()
image = image - image.min()
image = image/image.max() 
image.shape<jupyter_output><empty_output><jupyter_text>Show image and its FT power spectrum<jupyter_code>r = np.arange(180).reshape(180,1) 
radial_masks = np.apply_along_axis(radial_mask, 1, r, int(image.shape[0]/2), int(image.shape[0]/2), \
                                 np.arange(0, image.shape[0]), np.arange(0, image.shape[0]), 1 )
radial_masks.shape
ft_2d = np.fft.fft2(image)
ft_2d = np.fft.fftshift(ft_2d)
ft_2d = np.abs(ft_2d)

ft_2d[radial_masks[170]] = 0
ft_2d[radial_masks[85]] = 0
ft_2d[radial_masks[42]] = 0
fig = plt.figure(figsize=(2*1.75, 1.7))

#subplot 1
ax1 = plt.Axes(fig, [0.03, 0.02, 0.38, 0.95]) 
fig.add_axes(ax1)
ax1.imshow(image, cmap='gray')

plt.xticks([])
plt.yticks([])
ax1.set_title('A', size=8)

#subplot 2
ax2 = plt.Axes(fig, [0.44, 0.0, 0.415, 0.99]) 
fig.add_axes(ax2)
im = ax2.imshow(np.log2(ft_2d), cmap='twilight_shifted')

plt.xticks([])
plt.yticks([])
ax2.set_title('B')

divider = make_axes_locatable(ax2)
cax = divider.new_horizontal(size="5%", pad=0.05)
fig = ax2.get_figure()
fig.add_axes(cax)
cbar = plt.colorbar(im ,cax=cax)
cbar.set_label(r'$Log_2$ magnitude', rotation=270,labelpad=10)

fig.savefig('figure_1.png', dpi=300)<jupyter_output>/Users/rzepiela/anaconda/envs/py37_tf2/lib/python3.7/site-packages/ipykernel_launcher.py:15: RuntimeWarning: divide by zero encountered in log2
  from ipykernel import kernelapp as app
{'fraction_non_alphanumeric': 0.17965116279069768, 'fraction_numerical': 0.07325581395348837, 'mean_word_length': 5.304029304029304, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '375627', 'license': 'MIT', 'n_tokens_mistral': 833, 'n_tokens_neox': 771, 'n_words': 116, 'path': 'notebooks/figure_1/figure_1.ipynb', 'repo_name': 'frcCVPR/frc-loss', 'size': '1720'}