dxtbx.datablock

class dxtbx.datablock.AutoEncoder(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None)[source]

Bases: json.encoder.JSONEncoder

default(obj)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
class dxtbx.datablock.BeamComparison(wavelength_tolerance=1e-06, direction_tolerance=1e-06, polarization_normal_tolerance=1e-06, polarization_fraction_tolerance=1e-06)[source]

Bases: object

A class to provide simple beam comparison

class dxtbx.datablock.BeamDiff(wavelength_tolerance=1e-06, direction_tolerance=1e-06, polarization_normal_tolerance=1e-06, polarization_fraction_tolerance=1e-06)[source]

Bases: object

A class to provide simple beam comparison

class dxtbx.datablock.DataBlock(imagesets)[source]

Bases: object

High level container for blocks of sweeps and imagesets.

append(imageset)[source]

Add an imageset to the block.

extend(datablock)[source]

Add two datablocks.

extract_imagesets()[source]

Extract all imagesets.

extract_stills()[source]

Extract all the still imagesets

extract_sweeps()[source]

Extract all the sweeps from the block.

format_class()[source]

Return the format class.

iter_stills()[source]

Iterate over still groups.

iter_sweeps()[source]

Iterate over sweep groups.

num_images()[source]

Get the number of images.

to_dict()[source]

Convert the datablock to a dictionary

unique_beams()[source]

Iterate through unique beams.

unique_detectors()[source]

Returns a list of detector objects.

unique_goniometers()[source]

Iterate through unique goniometers.

unique_scans()[source]

Iterate through unique scans.

class dxtbx.datablock.DataBlockDictImporter(obj, check_format=True, directory=None)[source]

Bases: object

A class to import a datablock from dictionary.

class dxtbx.datablock.DataBlockDumper(datablocks)[source]

Bases: object

Class to help in dumping datablock objects.

as_file(filename, **kwargs)[source]

Dump datablocks as file.

as_json(filename=None, compact=False)[source]

Dump datablock as json.

as_pickle(filename=None, **kwargs)[source]

Dump datablock as pickle.

class dxtbx.datablock.DataBlockFactory[source]

Bases: object

Class for creating DataBlock instances

static from_args(args, verbose=False, unhandled=None, compare_beam=None, compare_detector=None, compare_goniometer=None, scan_tolerance=None, format_kwargs=None)[source]

Try to load datablocks from any recognized format.

static from_dict(obj, check_format=True, directory=None)[source]

Create a datablock from a dictionary.

static from_filenames(filenames, verbose=False, unhandled=None, compare_beam=None, compare_detector=None, compare_goniometer=None, scan_tolerance=None, format_kwargs=None)[source]

Create a list of data blocks from a list of directory or file names.

static from_imageset(imagesets)[source]

Load a datablock from an imageset of list of imagesets.

static from_imageset_json_file(filename)[source]

Load a datablock from a sweep file.

static from_in_memory(images, indices=None)[source]

Function to instantiate data block from in memory imageset.

static from_json(string, check_format=True, directory=None)[source]

Decode a datablock from JSON string.

static from_json_file(filename, check_format=True)[source]

Decode a datablock from a JSON file.

static from_pickle_file(filename)[source]

Decode a datablock from a pickle file.

static from_serialized_format(filename, check_format=True)[source]

Load a datablock from serialized formats.

class dxtbx.datablock.DataBlockFilenameImporter(filenames, verbose=False, compare_beam=None, compare_detector=None, compare_goniometer=None, scan_tolerance=None, format_kwargs=None)[source]

Bases: object

A class to import a datablock from image files.

class dxtbx.datablock.DataBlockImageSetImporter(imagesets)[source]

Bases: object

A class to import a datablock from imagesets.

class dxtbx.datablock.DataBlockTemplateImporter(templates, verbose=False, **kwargs)[source]

Bases: object

A class to import a datablock from a template.

class dxtbx.datablock.DetectorComparison(fast_axis_tolerance=1e-06, slow_axis_tolerance=1e-06, origin_tolerance=1e-06)[source]

Bases: object

A class to provide simple detector comparison

class dxtbx.datablock.DetectorDiff(fast_axis_tolerance=1e-06, slow_axis_tolerance=1e-06, origin_tolerance=1e-06)[source]

Bases: object

A class to provide simple detector comparison

class dxtbx.datablock.FormatChecker(verbose=False)[source]

Bases: object

A helper class to find the image format by first checking the last format that was used.

check_child_formats(filename)[source]

If a child format understands the file better than return that, otherwise return the current format.

find_format(filename)[source]

Check the current and child formats, otherwise search the registry.

iter_groups(filenames)[source]
understand(filename)[source]

Check if the data block format understands the given file. This function checks the method resolution order for the format class and calls the understand methods of each parent down to the bottom level. Just calling the format class understand method directly can result in problems. This is really a workaround for a bug in the way that the format understand method works. Furthermore, the FormatStill class does not have an understand method so we have to check that the “understand” method is present in the class dictionary before we actually do the call.

class dxtbx.datablock.GoniometerComparison(rotation_axis_tolerance=1e-06, fixed_rotation_tolerance=1e-06, setting_rotation_tolerance=1e-06)[source]

Bases: object

A class to provide simple goniometer comparison

class dxtbx.datablock.GoniometerDiff(rotation_axis_tolerance=1e-06, fixed_rotation_tolerance=1e-06, setting_rotation_tolerance=1e-06)[source]

Bases: object

A class to provide simple goniometer comparison

exception dxtbx.datablock.InvalidDataBlockError[source]

Bases: exceptions.RuntimeError

Indicates an error whilst validating the experiment list.

This means that there is some structural problem that prevents the given data from representing a well-formed experiment list. This doesn’t indicate e.g. some problem with the data or model consistency.

class dxtbx.datablock.ScanDiff(scan_tolerance=1e-06)[source]

Bases: object

A class to provide scan comparison

class dxtbx.datablock.SweepDiff(tolerance)[source]

Bases: object

dxtbx.datablock.all_approx_equal(a, b, tol)[source]
dxtbx.datablock.all_equal(a, b)[source]