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

Util

class dials.util.command_line.Command[source]

Bases: object

Class to nicely print out a command with timing info.

classmethod end(string)[source]

Print the ‘end of command’ string.

indent = 0
max_length = 80
print_time = True
classmethod start(string)[source]

Print the ‘start command’ string.

class dials.util.command_line.ProgressBar(title=None, spinner=True, bar=True, estimate_time=True, indent=0, length=80)[source]

A command line progress bar.

finished(string=None)[source]

The progress bar is finished.

update(fpercent)[source]

Update the progress bar with a percentage.

class dials.util.command_line.ProgressBarTimer[source]

A simple timer for the progress bar.

get_elapsed_time()[source]
update(percent)[source]

Update the timer.

dials.util.command_line.coloured(text, *args, **kwargs)[source]
dials.util.command_line.heading(text)[source]
dials.util.command_line.parse_range_list_string(string)[source]

Parse a string in the following ways: string: 1, 2, 3 -> [1, 2, 3] string: 1 - 6 -> [1, 2, 3, 4, 5, 6] string: 1 - 6, 7, 8, 9 -> [1, 2, 3, 4, 5, 6, 7, 8, 9]

dials.util.export_mtz.dials_u_to_mosflm(dials_U, uc)[source]

Compute the mosflm U matrix i.e. the U matrix from same UB definition as DIALS, but with Busing & Levy B matrix definition.

dials.util.export_mtz.export_mtz(integrated_data, experiment_list, params)[source]

Export data from integrated_data corresponding to experiment_list to an MTZ file hklout.

dials.util.export_mtz.isclose(a, b, rel_tol=1e-09, abs_tol=0.0)[source]
dials.util.export_text.export_text(integrated_data)[source]

Export contents of a dials reflection table as text.

class dials.util.image.reader[source]

A class to read the CBF files used in DIALS

get_data()[source]

Get the gain array from the file

read_file(filename)[source]

Read the CBF file

Installer script for DIALS, based on automatically generated template. This must be moved to the proper location to work.

class dials.util.installer.installer(args=None, out=<open file '<stdout>', mode 'w'>)[source]

Bases: libtbx.auto_build.install_distribution.installer

base_package_options = ['--dials', '--all']
configure_modules = ['mmtbx', 'smtbx', 'dials', 'cbflib', 'annlib_adaptbx', 'wxtbx', 'gltbx']
dest_dir_prefix = 'dials'
include_gui_packages = True
installer_dir = '/dls/science/groups/scisoft/DIALS/CD/now14/dials-v1-14-32-prerelease-20191210/modules/dials'
make_apps = []
product_name = 'DIALS'
product_specific_finalize_install(log)[source]

Additional installation setup, file cleanup, more add-ons, etc.

remove_sources_default = False
source_packages = ['cctbx_bundle', 'dials', 'cbflib', 'annlib', 'annlib_adaptbx']
dials.util.ioutil.get_inverse_ub_matrix_from_xparm(handle)[source]

Get the inverse_ub_matrix from an xparm file handle

Params:
handle The file handle
Returns:The inverse_ub_matrix
dials.util.ioutil.get_space_group_type_from_xparm(handle)[source]

Get the space group tyoe object from an xparm file handle

Params:
handle The file handle
Returns:The space group type object
dials.util.ioutil.get_ub_matrix_from_xparm(handle)[source]

Get the ub_matrix from an xparm file handle

Params:
handle The file handle
Returns:The ub_matrix
dials.util.ioutil.get_unit_cell_from_xparm(handle)[source]

Get the unit_cell object from an xparm file handle

Params:
handle The file handle
Returns:The unit cell object
dials.util.nexus.dump(experiments, reflections, filename)[source]
dials.util.nexus.get_entry(filename, mode='a')[source]
dials.util.nexus.load(filename)[source]
class dials.util.options.ArgumentHandlingErrorInfo(name, validation, message, traceback, type, exception)

Bases: tuple

exception

Alias for field number 5

message

Alias for field number 2

name

Alias for field number 0

traceback

Alias for field number 3

type

Alias for field number 4

validation

Alias for field number 1

class dials.util.options.ConfigWriter(master_phil)[source]

Bases: object

Class to write configuration to file.

write(params, filename)[source]

