This documentation page refers to a previous release of DIALS (1.14).
Click here to go to the corresponding page for the latest version of DIALS

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
are_experiment_identifiers_consistent(experiments=None)[source]

Check the experiment identifiers

as_h5(filename)[source]

Write the reflection table as a HDF5 file.

Parameters:filename – The output filename
as_miller_array(experiment, intensity='sum')[source]

Return a miller array with the chosen intensities.

Use the provided experiment object and intensity choice to make a miller intensity array with sigmas (no scaling applied).

Parameters:
  • experiment (dxtbx.model.Experiment) – An experiment object.
  • intensity (str) – The intensity type that will be used to make the miller array e.g ‘prf’, ‘sum’.
Returns:

A miller array with intensities and sigmas.

Return type:

cctbx.miller.array

Raises:

Sorry – If chosen intensity values cannot be found in the table.

as_msgpack((reflection_table)arg1) → str
as_msgpack_file(filename)[source]

Write the reflection table to file in msgpack format

as_pickle(filename)[source]

Write the reflection table as a pickle file.

Parameters:filename – The output filename
assert_experiment_identifiers_are_consistent(experiments=None)[source]

Check the experiment identifiers

clean_experiment_identifiers_map()[source]

Remove any entries from the identifier map that do not have any data in the table. Primarily to call as saving data to give a consistent table and map.

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_miller_indices_in_asu(experiments)[source]

Compute miller indices in the asu

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
experiment_identifiers((reflection_table)arg1) → experiment_id_map
extend((reflection_table)arg1, (reflection_table)arg2) → None

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_for_refinement = dials_array_family_flex_ext.flags.bad_for_refinement
bad_for_scaling = dials_array_family_flex_ext.flags.bad_for_scaling
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
excluded_for_refinement = dials_array_family_flex_ext.flags.excluded_for_refinement
excluded_for_scaling = dials_array_family_flex_ext.flags.excluded_for_scaling
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 = {'background_includes_bad_pixels': dials_array_family_flex_ext.flags.background_includes_bad_pixels, 'bad_for_refinement': dials_array_family_flex_ext.flags.bad_for_refinement, 'bad_for_scaling': dials_array_family_flex_ext.flags.bad_for_scaling, '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, 'centroid_outlier': dials_array_family_flex_ext.flags.centroid_outlier, 'dont_integrate': dials_array_family_flex_ext.flags.dont_integrate, 'excluded_for_refinement': dials_array_family_flex_ext.flags.excluded_for_refinement, 'excluded_for_scaling': dials_array_family_flex_ext.flags.excluded_for_scaling, '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, '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, 'observed': dials_array_family_flex_ext.flags.observed, 'outlier_in_scaling': dials_array_family_flex_ext.flags.outlier_in_scaling, '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, '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, 'user_excluded_in_scaling': dials_array_family_flex_ext.flags.user_excluded_in_scaling}
numerator

the numerator of a rational number in lowest terms

observed = dials_array_family_flex_ext.flags.observed
outlier_in_scaling = dials_array_family_flex_ext.flags.outlier_in_scaling
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
user_excluded_in_scaling = dials_array_family_flex_ext.flags.user_excluded_in_scaling
values = {1: dials_array_family_flex_ext.flags.predicted, 2: dials_array_family_flex_ext.flags.observed, 4: dials_array_family_flex_ext.flags.indexed, 8: dials_array_family_flex_ext.flags.used_in_refinement, 32: dials_array_family_flex_ext.flags.strong, 64: dials_array_family_flex_ext.flags.reference_spot, 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, 1024: dials_array_family_flex_ext.flags.overloaded, 2048: dials_array_family_flex_ext.flags.overlapped_bg, 4096: dials_array_family_flex_ext.flags.overlapped_fg, 8192: dials_array_family_flex_ext.flags.in_powder_ring, 16384: dials_array_family_flex_ext.flags.foreground_includes_bad_pixels, 32768: dials_array_family_flex_ext.flags.background_includes_bad_pixels, 49152: dials_array_family_flex_ext.flags.includes_bad_pixels, 64512: dials_array_family_flex_ext.flags.bad_spot, 65536: dials_array_family_flex_ext.flags.used_in_modelling, 131072: dials_array_family_flex_ext.flags.centroid_outlier, 262144: dials_array_family_flex_ext.flags.failed_during_background_modelling, 524288: dials_array_family_flex_ext.flags.failed_during_summation, 1048576: dials_array_family_flex_ext.flags.failed_during_profile_fitting, 2097152: dials_array_family_flex_ext.flags.bad_reference, 4194304: dials_array_family_flex_ext.flags.user_excluded_in_scaling, 8388608: dials_array_family_flex_ext.flags.outlier_in_scaling, 16777216: dials_array_family_flex_ext.flags.excluded_for_scaling, 29360128: dials_array_family_flex_ext.flags.bad_for_scaling, 33554432: dials_array_family_flex_ext.flags.excluded_for_refinement, 33685504: dials_array_family_flex_ext.flags.bad_for_refinement}
static from_h5(filename)[source]

Read the reflections table from a HDF5 file.

Parameters:filename – The hdf5 filename
Returns:The reflection table
static from_msgpack((str)arg1) → reflection_table
static from_msgpack_file(filename)[source]

Read the reflection table from file in msgpack format

static 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 from_pickle(filename)[source]

Read the reflection table from pickle file.

Parameters:filename – The pickle filename
Returns:The reflection table
static 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 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

get_flags((reflection_table)arg1, (int)value[, (bool)all=True]) → bool
has_key((reflection_table)arg1, (str)arg2) → bool
help_keys((reflection_table)arg1) → str
insert((reflection_table)arg1, (int)arg2, (dict)arg3) → None
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
is_consistent((reflection_table)arg1) → bool
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
iterate_experiments_and_indices(experiments)[source]

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

keys((object)arg1) → object
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
match_with_reference(other)[source]

Match reflections with another set of reflections.

Parameters:other – The reflection table to match against
Returns:The matches
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
ncols((reflection_table)arg1) → int
nrows((reflection_table)arg1) → int
static 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
remove_on_experiment_identifiers(list_of_identifiers)[source]

Remove datasets from the table, given a list of experiment identifiers (strings).

reorder((reflection_table)arg1, (size_t)arg2) → None
reset_ids()[source]

Reset the ‘id’ column such that the experiment identifiers are numbered 0 .. n-1.

resize((reflection_table)arg1, (int)arg2) → None
rows((object)arg1) → object
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

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

select_on_experiment_identifiers(list_of_identifiers)[source]

Given a list of experiment identifiers (strings), perform a selection and return a reflection table with properly configured experiment_identifiers map.

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

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

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

size((reflection_table)arg1) → int
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
split_by_experiment_id((reflection_table)arg1) → list
split_indices_by_experiment_id((reflection_table)arg1, (int)arg2) → list
split_partial_indices((reflection_table)arg1) → size_t
split_partials((reflection_table)arg1) → None
split_partials_with_shoebox((reflection_table)arg1) → None
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
types((reflection_table)arg1) → list
unset_flags((reflection_table)arg1, (bool)arg2, (int)arg3) → None

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

update((reflection_table)arg1, (reflection_table)arg2) → None

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