# Path: pymicro/xray/detectors.py
# class Varian2520(RegArrayDetector2d):
#     '''Class to handle a Varian Paxscan 2520 detector.
# 
#     The flat panel detector produces 16 bit unsigned (1840, 1456) images when setup in horizontal mode.
#     '''
# 
#     def __init__(self):
#         RegArrayDetector2d.__init__(self, size=(1840, 1456), data_type=np.uint16)
#         self.pixel_size = 0.127  # mm


from matplotlib import pyplot as plt, cm
from pymicro.crystal.lattice import *
from pymicro.crystal.microstructure import *
from pymicro.xray.laue import *
from pymicro.xray.detectors import Varian2520
from matplotlib import image
import numpy as np



det_distance = 150.
detector = Varian2520()
detector.ref_pos = np.array([det_distance, 0., 0.])
ni = Lattice.face_centered_cubic(0.3524)
phi1, phi, phi2 = (89.4, 92.0, 86.8)  # deg
orientation = Orientation.from_euler([phi1, phi, phi2])
uvw = HklDirection(1, 0, 5, ni)

all_planes = build_list(lattice=ni, max_miller=8)
compute_Laue_pattern(orientation, detector, all_planes, color_field='constant', r_spot=10, inverted=True)

plt.figure()  # new figure

# Path: pymicro/xray/detectors.py
# class Varian2520(RegArrayDetector2d):
#     '''Class to handle a Varian Paxscan 2520 detector.
# 
#     The flat panel detector produces 16 bit unsigned (1840, 1456) images when setup in horizontal mode.
#     '''
# 
#     def __init__(self):
#         RegArrayDetector2d.__init__(self, size=(1840, 1456), data_type=np.uint16)
#         self.pixel_size = 0.127  # mm


# Path: examples/plotting/laue_ellipse.py
from matplotlib import pyplot as plt, cm
from pymicro.crystal.lattice import *
from pymicro.crystal.microstructure import *
from pymicro.xray.laue import *
from pymicro.xray.detectors import Varian2520
from matplotlib import image
import numpy as np



det_distance = 150.
detector = Varian2520()
detector.ref_pos = np.array([det_distance, 0., 0.])
ni = Lattice.face_centered_cubic(0.3524)
phi1, phi, phi2 = (89.4, 92.0, 86.8)  # deg
orientation = Orientation.from_euler([phi1, phi, phi2])
uvw = HklDirection(1, 0, 5, ni)

all_planes = build_list(lattice=ni, max_miller=8)
compute_Laue_pattern(orientation, detector, all_planes, color_field='constant', r_spot=10, inverted=True)

plt.figure()  # new figure

plt.imshow(detector.data.T, cmap=cm.gray, vmin=0, vmax=255)