Write the configuration to file.

Parameters:
  • params – The input phil parameters
  • filename – The output filename
class dials.util.options.Importer(args, read_datablocks=False, read_experiments=False, read_reflections=False, read_datablocks_from_images=False, check_format=True, verbose=False, compare_beam=None, compare_detector=None, compare_goniometer=None, scan_tolerance=None, format_kwargs=None)[source]

Bases: object

A class to import the command line arguments.

try_read_datablocks(args, check_format, verbose)[source]

Try to import imagesets.

Parameters:
  • args – The input arguments
  • check_format – True/False check the image format
  • verbose – Print verbose output
Returns:

Unhandled arguments

try_read_datablocks_from_images(args, verbose, compare_beam, compare_detector, compare_goniometer, scan_tolerance, format_kwargs)[source]

Try to import images.

Parameters:
  • args – The input arguments
  • verbose – Print verbose output
Returns:

Unhandled arguments

try_read_experiments(args, check_format, verbose)[source]

Try to import experiments.

Parameters:
  • args – The input arguments
  • check_format – True/False check the image format
  • verbose – Print verbose output
Returns:

Unhandled arguments

try_read_reflections(args, verbose)[source]

Try to import reflections.

Parameters:
  • args – The input arguments
  • verbose – Print verbose output
Returns:

Unhandled arguments

class dials.util.options.OptionParser(phil=None, read_datablocks=False, read_experiments=False, read_reflections=False, read_datablocks_from_images=False, check_format=True, sort_options=False, **kwargs)[source]

Bases: dials.util.options.OptionParserBase

A class to parse command line options and get the system configuration. The class extends optparse.OptionParser to include the reading of phil parameters.

diff_phil

Get the diff phil.

Returns:The diff phil scope
format_help(formatter=None)[source]

Format the help string

Parameters:formatter – The formatter to use
Returns:The formatted help text
parse_args(args=None, show_diff_phil=False, return_unhandled=False, ignore_unhandled=False, quick_parse=False)[source]

Parse the command line arguments and get system configuration.

Parameters:
  • args – The input arguments
  • show_diff_phil – True/False Print the diff phil
  • return_unhandled – True/False return unhandled arguments
  • ignore_unhandled – True/False ignore unhandled arguments if return_unhandled is False
  • quick_parse – Return as fast as possible and without reading any data, ignoring class constructor options
Returns:

The options and phil parameters

phil

Get the phil object

Returns:The phil scope
system_phil

Get the system phil.

Returns:The system phil scope
class dials.util.options.OptionParserBase(config_options=False, sort_options=False, **kwargs)[source]

Bases: optparse.OptionParser, object

The base class for the option parser.

format_epilog(formatter)[source]

Don’t do formatting on epilog.

parse_args(args=None, quick_parse=False)[source]

Parse the command line arguments and get system configuration.

Parameters:args – The arguments to parse.
Returns:The options and phil parameters
class dials.util.options.PhilCommandParser(phil=None, read_datablocks=False, read_experiments=False, read_reflections=False, read_datablocks_from_images=False, check_format=True)[source]

Bases: object

A class to parse phil parameters from positional arguments

diff_phil

Get the diff phil.

Returns:The difference phil scope
parse_args(args, verbose=False, return_unhandled=False, quick_parse=False)[source]

Parse the command line arguments.

Parameters:
  • args – The input arguments
  • verbose – Print verbose output
  • return_unhandled – True/False also return unhandled arguments
  • quick_parse – Return as fast as possible and without reading any data, ignoring class constructor options.
Returns:

The options and parameters and (optionally) unhandled arguments

phil

Get the phil object

Returns:The phil scope
system_phil

Get the system phil.

Returns:The system phil scope
dials.util.options.flatten_datablocks(filename_object_list)[source]

Flatten a list of datablocks

Parameters:filename_object_list – The parameter item
Returns:The flattened list of datablocks
dials.util.options.flatten_experiments(filename_object_list)[source]

Flatten a list of experiment lists

Parameters:filename_object_list – The parameter item
Returns:The flattened experiment lists
dials.util.options.flatten_reflections(filename_object_list)[source]

Flatten a list of reflections tables

Parameters:filename_object_list – The parameter item
Returns:The flattened reflection table