diff --git a/src/dials/algorithms/centroid/__init__.py b/src/dials/algorithms/centroid/__init__.py index 16f747ad69..d650f9232b 100644 --- a/src/dials/algorithms/centroid/__init__.py +++ b/src/dials/algorithms/centroid/__init__.py @@ -9,7 +9,7 @@ def centroid_px_to_mm(detector, scan, position, variance, sd_error): # Get the pixel to millimeter function assert len(detector) == 1 - if scan.has_property("time_of_flight"): + if scan is not None and scan.has_property("time_of_flight"): return tof_centroid_px_to_mm_panel( detector[0], scan, position, variance, sd_error ) @@ -20,7 +20,7 @@ def centroid_px_to_mm_panel(panel, scan, position, variance, sd_error): """Convenience function to calculate centroid in mm/rad from px""" # Get the pixel to millimeter function - if scan.has_property("time_of_flight"): + if scan is not None and scan.has_property("time_of_flight"): return tof_centroid_px_to_mm_panel(panel, scan, position, variance, sd_error) pixel_size = panel.get_pixel_size() @@ -75,7 +75,7 @@ def centroid_px_to_mm_panel(panel, scan, position, variance, sd_error): def tof_centroid_px_to_mm_panel(panel, scan, position, variance, sd_error): """Convenience function to calculate centroid in mm/tof from px""" - assert scan.has_property("time_of_flight") + assert scan is not None and scan.has_property("time_of_flight") pixel_size = panel.get_pixel_size() tof = scan.get_property("time_of_flight") # (usec) diff --git a/src/dials/algorithms/spot_finding/factory.py b/src/dials/algorithms/spot_finding/factory.py index 7cf8400afc..becf5b8a10 100644 --- a/src/dials/algorithms/spot_finding/factory.py +++ b/src/dials/algorithms/spot_finding/factory.py @@ -452,6 +452,8 @@ def from_parameters(params=None, experiments=None, is_stills=False): # Setup the spot finder contains_tof_experiments = False for experiment in experiments: + if experiment.scan is None: + continue if experiment.scan.has_property("time_of_flight"): contains_tof_experiments = True elif contains_tof_experiments: