Array Family

Table of Contents

dials.array_family.flex.default_background_algorithm()[source]

Get the default background algorithm.

Returns:The default background algorithm
dials.array_family.flex.default_centroid_algorithm()[source]

Get the default centroid algorithm.

Returns:The default centroid algorithm
class dials.array_family.flex.reflection_table_aux[source]

Bases: boost.python.injector, dials_array_family_flex_ext.reflection_table

An injector class to add additional methods to the reflection table.

append((reflection_table)arg1, (dict)arg2) → None
as_h5(filename)[source]

Write the reflection table as a HDF5 file.

Parameters:filename – The output filename
as_pickle(filename)[source]

Write the reflection table as a pickle file.

Parameters:filename – The output filename
clear((reflection_table)arg1) → None
cols((object)arg1) → object
compute_background(experiments, image_volume=None)[source]

Helper function to compute the background.

Parameters:experiments – The list of experiments
compute_bbox(experiments, sigma_b_multiplier=2.0)[source]

Compute the bounding boxes.

Parameters:
  • experiments – The list of experiments
  • profile_model – The profile models
  • sigma_b_multiplier – Multiplier to cover extra background
Returns:

The bounding box for each reflection

compute_centroid(experiments, image_volume=None)[source]

Helper function to compute the centroid.

Parameters:experiments – The list of experiments
compute_corrections(experiments)[source]

Helper function to correct the intensity.

Parameters:experiments – The list of experiments
Returns:The LP correction for each reflection
compute_d(experiments)[source]

Compute the resolution for each reflection.

Parameters:experiments – The experiment list
Returns:The resolution for each reflection
compute_d_single(experiment)[source]

Compute the resolution for each reflection.

Parameters:experiment – The experimental models
Returns:The resolution for each reflection
compute_fitted_intensity(fitter)[source]

Helper function to compute the intensity.

Parameters:
  • experiments – The list of experiments
  • profile_model – The profile model
compute_mask(experiments, image_volume=None, overlaps=None)[source]

Apply a mask to the shoeboxes.

Parameters:
  • experiments – The list of experiments
  • profile_model – The profile model
compute_partiality(experiments)[source]

Compute the reflection partiality.

Parameters:
  • experiments – The experiment list
  • profile_model – The profile models
Returns:

The partiality for each reflection

compute_phi_range((reflection_table)arg1, (object)arg2, (object)arg3, (float)arg4, (float)arg5) → vec2_double
compute_ray_intersections((reflection_table)arg1, (Detector)arg2) → vec2_double
compute_shoebox_overlap_fraction(overlaps)[source]

Compute the fraction of shoebox overlapping.

Parameters:overlaps – The list of overlaps
Returns:The fraction of shoebox overlapped with other reflections
compute_summed_intensity(image_volume=None)[source]

Compute intensity via summation integration.

compute_zeta(experiment)[source]

Compute zeta for each reflection.

Parameters:experiment – The experimental models
Returns:Zeta for each reflection
compute_zeta_multi(experiments)[source]

Compute zeta for each reflection.

Parameters:experiments – The list of experiments
Returns:Zeta for each reflection
contains_invalid_pixels()[source]

Check if the shoebox contains invalid pixels.

Returns:True/False invalid for each reflection
copy()[source]

Copy everything.

Returns:A copy of the reflection table
del_selected((reflection_table)arg1, (size_t)arg2) → None

del_selected( (reflection_table)arg1, (bool)arg2) -> None

del_selected( (reflection_table)arg1, (std_string)arg2) -> None

del_selected( (reflection_table)arg1, (tuple)arg2) -> None

empty((reflection_table)arg1) → bool
static empty_standard(nrows)[source]

Create an empty table of specified number of rows with most of the standard keys

Parameters:nrows – The number of rows to create
Returns:The reflection table
extend((reflection_table)arg1, (reflection_table)arg2) → None
extract_shoeboxes(imageset, mask=None, nthreads=1, verbose=False)[source]

Helper function to read a load of shoebox data.

Parameters:
  • imageset – The imageset
  • mask – The mask to apply
  • nthreads – The number of threads to use
  • verbose – The verbosity
Returns:

A tuple containing read time and extract time

find_overlaps(experiments=None, border=0)[source]

Check for overlapping reflections.

Parameters:
  • experiments – The experiment list
  • tolerance – A positive integer specifying border around shoebox
Returns:

The overlap list

class flags

Bases: Boost.Python.enum

background_includes_bad_pixels = dials_array_family_flex_ext.flags.background_includes_bad_pixels
bad_reference = dials_array_family_flex_ext.flags.bad_reference
bad_shoebox = dials_array_family_flex_ext.flags.bad_shoebox
bad_spot = dials_array_family_flex_ext.flags.bad_spot
bit_length() → int

Number of bits necessary to represent self in binary. >>> bin(37) ‘0b100101’ >>> (37).bit_length() 6

centroid_outlier = dials_array_family_flex_ext.flags.centroid_outlier
conjugate()

Returns self, the complex conjugate of any int.

denominator

the denominator of a rational number in lowest terms

dont_integrate = dials_array_family_flex_ext.flags.dont_integrate
failed_during_background_modelling = dials_array_family_flex_ext.flags.failed_during_background_modelling
failed_during_profile_fitting = dials_array_family_flex_ext.flags.failed_during_profile_fitting
failed_during_summation = dials_array_family_flex_ext.flags.failed_during_summation
foreground_includes_bad_pixels = dials_array_family_flex_ext.flags.foreground_includes_bad_pixels
imag

the imaginary part of a complex number

in_powder_ring = dials_array_family_flex_ext.flags.in_powder_ring
includes_bad_pixels = dials_array_family_flex_ext.flags.includes_bad_pixels
indexed = dials_array_family_flex_ext.flags.indexed
integrated = dials_array_family_flex_ext.flags.integrated
integrated_prf = dials_array_family_flex_ext.flags.integrated_prf
integrated_sum = dials_array_family_flex_ext.flags.integrated_sum
name
names = {'integrated_sum': dials_array_family_flex_ext.flags.integrated_sum, 'reference_spot': dials_array_family_flex_ext.flags.reference_spot, 'bad_reference': dials_array_family_flex_ext.flags.bad_reference, 'observed': dials_array_family_flex_ext.flags.observed, 'foreground_includes_bad_pixels': dials_array_family_flex_ext.flags.foreground_includes_bad_pixels, 'failed_during_background_modelling': dials_array_family_flex_ext.flags.failed_during_background_modelling, 'bad_spot': dials_array_family_flex_ext.flags.bad_spot, 'overlapped_bg': dials_array_family_flex_ext.flags.overlapped_bg, 'failed_during_profile_fitting': dials_array_family_flex_ext.flags.failed_during_profile_fitting, 'used_in_modelling': dials_array_family_flex_ext.flags.used_in_modelling, 'indexed': dials_array_family_flex_ext.flags.indexed, 'integrated': dials_array_family_flex_ext.flags.integrated, 'dont_integrate': dials_array_family_flex_ext.flags.dont_integrate, 'failed_during_summation': dials_array_family_flex_ext.flags.failed_during_summation, 'integrated_prf': dials_array_family_flex_ext.flags.integrated_prf, 'used_in_refinement': dials_array_family_flex_ext.flags.used_in_refinement, 'strong': dials_array_family_flex_ext.flags.strong, 'includes_bad_pixels': dials_array_family_flex_ext.flags.includes_bad_pixels, 'centroid_outlier': dials_array_family_flex_ext.flags.centroid_outlier, 'bad_shoebox': dials_array_family_flex_ext.flags.bad_shoebox, 'overloaded': dials_array_family_flex_ext.flags.overloaded, 'background_includes_bad_pixels': dials_array_family_flex_ext.flags.background_includes_bad_pixels, 'overlapped_fg': dials_array_family_flex_ext.flags.overlapped_fg, 'predicted': dials_array_family_flex_ext.flags.predicted, 'in_powder_ring': dials_array_family_flex_ext.flags.in_powder_ring}
numerator

the numerator of a rational number in lowest terms

