dials.algorithms.spot_finding¶
Contains implementation interface for finding spots on one or many images
- class dials.algorithms.spot_finding.finder.ExtractPixelsFromImage(imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background)[source]¶
Bases:
object
A class to extract pixels from a single image
- __init__(imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background)[source]¶
Initialise the class
- Parameters:
imageset – The imageset to extract from
threshold_function – The function to threshold with
mask – The image mask
region_of_interest – A region of interest to process
max_strong_pixel_fraction – The maximum fraction of pixels allowed
- class dials.algorithms.spot_finding.finder.ExtractPixelsFromImage2DNoShoeboxes(imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot_size, max_spot_size, filter_spots)[source]¶
Bases:
ExtractPixelsFromImage
A class to extract pixels from a single image
- __init__(imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot_size, max_spot_size, filter_spots)[source]¶
Initialise the class
- Parameters:
imageset – The imageset to extract from
threshold_function – The function to threshold with
mask – The image mask
region_of_interest – A region of interest to process
max_strong_pixel_fraction – The maximum fraction of pixels allowed
- class dials.algorithms.spot_finding.finder.ExtractSpots(threshold_function=None, mask=None, region_of_interest=None, max_strong_pixel_fraction=0.1, compute_mean_background=False, mp_method=None, mp_nproc=1, mp_njobs=1, mp_chunksize=1, min_spot_size=1, max_spot_size=20, filter_spots=None, no_shoeboxes_2d=False, min_chunksize=50, write_hot_pixel_mask=False)[source]¶
Bases:
object
Class to find spots in an image and extract them into shoeboxes.
- __init__(threshold_function=None, mask=None, region_of_interest=None, max_strong_pixel_fraction=0.1, compute_mean_background=False, mp_method=None, mp_nproc=1, mp_njobs=1, mp_chunksize=1, min_spot_size=1, max_spot_size=20, filter_spots=None, no_shoeboxes_2d=False, min_chunksize=50, write_hot_pixel_mask=False)[source]¶
Initialise the class with the strategy
- Parameters:
threshold_function – The image thresholding strategy
mask – The mask to use
mp_method – The multi processing method
nproc – The number of processors
max_strong_pixel_fraction – The maximum number of strong pixels
- class dials.algorithms.spot_finding.finder.ExtractSpotsParallelTask(function)[source]¶
Bases:
object
Execute the spot finder task in parallel
We need this external class so that we can pickle it for cluster jobs
- class dials.algorithms.spot_finding.finder.SpotFinder(threshold_function=None, mask=None, region_of_interest=None, max_strong_pixel_fraction=0.1, compute_mean_background=False, mp_method=None, mp_nproc=1, mp_njobs=1, mp_chunksize=1, mask_generator=None, filter_spots=None, scan_range=None, write_hot_mask=True, hot_mask_prefix='hot_mask', min_spot_size=1, max_spot_size=20, no_shoeboxes_2d=False, min_chunksize=50, is_stills=False)[source]¶
Bases:
object
A class to do spot finding and filtering.
- __init__(threshold_function=None, mask=None, region_of_interest=None, max_strong_pixel_fraction=0.1, compute_mean_background=False, mp_method=None, mp_nproc=1, mp_njobs=1, mp_chunksize=1, mask_generator=None, filter_spots=None, scan_range=None, write_hot_mask=True, hot_mask_prefix='hot_mask', min_spot_size=1, max_spot_size=20, no_shoeboxes_2d=False, min_chunksize=50, is_stills=False)[source]¶
Initialise the class.
- Parameters:
find_spots – The spot finding algorithm
filter_spots – The spot filtering algorithm
scan_range – The scan range to find spots over
is_stills – [ADVANCED] Force still-handling of experiment ID remapping for dials.stills_process.
- find_spots(experiments: ExperimentList) reflection_table [source]¶
Do spotfinding for a set of experiments.
- Parameters:
experiments – The experiment list to process
- Returns:
A new reflection table of found reflections
- class dials.algorithms.spot_finding.finder.TOFSpotFinder(experiments, threshold_function=None, mask=None, region_of_interest=None, max_strong_pixel_fraction=0.1, compute_mean_background=False, mp_method=None, mp_nproc=1, mp_njobs=1, mp_chunksize=1, mask_generator=None, filter_spots=None, scan_range=None, write_hot_mask=True, hot_mask_prefix='hot_mask', min_spot_size=1, max_spot_size=20, min_chunksize=50)[source]¶
Bases:
SpotFinder
Class to do spot finding tailored to time of flight experiments
- __init__(experiments, threshold_function=None, mask=None, region_of_interest=None, max_strong_pixel_fraction=0.1, compute_mean_background=False, mp_method=None, mp_nproc=1, mp_njobs=1, mp_chunksize=1, mask_generator=None, filter_spots=None, scan_range=None, write_hot_mask=True, hot_mask_prefix='hot_mask', min_spot_size=1, max_spot_size=20, min_chunksize=50)[source]¶
Initialise the class.
- Parameters:
find_spots – The spot finding algorithm
filter_spots – The spot filtering algorithm
scan_range – The scan range to find spots over
is_stills – [ADVANCED] Force still-handling of experiment ID remapping for dials.stills_process.
- dials.algorithms.spot_finding.finder.pixel_list_to_reflection_table(imageset: ImageSet, pixel_labeller: Iterable[PixelListLabeller], filter_spots, min_spot_size: int, max_spot_size: int, write_hot_pixel_mask: bool) Tuple[shoebox, Tuple[size_t, ...]] [source]¶
Convert pixel list to reflection table
- dials.algorithms.spot_finding.finder.pixel_list_to_shoeboxes(imageset: ImageSet, pixel_labeller: Iterable[PixelListLabeller], min_spot_size: int, max_spot_size: int, write_hot_pixel_mask: bool) Tuple[shoebox, Tuple[size_t, ...]] [source]¶
Convert a pixel list to shoeboxes
- dials.algorithms.spot_finding.finder.shoeboxes_to_reflection_table(imageset: ImageSet, shoeboxes: shoebox, filter_spots) reflection_table [source]¶
Filter shoeboxes and create reflection table
- class dials.algorithms.spot_finding.factory.BackgroundGradientFilter(background_size=2, gradient_cutoff=4)[source]¶
Bases:
object
- class dials.algorithms.spot_finding.factory.FilterRunner(filters=None)[source]¶
Bases:
object
A class to run multiple filters in succession.
- __init__(filters=None)[source]¶
Initialise with a list of filters.
- Parameters:
filters – The list of filters
- check_flags(flags, predictions=None, observations=None, shoeboxes=None, **kwargs)[source]¶
Check the flags are set, if they’re not then create a list of Trues equal to the number of items given.
- Parameters:
flags – The input flags
predictions – The predictions
observations – The observations
shoeboxes – The shoeboxes
- Returns:
The filtered flags
- class dials.algorithms.spot_finding.factory.SpotDensityFilter(nbins=50, gradient_cutoff=0.002)[source]¶
Bases:
object
- class dials.algorithms.spot_finding.factory.SpotFinderFactory[source]¶
Bases:
object
Factory class to create spot finders
- static configure_filter(params)[source]¶
Get the filter strategy.
- Parameters:
params – The input parameters
- Returns:
The filter algorithm
- static configure_threshold(params)[source]¶
Get the threshold strategy
- Parameters:
params – The input parameters
- Returns:
The threshold algorithm
- static from_parameters(params=None, experiments=None, is_stills=False)[source]¶
Given a set of parameters, construct the spot finder
- Parameters:
params – The input parameters
is_stills – [ADVANCED] Force still-handling of experiment ID remapping for dials.stills_process.
- Returns:
The spot finder instance