Skip to content

Instantly share code, notes, and snippets.

@CJ-Wright
Created August 29, 2016 14:11
Show Gist options
  • Save CJ-Wright/ca3acbb20f780c45c290b29aa5c681fd to your computer and use it in GitHub Desktop.
Save CJ-Wright/ca3acbb20f780c45c290b29aa5c681fd to your computer and use it in GitHub Desktop.
from pyFAI.geometry import Geometry
from skbeam.core.utils import radius_to_twotheta
from skbeam.core.utils import twotheta_to_q
from numpy.testing import assert_array_almost_equal
import matplotlib.pyplot as plt
geo = Geometry(
detector='Perkin', pixel1=.0002, pixel2=.0002,
dist=.23,
poni1=.209, poni2=.207,
# poni1=0, poni2=0,
# rot1=.0128,
# rot2=-.015,
# rot3=-5.2e-8,
wavelength=1.43e-11
)
r = geo.rArray((2048, 2048))
tth = radius_to_twotheta(.23, r)
q = twotheta_to_q(tth, .143)
pfq = geo.qArray((2048, 2048))/10
fig, axs = plt.subplots(1, 2, sharex=True, sharey=True)
axs[0].imshow(r)
axs[0].set_title('r')
axs[1].imshow(pfq)
axs[1].set_title('q')
plt.show()
print(q)
print()
print(pfq)
assert_array_almost_equal(q, pfq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment