Skip to content
Snippets Groups Projects
Commit bd140591 authored by Egor Sobolev's avatar Egor Sobolev
Browse files

Add update of JF4M update by motors

parent 5061bb92
No related branches found
No related tags found
1 merge request!3Center refinement using powder diffraction data
......@@ -3,29 +3,34 @@ from argparse import ArgumentParser
import h5py
import matplotlib.pyplot as plt
from extra.components import AGIPD1MQuadrantMotors
from extra.components import AGIPD1MQuadrantMotors, JF4MHalfMotors
from extra_data import open_run
from extra_geom import AGIPD_1MGeometry, JUNGFRAUGeometry
from extra_geom.motors import AGIPD_1MMotors
from extra_geom.motors import AGIPD_1MMotors, JF4MMotors
from . import PowderDiffraction
from .calibrants import calibrant_list, get_calibrant
from .misc import agipd_borders, jungfrau_borders
DETECTOR_TYPE = {
"agipd1m": AGIPD_1MGeometry,
"jf4m": JUNGFRAUGeometry,
}
BORDER_MASK = {
"agipd1m": agipd_borders,
"jf4m": jungfrau_borders,
DETECTOR = {
"agipd1m": {
"geometry": AGIPD_1MGeometry,
"borders": agipd_borders,
"motors": AGIPD1MQuadrantMotors,
"tracker": AGIPD_1MMotors
},
"jf4m": {
"geometry": JUNGFRAUGeometry,
"borders": jungfrau_borders,
"motors": JF4MMotors,
"tracker": JF4MHalfMotors
}
}
CALIBRANTS = calibrant_list()
def guess_detector_type(detector_id):
for detector_type in DETECTOR_TYPE.keys():
for detector_type in DETECTOR.keys():
if detector_type.upper() in detector_id:
return detector_type
......@@ -39,7 +44,7 @@ def main(argv=None):
parser.add_argument("-g", "--geometry", required=True,
help="Crystfel geometry file")
parser.add_argument("-l", "--layout", choices=DETECTOR_TYPE.keys(),
parser.add_argument("-l", "--layout", choices=DETECTOR.keys(),
help="Detector layout")
parser.add_argument("-c", "--calibrant", required=True,
choices=CALIBRANTS, help="Calibrant")
......@@ -86,19 +91,17 @@ def main(argv=None):
print("Wave length", lmd, "(nm)")
print("Camera length", clen, "(m)")
geom_class = DETECTOR_TYPE[detector_type]
det = DETECTOR[detector_type]
geom_class = det["geometry"]
ref_geom = geom_class.from_crystfel_geom(args.geometry)
if detector_type == "agipd1m":
run = open_run(propno, runno, data="raw")
tracker = AGIPD_1MMotors(ref_geom)
motors = AGIPD1MQuadrantMotors(run)
geom = tracker.geom_at(motors.most_frequent_positions())
else:
geom = ref_geom
run = open_run(propno, runno, data="raw")
tracker = det["tracker"](ref_geom)
motors = det["motors"](run)
geom = tracker.geom_at(motors.most_frequent_positions())
rings = get_calibrant(args.calibrant)
borders = BORDER_MASK[detector_type](num_modules)
borders = det["borders"](num_modules)
pw = PowderDiffraction(
geom, rings, clen, lmd, sigma=args.sigma, snr=args.snr,
border_mask=~borders, make_shadow_mask=True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment