mxcubecore.model.queue_model_objects#

This module contain objects that combined make up the data model. Any object that inherhits from TaskNode can be added to and handled by the QueueModel.

Functions

addXrayCentring(parent_node, ...)

Add Xray centring to queue.

create_interleave_sw(interleave_list, ...)

Creates subwedges for interleved collection.

create_inverse_beam_sw(num_images, sw_size, ...)

Creates subwedges for inverse beam, and interleves the result.

create_subwedges(total_num_images, sw_size, ...)

Creates n subwedges where n = total_num_images / subwedge_size.

to_collect_dict(data_collection, session, sample)

return [{'comment': '', 'helical': 0, 'motors': {}, 'take_video': False, 'take_snapshots': False, 'fileinfo': {'directory': '/data/id14eh4/inhouse/opid144/' + '20120808/RAW_DATA', 'prefix': 'opid144', 'run_number': 1, 'process_directory': '/data/id14eh4/inhouse/' + 'opid144/20120808/PROCESSED_DATA'}, 'in_queue': 0, 'detector_binning_mode': 2, 'shutterless': 0, 'sessionId': 32368, 'do_inducedraddam': False, 'sample_reference': {}, 'processing': 'False', 'residues': '', 'dark': True, 'scan4d': 0, 'input_files': 1, 'oscillation_sequence': [{'exposure_time': 1.0, 'kappaStart': 0.0, 'phiStart': 0.0, 'start_image_number': 1, 'number_of_images': 1, 'overlap': 0.0, 'start': 0.0, 'range': 1.0, 'number_of_passes': 1}], 'nb_sum_images': 0, 'EDNA_files_dir': '', 'anomalous': 'False', 'file_exists': 0, 'experiment_type': 'SAD', 'skip_images': 0}]

try_parse_int(n)

Classes

Acquisition()

AcquisitionParameters()

Basket()

Class represents a basket in the tree.

CentredPosition([motor_dict])

Class that represents a centred position.

Characterisation([ref_data_collection, ...])

CharacterisationParameters()

Crystal()

DataCollection([acquisition_list, crystal, ...])

DelayTask([delay])

Dummy task, for mock testing only

EnergyScan([sample, path_template, cpos])

EnergyScanResult()

GphlWorkflow()

OpticalCentring([user_confirms])

Optical automatic centering with lucid

PathTemplate()

ProcessingParameters()

RootNode()

Sample()

SampleCentring([name, kappa, kappa_phi, ...])

Manual 3 click centering

TaskGroup()

TaskNode([task_data])

Objects that inherit TaskNode can be added to and handled by the QueueModel object.

Workflow()

XRFSpectrum([sample, path_template, cpos])

Class represents XRF spectrum task

XRFSpectrumResult()

XrayCentering([ref_data_collection, crystal])

XrayCentring2([name, motor_positions, grid_size])

X-ray centring (2022 version)

XrayImaging(xray_imaging_params[, ...])

XrayImagingParameters()

class mxcubecore.model.queue_model_objects.Basket[source]#

Bases: TaskNode

Class represents a basket in the tree. It has not task assigned. It represents a parent for samples with the same basket id.

class mxcubecore.model.queue_model_objects.CentredPosition(motor_dict=None)[source]#

Bases: object

Class that represents a centred position. Can also be initialized with a mxcube motor dict which simply is a dictonary with the motornames and their corresponding values.

class mxcubecore.model.queue_model_objects.Characterisation(ref_data_collection=None, characterisation_parameters=None, name='')[source]#

Bases: TaskNode

get_display_name()[source]#

Descript. : Returns display name of the collection Args. : Return : display_name (string)

get_point_index()[source]#

Descript. : Returns point index associated to the data collection Args. : Return : index (integer)

class mxcubecore.model.queue_model_objects.DataCollection(acquisition_list=None, crystal=None, processing_parameters=None, name='', task_data=None)[source]#

Bases: TaskNode

get_display_name()[source]#

Descript. : Returns display name depending from collection type Args. : Return : display_name (string)

get_helical_point_index()[source]#

Descript. : Return indexes of points associated to the helical line Args. : Return : index (integer), index (integer)

get_point_index()[source]#

Descript. : Returns point index associated to the data collection Args. : Return : index (integer)

set_grid_id(grid_id)[source]#

Descript. : Sets grid id associated to the data collection Args. : grid_id (integer) Return :

class mxcubecore.model.queue_model_objects.DelayTask(delay=10)[source]#

Bases: TaskNode

Dummy task, for mock testing only

class mxcubecore.model.queue_model_objects.EnergyScan(sample=None, path_template=None, cpos=None)[source]#

Bases: TaskNode

class mxcubecore.model.queue_model_objects.GphlWorkflow[source]#

Bases: TaskNode

calc_maximum_dose(energy=None, exposure_time=None, image_width=None)[source]#

Dose at transmission=100 for given energy, exposure time and image width

The strategy length is taken from self.strategy_length

Parameters:
  • Optional[float] (image_width) – Energy in keV; defaults to self.energy

  • Optional[float] – Value in s; defaults to self.exposure_time

  • Optional[float] – VAlue in deg; defaults to self.image_width

Returns:

Maximum dose in MGy

Return type:

float

init_from_task_data(sample_model, params)[source]#

sample_model is required as this may be called before the object is enqueued params is a dictionary with structure determined by mxcubeweb usage

parameter_summary()[source]#

Main parameter summary, for output purposes

recommended_dose_budget(resolution=None)[source]#

Get resolution-dependent dose budget using current configuration

Parameters:

(float) (resolution) – Target resolution (in A), defauls to current setting

Returns:

set_name(value)[source]#

Sets the name.

Parameters:

name (str) – The new name.

Returns:

none

set_pre_acquisition_params(exposure_time=None, image_width=None, wedge_width=None, transmission=None, repetition_count=None, snapshot_count=None, recentring_mode=None, energies=(), skip_collection=False, **unused)[source]#
Parameters:
  • exposure_time

  • image_width

  • wedge_width

  • transmission

  • repetition_count

  • snapshot_count

  • recentring_mode

  • energies

  • skip_collection

  • **unused

Returns:

set_pre_strategy_params(space_group='', crystal_classes=(), cell_parameters=(), resolution=None, energies=(), strategy='', strategy_options=None, init_spot_dir=None, relative_rad_sensitivity=None, use_cell_for_processing=None, **unused)[source]#
Parameters:
  • (str) (init_spot_dir) –

  • (tuple(str)) (crystal_classes) –

  • tuple(float) (energies) –

  • (Optional[float]) (resolution) –

  • tuple(float)

  • (str)

  • (dict) (unused) –

  • (str)

  • (float) (relative_rad_sensitivity) –

  • (bool) (use_cell_for_processing) –

  • (dict)

Return (None):

property strategy_name#

“Strategy full name, e.g. “Two-wavelength MAD”

property strategy_type#

