Skip to content

Commit

Permalink
mapping centroids to reciprocal space and entering flags now check fo…
Browse files Browse the repository at this point in the history
…r wavelength/s0 in reflection table first.
  • Loading branch information
toastisme committed Mar 18, 2024
1 parent ea4fc09 commit 3f63f63
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/dials/array_family/flex_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,7 @@ def map_centroids_to_reciprocal_space(
sel_expt = self["id"] == i

for i_panel in range(len(expt.detector)):

sel = sel_expt & (panel_numbers == i_panel)
if calculated:
x, y, rot_angle = self["xyzcal.mm"].select(sel).parts()
Expand All @@ -1329,9 +1330,20 @@ def map_centroids_to_reciprocal_space(
s1 = expt.detector[i_panel].get_lab_coord(
cctbx.array_family.flex.vec2_double(x, y)
)
s1 = s1 / s1.norms() * (1 / expt.beam.get_wavelength())

if calculated and "wavelength_cal" in self and "s0_cal" in self:
wavelength = self["wavelength_cal"].select(sel)
s0 = self["s0_cal"].select(sel)
elif "wavelength" in self and "s0" in self:
wavelength = self["wavelength"].select(sel)
s0 = self["s0"].select(sel)
else:
wavelength = expt.beam.get_wavelength()
s0 = expt.beam.get_s0()

s1 = s1 / s1.norms() * (1 / wavelength)
self["s1"].set_selected(sel, s1)
S = s1 - expt.beam.get_s0()
S = s1 - s0
if expt.goniometer is not None:
setting_rotation = matrix.sqr(
expt.goniometer.get_setting_rotation()
Expand Down Expand Up @@ -1381,8 +1393,14 @@ def calculate_entering_flags(self, experiments):
if not experiment.goniometer:
continue
axis = matrix.col(experiment.goniometer.get_rotation_axis())
s0 = matrix.col(experiment.beam.get_s0())
vec = s0.cross(axis)
if "s0" in self:
s0 = self["s0"]
vec = cctbx.array_family.flex.vec3_double(len(self))
for i in range(len(s0)):
vec[i] = matrix.col(s0[i]).cross(axis)
else:
s0 = matrix.col(experiment.beam.get_s0())
vec = s0.cross(axis)
sel = self["id"] == iexp
enterings.set_selected(sel, self["s1"].dot(vec) < 0.0)

Expand Down

0 comments on commit 3f63f63

Please sign in to comment.