Array Family¶
- class dials.array_family.flex.reflection_table¶
Bases:
instanceAn injector class to add additional methods to the reflection table.
- __init__((object)arg1) None¶
__init__( (object)arg1, (object)arg2) -> None
__init__( (object)arg1, (list)arg2) -> object
__init__( (object)arg1, (observation)arg2, (shoebox)arg3) -> object
- are_experiment_identifiers_consistent(experiments=None)¶
Check the experiment identifiers
- as_file(filename)¶
Write the reflection table to file in either msgpack or pickle format
- as_hdf5(filename)¶
Write the reflection table as a hdf5 file.
- as_miller_array(experiment, intensity='sum')¶
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:
- Raises:
KeyError – If chosen intensity values cannot be found in the table.
- as_msgpack_file(filename)¶
Write the reflection table to file in msgpack format
- as_pickle(filename)¶
Write the reflection table as a pickle file.
- Parameters:
filename – The output filename
- assert_experiment_identifiers_are_consistent(experiments=None)¶
Check the experiment identifiers
- background_algorithm¶
An extension class implementing a robust GLM background algorithm.
- calculate_entering_flags(experiments)¶
Calculate the entering flags for the reflections.
Calculate a unit vector normal to the spindle-beam plane for this experiment, such that the vector placed at the centre of the Ewald sphere points to the hemispere in which reflections cross from inside to outside of the sphere (reflections are exiting). Adds the array of boolean entering flags to self as the “entering” column.
Note
NB this vector is in +ve Y direction when using imgCIF coordinate frame.
- Parameters:
experiments – The experiment list to use in calculating the entering flags.
- centroid_algorithm¶
An extension class implementing a simple centroid algorithm.
- centroid_px_to_mm(experiments)¶
Map spot centroids from pixel/image number to mm/radian.
Used to convert spot centroids coming from e.g. dials.find_spots which are in pixel/image number units to mm/radian units as required for indexing and refinement.
- Parameters:
experiments (dxtbx.model.ExperimentList) – A list of experiments.
- clean_experiment_identifiers_map()¶
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.
- compute_background(experiments, image_volume=None)¶
Helper function to compute the background.
- Parameters:
experiments – The list of experiments
- compute_bbox(experiments, sigma_b_multiplier=2.0)¶
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)¶
Helper function to compute the centroid.
- Parameters:
experiments – The list of experiments
- compute_corrections(experiments)¶
Helper function to correct the intensity.
- Parameters:
experiments – The list of experiments
- Returns:
The LP correction for each reflection
- compute_d(experiments)¶
Compute the resolution for each reflection.
- Parameters:
experiments – The experiment list
- Returns:
The resolution for each reflection
- compute_d_single(experiment)¶
Compute the resolution for each reflection.
- Parameters:
experiment – The experimental models
- Returns:
The resolution for each reflection
- compute_fitted_intensity(fitter)¶
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)¶
Apply a mask to the shoeboxes.
- Parameters:
experiments – The list of experiments
profile_model – The profile model
- compute_miller_indices_in_asu(experiments)¶
Compute miller indices in the asu
- compute_partiality(experiments)¶
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, (object)arg4, (object)arg5) scitbx_array_family_flex_ext.vec2_double¶
- compute_ray_intersections((reflection_table)arg1, (dxtbx_model_ext.Detector)arg2) scitbx_array_family_flex_ext.vec2_double¶
- compute_summed_intensity(image_volume: MultiPanelImageVolume = None) None¶
Compute intensity via summation integration.
- compute_zeta(experiment)¶
Compute zeta for each reflection.
- Parameters:
experiment – The experimental models
- Returns:
Zeta for each reflection
- compute_zeta_multi(experiments)¶
Compute zeta for each reflection.
- Parameters:
experiments – The list of experiments
- Returns:
Zeta for each reflection
- static concat(tables: list[reflection_table]) reflection_table¶
Concatenate a list of reflection tables, taking care to correctly handle experiment identifiers and ids. :param tables: A list of reflection tables :return: A single combined reflection table
- contains_invalid_pixels()¶
Check if the shoebox contains invalid pixels.
- Returns:
True/False invalid for each reflection
- copy()¶
Copy everything.
- Returns:
A copy of the reflection table
- del_selected((reflection_table)arg1, (scitbx_array_family_flex_ext.size_t)arg2) None¶
del_selected( (reflection_table)arg1, (scitbx_array_family_flex_ext.bool)arg2) -> None
del_selected( (reflection_table)arg1, (scitbx_array_family_flex_ext.std_string)arg2) -> None
del_selected( (reflection_table)arg1, (tuple)arg2) -> None
- static empty_standard(nrows)¶
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)¶
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
- Returns:
A tuple containing read time and extract time
- find_overlaps(experiments=None, border=0)¶
Check for overlapping reflections.
- Parameters:
experiments – The experiment list
tolerance – A positive integer specifying border around shoebox
- Returns:
The overlap list
- class flags¶
Bases:
enum- as_integer_ratio()¶
Return a pair of integers, whose ratio is equal to the original int.
The ratio is in lowest terms and has a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- background_includes_bad_pixels = dials_array_family_flex_ext.reflection_table.flags.background_includes_bad_pixels¶
- bad_for_refinement = dials_array_family_flex_ext.reflection_table.flags.bad_for_refinement¶
- bad_for_scaling = dials_array_family_flex_ext.reflection_table.flags.bad_for_scaling¶
- bad_reference = dials_array_family_flex_ext.reflection_table.flags.bad_reference¶
- bad_shoebox = dials_array_family_flex_ext.reflection_table.flags.bad_shoebox¶
- bad_spot = dials_array_family_flex_ext.reflection_table.flags.bad_spot¶
- bit_count()¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- bit_length()¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- centroid_outlier = dials_array_family_flex_ext.reflection_table.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.reflection_table.flags.dont_integrate¶
- excluded_for_refinement = dials_array_family_flex_ext.reflection_table.flags.excluded_for_refinement¶
- excluded_for_scaling = dials_array_family_flex_ext.reflection_table.flags.excluded_for_scaling¶
- failed_during_background_modelling = dials_array_family_flex_ext.reflection_table.flags.failed_during_background_modelling¶
- failed_during_profile_fitting = dials_array_family_flex_ext.reflection_table.flags.failed_during_profile_fitting¶
- failed_during_summation = dials_array_family_flex_ext.reflection_table.flags.failed_during_summation¶
- foreground_includes_bad_pixels = dials_array_family_flex_ext.reflection_table.flags.foreground_includes_bad_pixels¶
- classmethod from_bytes(bytes, byteorder='big', *, signed=False)¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- imag¶
the imaginary part of a complex number
- in_powder_ring = dials_array_family_flex_ext.reflection_table.flags.in_powder_ring¶
- includes_bad_pixels = dials_array_family_flex_ext.reflection_table.flags.includes_bad_pixels¶
- indexed = dials_array_family_flex_ext.reflection_table.flags.indexed¶
- integrated = dials_array_family_flex_ext.reflection_table.flags.integrated¶
- integrated_prf = dials_array_family_flex_ext.reflection_table.flags.integrated_prf¶
- integrated_sum = dials_array_family_flex_ext.reflection_table.flags.integrated_sum¶
- is_integer()¶
Returns True. Exists for duck type compatibility with float.is_integer.
- name¶
- names = {'background_includes_bad_pixels': dials_array_family_flex_ext.reflection_table.flags.background_includes_bad_pixels, 'bad_for_refinement': dials_array_family_flex_ext.reflection_table.flags.bad_for_refinement, 'bad_for_scaling': dials_array_family_flex_ext.reflection_table.flags.bad_for_scaling, 'bad_reference': dials_array_family_flex_ext.reflection_table.flags.bad_reference, 'bad_shoebox': dials_array_family_flex_ext.reflection_table.flags.bad_shoebox, 'bad_spot': dials_array_family_flex_ext.reflection_table.flags.bad_spot, 'centroid_outlier': dials_array_family_flex_ext.reflection_table.flags.centroid_outlier, 'dont_integrate': dials_array_family_flex_ext.reflection_table.flags.dont_integrate, 'excluded_for_refinement': dials_array_family_flex_ext.reflection_table.flags.excluded_for_refinement, 'excluded_for_scaling': dials_array_family_flex_ext.reflection_table.flags.excluded_for_scaling, 'failed_during_background_modelling': dials_array_family_flex_ext.reflection_table.flags.failed_during_background_modelling, 'failed_during_profile_fitting': dials_array_family_flex_ext.reflection_table.flags.failed_during_profile_fitting, 'failed_during_summation': dials_array_family_flex_ext.reflection_table.flags.failed_during_summation, 'foreground_includes_bad_pixels': dials_array_family_flex_ext.reflection_table.flags.foreground_includes_bad_pixels, 'in_powder_ring': dials_array_family_flex_ext.reflection_table.flags.in_powder_ring, 'includes_bad_pixels': dials_array_family_flex_ext.reflection_table.flags.includes_bad_pixels, 'indexed': dials_array_family_flex_ext.reflection_table.flags.indexed, 'integrated': dials_array_family_flex_ext.reflection_table.flags.integrated, 'integrated_prf': dials_array_family_flex_ext.reflection_table.flags.integrated_prf, 'integrated_sum': dials_array_family_flex_ext.reflection_table.flags.integrated_sum, 'not_suitable_for_refinement': dials_array_family_flex_ext.reflection_table.flags.not_suitable_for_refinement, 'observed': dials_array_family_flex_ext.reflection_table.flags.observed, 'outlier_in_scaling': dials_array_family_flex_ext.reflection_table.flags.outlier_in_scaling, 'overlapped_bg': dials_array_family_flex_ext.reflection_table.flags.overlapped_bg, 'overlapped_fg': dials_array_family_flex_ext.reflection_table.flags.overlapped_fg, 'overloaded': dials_array_family_flex_ext.reflection_table.flags.overloaded, 'predicted': dials_array_family_flex_ext.reflection_table.flags.predicted, 'reference_spot': dials_array_family_flex_ext.reflection_table.flags.reference_spot, 'scaled': dials_array_family_flex_ext.reflection_table.flags.scaled, 'strong': dials_array_family_flex_ext.reflection_table.flags.strong, 'used_in_modelling': dials_array_family_flex_ext.reflection_table.flags.used_in_modelling, 'used_in_refinement': dials_array_family_flex_ext.reflection_table.flags.used_in_refinement, 'user_excluded_in_scaling': dials_array_family_flex_ext.reflection_table.flags.user_excluded_in_scaling}¶
- not_suitable_for_refinement = dials_array_family_flex_ext.reflection_table.flags.not_suitable_for_refinement¶
- numerator¶
the numerator of a rational number in lowest terms
- observed = dials_array_family_flex_ext.reflection_table.flags.observed¶
- outlier_in_scaling = dials_array_family_flex_ext.reflection_table.flags.outlier_in_scaling¶
- overlapped_bg = dials_array_family_flex_ext.reflection_table.flags.overlapped_bg¶
- overlapped_fg = dials_array_family_flex_ext.reflection_table.flags.overlapped_fg¶
- overloaded = dials_array_family_flex_ext.reflection_table.flags.overloaded¶
- predicted = dials_array_family_flex_ext.reflection_table.flags.predicted¶
- real¶
the real part of a complex number
- reference_spot = dials_array_family_flex_ext.reflection_table.flags.reference_spot¶
- scaled = dials_array_family_flex_ext.reflection_table.flags.scaled¶
- strong = dials_array_family_flex_ext.reflection_table.flags.strong¶
- to_bytes(length=1, byteorder='big', *, signed=False)¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- used_in_modelling = dials_array_family_flex_ext.reflection_table.flags.used_in_modelling¶
- used_in_refinement = dials_array_family_flex_ext.reflection_table.flags.used_in_refinement¶
- user_excluded_in_scaling = dials_array_family_flex_ext.reflection_table.flags.user_excluded_in_scaling¶
- values = {1: dials_array_family_flex_ext.reflection_table.flags.predicted, 2: dials_array_family_flex_ext.reflection_table.flags.observed, 4: dials_array_family_flex_ext.reflection_table.flags.indexed, 8: dials_array_family_flex_ext.reflection_table.flags.used_in_refinement, 32: dials_array_family_flex_ext.reflection_table.flags.strong, 64: dials_array_family_flex_ext.reflection_table.flags.reference_spot, 128: dials_array_family_flex_ext.reflection_table.flags.dont_integrate, 256: dials_array_family_flex_ext.reflection_table.flags.integrated_sum, 512: dials_array_family_flex_ext.reflection_table.flags.integrated_prf, 768: dials_array_family_flex_ext.reflection_table.flags.integrated, 1024: dials_array_family_flex_ext.reflection_table.flags.overloaded, 2048: dials_array_family_flex_ext.reflection_table.flags.overlapped_bg, 4096: dials_array_family_flex_ext.reflection_table.flags.overlapped_fg, 8192: dials_array_family_flex_ext.reflection_table.flags.in_powder_ring, 16384: dials_array_family_flex_ext.reflection_table.flags.foreground_includes_bad_pixels, 32768: dials_array_family_flex_ext.reflection_table.flags.background_includes_bad_pixels, 49152: dials_array_family_flex_ext.reflection_table.flags.includes_bad_pixels, 64512: dials_array_family_flex_ext.reflection_table.flags.bad_spot, 65536: dials_array_family_flex_ext.reflection_table.flags.used_in_modelling, 131072: dials_array_family_flex_ext.reflection_table.flags.centroid_outlier, 262144: dials_array_family_flex_ext.reflection_table.flags.failed_during_background_modelling, 524288: dials_array_family_flex_ext.reflection_table.flags.failed_during_summation, 1048576: dials_array_family_flex_ext.reflection_table.flags.failed_during_profile_fitting, 2097152: dials_array_family_flex_ext.reflection_table.flags.bad_reference, 4194304: dials_array_family_flex_ext.reflection_table.flags.user_excluded_in_scaling, 8388608: dials_array_family_flex_ext.reflection_table.flags.outlier_in_scaling, 16777216: dials_array_family_flex_ext.reflection_table.flags.excluded_for_scaling, 29360128: dials_array_family_flex_ext.reflection_table.flags.bad_for_scaling, 33554432: dials_array_family_flex_ext.reflection_table.flags.excluded_for_refinement, 67108864: dials_array_family_flex_ext.reflection_table.flags.scaled, 134217728: dials_array_family_flex_ext.reflection_table.flags.not_suitable_for_refinement, 167903232: dials_array_family_flex_ext.reflection_table.flags.bad_for_refinement}¶
- static from_file(filename)¶
Read the reflection table from either pickle or msgpack
- classmethod from_hdf5(filename)¶
- static from_msgpack((object)arg1) reflection_table¶
- static from_msgpack_file(filename)¶
Read the reflection table from file in msgpack format
- static from_observations(experiments, params=None, is_stills=False)¶
Construct a reflection table from observations.
- Parameters:
experiments – The experiments
params – The input parameters
is_stills – [ADVANCED] Force still-handling of experiment ID remapping for dials.stills_process. Do not use for general processing unless you know all the implications.
- Returns:
The reflection table of observations
- static from_pickle(filename)¶
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)¶
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)¶
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(key, default=None)¶
Get item from object for given key (ex: reflection_table column).
Returns default value if not found.
- get_flags((reflection_table)arg1, (object)value[, (object)all=True]) scitbx_array_family_flex_ext.bool¶
- is_overloaded(experiments)¶
Check if the shoebox contains overloaded pixels.
- Parameters:
experiments – The experiment list
- Returns:
True/False overloaded for each reflection
- iterate_experiments_and_indices(experiments)¶
A helper function to iterate through experiments and indices of reflections for each experiment
- map_centroids_to_reciprocal_space(experiments, calculated=False, crystal_frame=False)¶
Map mm/radian spot centroids to reciprocal space.
Used to convert spot centroids provided in mm/radian units to reciprocal space as required for indexing. Adds the column ‘rlp’ to the reflection table, which contains a
flex.vec3_doublearray of the reciprocal lattice vectors.- Parameters:
experiments (dxtbx.model.ExperimentList) – A list of experiments.
calculated (Bool) – use calculated positions.
crystal_frame (Bool) – return x, y, z positions as divided by U matrix
- match(other: reflection_table, *, max_separation: int = 2, key: str = 'xyzobs.px.value', scale: tuple[float, float, float] = (1, 1, 1)) tuple[int, int, double]¶
Match reflections from this reflection list to another (reference) list
The match is based on comparison of any chosen 3-vector column.
- Parameters:
other – The reflection table to match against
max_separations – Maximum distance in column-space to match on
key – Name of 3-vector column
scale – Relative scales to apply to vectors before matching in case e.g. very wide or very fine slicing.
- Returns:
- self_index: is the reindex in the this reflection table
other_index: is the index in the other reflection table distance: The calculated distance of specified column-vector
such that self[self_index][j] ~= other[other_index][j].
- Return type:
(self_index, other_index, distance) where
- match_by_hkle(other: reflection_table) tuple[size_t, size_t]¶
Match reflections with another set of reflections by the h, k, l and entering values. Uses pandas dataframe merge method to match the columns: assumes the key h, k, l, e is unique which is false if > 360 degree rotation.
- Parameters:
other – reflection table to match against
- Returns:
Indices in self, indices in other for matches
- match_with_reference(other)¶
Match reflections with another set of reflections.
- Parameters:
other – The reflection table to match against
- Returns:
The matches
- static plot(table, detector, key)¶
Plot a reflection table using matplotlib
- Parameters:
table – The reflection table
detector – The detector model
key – The key to plot
- random_split(n=2)¶
Randomly split table into n tables.
Not all tables will be the same length.
- remove_on_experiment_identifiers(list_of_identifiers)¶
Remove datasets from the table, given a list of experiment identifiers (strings).
- reset_ids()¶
Reset the ‘id’ column such that the experiment identifiers are numbered 0 .. n-1.
- select((reflection_table)arg1, (scitbx_array_family_flex_ext.size_t)arg2) reflection_table¶
select( (reflection_table)arg1, (scitbx_array_family_flex_ext.bool)arg2) -> reflection_table
select( (reflection_table)arg1, (scitbx_array_family_flex_ext.std_string)arg2) -> reflection_table
select( (reflection_table)arg1, (tuple)arg2) -> reflection_table
select( (reflection_table)arg1, (scitbx_array_family_flex_ext.size_t)arg2) -> reflection_table
select( (reflection_table)arg1, (scitbx_array_family_flex_ext.bool)arg2) -> reflection_table
select( (reflection_table)arg1, (scitbx_array_family_flex_ext.std_string)arg2) -> reflection_table
select( (reflection_table)arg1, (tuple)arg2) -> reflection_table
select( (reflection_table)arg1, (dxtbx_model_ext.Experiment)arg2) -> reflection_table
select( (reflection_table)arg1, (dxtbx_model_ext.ExperimentList)arg2) -> reflection_table
- select_on_experiment_identifiers(list_of_identifiers)¶
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, (scitbx_array_family_flex_ext.bool)arg2, (object)arg3) None¶
set_flags( (reflection_table)arg1, (scitbx_array_family_flex_ext.size_t)arg2, (object)arg3) -> None
- set_selected((reflection_table)arg1, (scitbx_array_family_flex_ext.size_t)arg2, (reflection_table)arg3) None¶
set_selected( (reflection_table)arg1, (scitbx_array_family_flex_ext.bool)arg2, (reflection_table)arg3) -> None
set_selected( (reflection_table)arg1, (scitbx_array_family_flex_ext.std_string)arg2, (reflection_table)arg3) -> None
set_selected( (reflection_table)arg1, (tuple)arg2, (reflection_table)arg3) -> None
- sort(name, reverse=False, order=None)¶
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_partial_indices((reflection_table)arg1) scitbx_array_family_flex_ext.size_t¶
- subsort(key0, key1, reverse=False)¶
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