(“native”, “phasing”, “diffractcal”, “transcal”

Type:

“Workflow type

property total_strategy_length#

Total strategy length for a single repetition (but counting all wavelengths)

property wfname#

“Workflow full name, e.g. “GΦL Diffractometer calibration”

property wftype#

(“acquisition”, “diffractcal”, “transcal”

Type:

“Workflow type

class mxcubecore.model.queue_model_objects.OpticalCentring(user_confirms=False)[source]#

Bases: TaskNode

Optical automatic centering with lucid

class mxcubecore.model.queue_model_objects.RootNode[source]#

Bases: TaskNode

class mxcubecore.model.queue_model_objects.Sample[source]#

Bases: TaskNode

class mxcubecore.model.queue_model_objects.SampleCentring(name=None, kappa=None, kappa_phi=None, motor_positions=None)[source]#

Bases: TaskNode

Manual 3 click centering

kappa and kappa_phi settings are applied first, and assume that the beamline does have axes with exactly these names

Other motor_positions are applied afterwards, but in random order. motor_positions override kappa and kappa_phi if both are set

Since setting one motor can change the position of another (on ESRF ID30B setting kappa and kappa_phi changes the translation motors)

the order is important.

class mxcubecore.model.queue_model_objects.TaskGroup[source]#

Bases: TaskNode

class mxcubecore.model.queue_model_objects.TaskNode(task_data=None)[source]#

Bases: object

Objects that inherit TaskNode can be added to and handled by the QueueModel object.

get_children()[source]#
Returns:

The children of this node.

Return type:

List of TaskNode objects.

get_origin()[source]#
Returns:

The node id that is the origin of this node.

Return type:

int

get_parent()[source]#
Returns:

The parent of this node.

Return type:

TaskNode

get_sample_node()[source]#

get Sample task node that this entry is executed on

is_enabled()[source]#
Returns:

True if enabled and False if disabled

set_enabled(state)[source]#

Sets the enabled state, True represents enabled (executable) and false disabled (not executable).

Parameters:

state (bool) – The state, True or False

set_name(name)[source]#

Sets the name.

Parameters:

name (str) – The new name.

Returns:

none

set_number(number)[source]#

Sets the number of this node. The number can be used to give the task a unique number when for instance, the name is not unique for this node.

Parameters:

number (int) – number

set_origin(node_id)[source]#

Sets the origin of this node, the node id of the node, if any, that somehow generated this node.

Parameters:

name (The node id that is the origin of this node) – node_id

Returns:

none

class mxcubecore.model.queue_model_objects.Workflow[source]#

Bases: TaskNode

class mxcubecore.model.queue_model_objects.XRFSpectrum(sample=None, path_template=None, cpos=None)[source]#

Bases: TaskNode

Class represents XRF spectrum task

class mxcubecore.model.queue_model_objects.XrayCentering(ref_data_collection=None, crystal=None)[source]#

Bases: TaskNode

class mxcubecore.model.queue_model_objects.XrayCentring2(name=None, motor_positions=None, grid_size=None)[source]#

Bases: TaskNode

X-ray centring (2022 version)

Contains all parameters necessary for X-ray centring This object is passed to the QueueEntry and HardwareObject Parameters not defined here must be set as defaults, somehow (transmission, grid step, …)

init_from_task_data(sample_model, params)[source]#

Set parameters from task input dictionary.

sample_model is required as this may be called before the object is enqueued params is a dictionary with structure determined by mxcubeweb usage

class mxcubecore.model.queue_model_objects.XrayImaging(xray_imaging_params, acquisition=None, crystal=None, name='')[source]#

Bases: TaskNode

mxcubecore.model.queue_model_objects.addXrayCentring(parent_node, **centring_parameters)[source]#

Add Xray centring to queue.

mxcubecore.model.queue_model_objects.create_interleave_sw(interleave_list, num_images, sw_size)[source]#

Creates subwedges for interleved collection. Wedges W1, W2, Wm (where m is num_collections) are created: (W1_1, W2_1, …, W1_m), … (W1_n-1, W2_n-1, …, Wm_n-1), (W1_n, W2_n, …, Wm_n)

Parameters:
  • interleave_list (list of dict) – list of interleaved items

  • num_images – number of images of first collection. Based on the

first collection certain number of subwedges will be created. If first collection contains more images than others then in the end the rest of images from first collections are created as last subwedge :type num_images: int

Parameters:

sw_size (int) – Number of images in each subwedge

Returns:

A list of tuples containing the swb wedges. The tuples are in the form: (collection_index, subwedge_index, subwedge_firt_image,

subwedge_start_osc)

Return type:

List [(…), (…)]

mxcubecore.model.queue_model_objects.create_inverse_beam_sw(num_images, sw_size, osc_range, osc_start, run_number)[source]#

Creates subwedges for inverse beam, and interleves the result. Wedges W1 and W2 are created 180 degres apart, the result is interleaved and given on the form: (W1_1, W2_1), … (W1_n-1, W2_n-1), (W1_n, W2_n)

Parameters:
  • num_images (int) – The total number of images

  • sw_size (int) – Number of images in each subwedge

  • osc_range (double) – Oscillation range for each image

  • osc_start (double) – The start angle/offset of the oscillation

  • run_number – Run number for the first wedge (W1), the run number of the second wedge will be run_number + 1.

Returns:

A list of tuples containing the swb wedges. The tuples are on the form: (start_image, num_images, osc_start, run_number)

Return type:

List [(…), (…)]

mxcubecore.model.queue_model_objects.create_subwedges(total_num_images, sw_size, osc_range, osc_start)[source]#

Creates n subwedges where n = total_num_images / subwedge_size.

Parameters:
  • total_num_images (int) – The total number of images

  • osc_range (double) – Oscillation range for each image

  • osc_start (double) – The start angle/offset of the oscillation

Returns:

List of tuples with the format: (start image number, number of images, oscilation start)

mxcubecore.model.queue_model_objects.to_collect_dict(data_collection, session, sample, centred_pos=None)[source]#

return [{‘comment’: ‘’, ‘helical’: 0, ‘motors’: {}, ‘take_video’: False, ‘take_snapshots’: False, ‘fileinfo’: {‘directory’: ‘/data/id14eh4/inhouse/opid144/’ + ‘20120808/RAW_DATA’,

‘prefix’: ‘opid144’, ‘run_number’: 1, ‘process_directory’: ‘/data/id14eh4/inhouse/’ + ‘opid144/20120808/PROCESSED_DATA’},

‘in_queue’: 0, ‘detector_binning_mode’: 2, ‘shutterless’: 0, ‘sessionId’: 32368, ‘do_inducedraddam’: False, ‘sample_reference’: {}, ‘processing’: ‘False’, ‘residues’: ‘’, ‘dark’: True, ‘scan4d’: 0, ‘input_files’: 1, ‘oscillation_sequence’: [{‘exposure_time’: 1.0,

‘kappaStart’: 0.0, ‘phiStart’: 0.0, ‘start_image_number’: 1, ‘number_of_images’: 1, ‘overlap’: 0.0, ‘start’: 0.0, ‘range’: 1.0, ‘number_of_passes’: 1}],

‘nb_sum_images’: 0, ‘EDNA_files_dir’: ‘’, ‘anomalous’: ‘False’, ‘file_exists’: 0, ‘experiment_type’: ‘SAD’, ‘skip_images’: 0}]