observed = dials_array_family_flex_ext.flags.observed
overlapped_bg = dials_array_family_flex_ext.flags.overlapped_bg
overlapped_fg = dials_array_family_flex_ext.flags.overlapped_fg
overloaded = dials_array_family_flex_ext.flags.overloaded
predicted = dials_array_family_flex_ext.flags.predicted
real

the real part of a complex number

reference_spot = dials_array_family_flex_ext.flags.reference_spot
strong = dials_array_family_flex_ext.flags.strong
used_in_modelling = dials_array_family_flex_ext.flags.used_in_modelling
used_in_refinement = dials_array_family_flex_ext.flags.used_in_refinement
values = {4096: dials_array_family_flex_ext.flags.overlapped_fg, 1: dials_array_family_flex_ext.flags.predicted, 2: dials_array_family_flex_ext.flags.observed, 4: dials_array_family_flex_ext.flags.indexed, 524288: dials_array_family_flex_ext.flags.failed_during_summation, 8: dials_array_family_flex_ext.flags.used_in_refinement, 128: dials_array_family_flex_ext.flags.dont_integrate, 256: dials_array_family_flex_ext.flags.integrated_sum, 512: dials_array_family_flex_ext.flags.integrated_prf, 768: dials_array_family_flex_ext.flags.integrated, 262144: dials_array_family_flex_ext.flags.failed_during_background_modelling, 32: dials_array_family_flex_ext.flags.strong, 131072: dials_array_family_flex_ext.flags.centroid_outlier, 1024: dials_array_family_flex_ext.flags.overloaded, 8192: dials_array_family_flex_ext.flags.in_powder_ring, 16384: dials_array_family_flex_ext.flags.foreground_includes_bad_pixels, 1048576: dials_array_family_flex_ext.flags.failed_during_profile_fitting, 32768: dials_array_family_flex_ext.flags.background_includes_bad_pixels, 64: dials_array_family_flex_ext.flags.reference_spot, 2048: dials_array_family_flex_ext.flags.overlapped_bg, 49152: dials_array_family_flex_ext.flags.includes_bad_pixels, 2097152: dials_array_family_flex_ext.flags.bad_reference, 65536: dials_array_family_flex_ext.flags.used_in_modelling, 64512: dials_array_family_flex_ext.flags.bad_spot}
static reflection_table_aux.from_h5(filename)[source]

Read the reflections table from a HDF5 file.

Parameters:filename – The hdf5 filename
Returns:The reflection table
static reflection_table_aux.from_observations(datablock, params=None)[source]

Construct a reflection table from observations.

Parameters:
  • datablock – The datablock
  • params – The input parameters
Returns:

The reflection table of observations

static reflection_table_aux.from_pickle(filename)[source]

Read the reflection table from pickle file.

Parameters:filename – The pickle filename
Returns:The reflection table
static reflection_table_aux.from_predictions(experiment, dmin=None, dmax=None, margin=1, force_static=False, padding=0)[source]

Construct a reflection table from predictions.

Parameters:
  • experiment – The experiment to predict from
  • dmin – The maximum resolution
  • dmax – The minimum resolution
  • margin – The margin to predict around
  • force_static – Do static prediction with a scan varying model
  • padding – Padding in degrees
Returns:

The reflection table of predictions

static reflection_table_aux.from_predictions_multi(experiments, dmin=None, dmax=None, margin=1, force_static=False, padding=0)[source]

Construct a reflection table from predictions.

Parameters:
  • experiments – The experiment list to predict from
  • dmin – The maximum resolution
  • dmax – The minimum resolution
  • margin – The margin to predict around
  • force_static – Do static prediction with a scan varying model
  • padding – Padding in degrees
Returns:

The reflection table of predictions

reflection_table_aux.get_flags((reflection_table)arg1, (int)value[, (bool)all=True]) → bool
reflection_table_aux.has_key((reflection_table)arg1, (str)arg2) → bool
reflection_table_aux.help_keys((reflection_table)arg1) → str
reflection_table_aux.insert((reflection_table)arg1, (int)arg2, (dict)arg3) → None
reflection_table_aux.integrate(experiments, profile_model, reference_selector=None)[source]

Helper function to integrate reflections.

Parameters:
  • experiments – The list of experiments
  • profile_model – The profile model
  • reference_selector – The algorithm to choose reference spots
