Skip to content

Commit

Permalink
Enable dials.rlv and dials.image_viewer for polychromatic data.
Browse files Browse the repository at this point in the history
  • Loading branch information
toastisme committed Oct 10, 2024
1 parent e10d429 commit 0da4e1d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/dials/util/image_viewer/slip_viewer/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def get_beam_center_px(self):
# FIXME assumes all detector elements use the same millimeter-to-pixel convention
try:
# determine if the beam intersects one of the panels
panel_id, (x_mm, y_mm) = detector.get_ray_intersection(beam.get_s0())
panel_id, (x_mm, y_mm) = detector.get_ray_intersection(beam.get_unit_s0())
except RuntimeError as e:
if not ("DXTBX_ASSERT(" in str(e) and ") failure" in str(e)):
# unknown exception from dxtbx
Expand All @@ -374,12 +374,14 @@ def get_beam_center_px(self):
lowest_res = 0
for p_id, panel in enumerate(detector):
w, h = panel.get_image_size()
res = panel.get_resolution_at_pixel(beam.get_s0(), (w // 2, h // 2))
res = panel.get_resolution_at_pixel(
beam.get_unit_s0(), (w // 2, h // 2)
)
if res > lowest_res:
panel_id = p_id
lowest_res = res
try:
x_mm, y_mm = detector[panel_id].get_beam_centre(beam.get_s0())
x_mm, y_mm = detector[panel_id].get_beam_centre(beam.get_unit_s0())
except RuntimeError:
# cope with cases like https://github.com/dials/dials/issues/2478
x_mm, y_mm = detector[panel_id].get_bidirectional_ray_intersection(
Expand Down
3 changes: 1 addition & 2 deletions src/dials/util/image_viewer/slip_viewer/tile_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ def vec_picture_fast_slow_to_map_relative(self, vector):
return value

def get_spotfinder_data(self, params):

pointdata = []
test_pattern = False
if (
Expand Down Expand Up @@ -439,7 +438,7 @@ def get_resolution(self, x, y, readout=None):
beam = self.raw_image.get_beam()
if detector is None or beam is None:
return None
beam = beam.get_s0()
beam = beam.get_unit_s0()

if readout is None:
return None
Expand Down
4 changes: 3 additions & 1 deletion src/dials/util/image_viewer/spotfinder_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ def __init__(self, *args, **kwds):
break
for experiment_list in self.experiments:
if not all(
exp.scan and (exp.scan.get_oscillation()[1] == 0.0)
exp.scan
and exp.scan.has_property("oscillation")
and (exp.scan.get_oscillation()[1] == 0.0)
for exp in experiment_list
):
self.viewing_still_scans = False
Expand Down
2 changes: 1 addition & 1 deletion src/dials/util/reciprocal_lattice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def load_models(self, experiments, reflections):
self.viewer.set_rotation_axis(
self.experiments[0].goniometer.get_rotation_axis()
)
self.viewer.set_beam_vector(self.experiments[0].beam.get_s0())
self.viewer.set_beam_vector(self.experiments[0].beam.get_unit_s0())
if self.settings.beam_centre is None:
try:
(
Expand Down

0 comments on commit 0da4e1d

Please sign in to comment.