# Generated by pandoc-plot 1.9.1
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(2019)
from skued import diffread, autocenter
from pathlib import Path
im1 = diffread(Path("images") / "autocenter" / "graphite.tif")
mask1 = diffread(Path("images") / "autocenter" / "graphite_mask.tif")
im2 = diffread(Path("images") / "mnxc" / "Cr_1.tif")
mask2 = np.ones_like(im2, dtype=bool)
mask2[0:1250, 950:1250] = False
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6,3))
for im, mask, ax in zip([im1, im2], [mask1, mask2], [ax1, ax2]):
r, c = autocenter(im=im, mask=mask)
ax.imshow(im, vmin=0, vmax=200, cmap='inferno')
ax.scatter(c, r, color='r')
ax.axhline(y=r, linestyle='dashed', linewidth=1, color='w')
ax.axvline(x=c, linestyle='dashed', linewidth=1, color='w')
ax.axis('off')
plt.tight_layout()