reflection_table_aux.is_consistent((reflection_table)arg1) → bool
reflection_table_aux.is_overloaded(experiments_or_datablock)[source]

Check if the shoebox contains overloaded pixels.

Parameters:experiments – The experiment list
Returns:True/False overloaded for each reflection
reflection_table_aux.iterate_experiments_and_indices(experiments)[source]

A helper function to interate through experiments and indices of reflections for each experiment

reflection_table_aux.keys((object)arg1) → object
reflection_table_aux.match(other)[source]

Match reflections with another set of reflections.

Parameters:other – The reflection table to match against
Returns:A tuple containing the matches in the reflection table and the other reflection table
reflection_table_aux.match_with_reference(other)[source]

Match reflections with another set of reflections.

Parameters:other – The reflection table to match against
Returns:The matches
reflection_table_aux.match_with_reference_without_copying_columns(other)[source]

Match reflections with another set of reflections.

Parameters:other – The reflection table to match against
Returns:The matches
reflection_table_aux.ncols((reflection_table)arg1) → int
reflection_table_aux.nrows((reflection_table)arg1) → int
static reflection_table_aux.plot(table, detector, key)[source]

Plot a reflection table using matplotlib

Parameters:
  • table – The reflection table
  • detector – The detector model
  • key – The key to plot
reflection_table_aux.reorder((reflection_table)arg1, (size_t)arg2) → None
reflection_table_aux.resize((reflection_table)arg1, (int)arg2) → None
reflection_table_aux.rows((object)arg1) → object
reflection_table_aux.select((reflection_table)arg1, (size_t)arg2) → reflection_table

select( (reflection_table)arg1, (bool)arg2) -> reflection_table

select( (reflection_table)arg1, (std_string)arg2) -> reflection_table

select( (reflection_table)arg1, (tuple)arg2) -> reflection_table

reflection_table_aux.set_flags((reflection_table)arg1, (bool)arg2, (int)arg3) → None

set_flags( (reflection_table)arg1, (size_t)arg2, (int)arg3) -> None

reflection_table_aux.set_selected((reflection_table)arg1, (size_t)arg2, (reflection_table)arg3) → None

set_selected( (reflection_table)arg1, (bool)arg2, (reflection_table)arg3) -> None

set_selected( (reflection_table)arg1, (std_string)arg2, (reflection_table)arg3) -> None

set_selected( (reflection_table)arg1, (tuple)arg2, (reflection_table)arg3) -> None

reflection_table_aux.size((reflection_table)arg1) → int
reflection_table_aux.sort(name, reverse=False, order=None)[source]

Sort the reflection table by a key.

Parameters:
  • name – The name of the column
  • reverse – Reverse the sort order
  • order – For multi element items specify order
reflection_table_aux.split_by_experiment_id((reflection_table)arg1) → list
reflection_table_aux.split_indices_by_experiment_id((reflection_table)arg1, (int)arg2) → list
reflection_table_aux.split_partial_indices((reflection_table)arg1) → size_t
reflection_table_aux.split_partials((reflection_table)arg1) → None
reflection_table_aux.split_partials_with_shoebox((reflection_table)arg1) → None
reflection_table_aux.subsort(key0, key1, reverse=False)[source]

Sort the reflection based on key1 within a constant key0.

Parameters:
  • key0 – The name of the column values to sort within
  • key1 – The sorting key name within the selected column
reflection_table_aux.types((reflection_table)arg1) → list
reflection_table_aux.unset_flags((reflection_table)arg1, (bool)arg2, (int)arg3) → None

unset_flags( (reflection_table)arg1, (size_t)arg2, (int)arg3) -> None

reflection_table_aux.update((reflection_table)arg1, (reflection_table)arg2) → None
class dials.array_family.flex.reflection_table_selector(column, op, value)[source]

Bases: object

A class to select columns from reflection table.

This is mainly useful for specifying selections from phil parameters

op_string

Return the operator as a string

dials.array_family.flex.strategy(cls, params=None)[source]

Wrap a class that takes params and experiments as a strategy.

Parameters:
  • cls – The class to wrap
  • params – The input parameters
Returns:

A function to instantiate the strategy