diffraction_geometry.py: added a if __name__ == "__main__": block for testing
This commit is contained in:
@@ -48,4 +48,35 @@ class DiffractionGeometry(BaseModel):
|
||||
if x >= 1.0 or x <= -1.0:
|
||||
return 0.0
|
||||
theta = math.asin(x)
|
||||
return self.detector_radius_mm / math.tan(2*theta)
|
||||
return self.detector_radius_mm / math.tan(2*theta)
|
||||
|
||||
if __name__ == "__main__":
|
||||
from aare.devices.jfjoch import JFJochWrapper
|
||||
from aare.common.beamline import mx_beamline
|
||||
from aare.daq.config import BeamlineConfig
|
||||
bl = mx_beamline()
|
||||
client = JFJochWrapper(bl)
|
||||
cfg = BeamlineConfig(bl)
|
||||
print(cfg)
|
||||
det_cfg = client.detector()
|
||||
print(det_cfg)
|
||||
print(f"pixel_size: {det_cfg.pixel_size_mm:.4f} mm")
|
||||
print(f"Detector height: {det_cfg.height:.2f} pixel")
|
||||
print(f"Detector width: {det_cfg.width:.2f} pixel")
|
||||
print(f"beam centre = ({cfg.beam_center[0]:.2f}, {cfg.beam_center[1]:.2f})")
|
||||
geom = DiffractionGeometry(
|
||||
energy_keV=12.4,
|
||||
dtz_mm=200.0,
|
||||
pixel_size_mm=det_cfg.pixel_size_mm,
|
||||
beam_center_pxl=(det_cfg.width/2, det_cfg.height/2),
|
||||
detector_size_pxl=(det_cfg.width, det_cfg.height),
|
||||
detector_description=det_cfg.description,
|
||||
detector_serial_number=det_cfg.serial_number,
|
||||
poni_rot1_rad=-0.001396263,
|
||||
poni_rot2_rad=-0.003839724,
|
||||
)
|
||||
print(f"geom.max_resolution_angstrom: {geom.max_resolution_angstrom:.2f} Angstrom")
|
||||
print(f"geom.calc_dtz_mm(3.9): {geom.calc_dtz_mm(3.9):.2f} mm")
|
||||
|
||||
print(f"geom.resolution_angstrom(1244.42): {geom.resolution_angstrom(1244.42):.2f} Angstrom")
|
||||
print(f"geom.detector_radius_mm: {geom.detector_radius_mm:.2f} mm")
|
||||
|
||||
Reference in New Issue
Block a user