mxcubecore.HardwareObjects.SampleView#

Classes

Grid(mpos_list, screen_coord)

Line(mpos_list, screen_coord)

Point(mpos_list, screen_coord)

SampleView(name)

Shape([mpos_list, screen_coord])

Base class for shapes.

TwoDPoint(mpos_list, screen_coord)

class mxcubecore.HardwareObjects.SampleView.Grid(mpos_list, screen_coord)[source]#

Bases: Shape

class mxcubecore.HardwareObjects.SampleView.Line(mpos_list, screen_coord)[source]#

Bases: Shape

get_centred_positions()[source]#
Returns:

The centred position(s) associated with the shape.

Return type:

List of CentredPosition objects.

class mxcubecore.HardwareObjects.SampleView.Point(mpos_list, screen_coord)[source]#

Bases: Shape

class mxcubecore.HardwareObjects.SampleView.SampleView(name)[source]#

Bases: AbstractSampleView

add_shape(shape)[source]#

Add the shape <shape> to the dictionary of handled shapes.

Parameters:
  • param (shape) – Shape to add.

  • type (shape) – Shape object.

add_shape_from_mpos(mpos_list, screen_coord, t)[source]#

Adds a shape of type <t>, with motor positions from mpos_list and screen position screen_coord.

Parameters:
  • mpos_list (list[mpos_list]) – List of motor positions

  • screen_coord (tuple(x, y) – Screen cordinate for shape

  • t (str) – Type str for shape, P (Point), L (Line), G (Grid)

Returns:

(Shape) Shape of type <t>

add_shape_from_refs(refs, t)[source]#

Adds a shape of type <t>, taking motor positions and screen positions from reference points in refs.

Parameters:
  • refs (list[str]) – List of id’s of the refrence Points

  • t (str) – Type str for shape, P (Point), L (Line), G (Grid)

Returns:

Shape of type <t>

Return type:

(Shape)

cancel_centring()[source]#

Cancels current centring procedure

clear_all()[source]#

Clear the shapes, remove all contents.

de_select_all()[source]#

De select all shapes.

de_select_shape(sid)[source]#

De-select the shape with id <sid>.

Parameters:

sid (str) – The id of the shape to de-select.

delete_shape(sid)[source]#

Removes the shape with id <sid> from the list of handled shapes.

Parameters:

sid (str) – The id of the shape to remove

Returns:

The removed shape

Return type:

(Shape)

get_grid()[source]#

Get the first of the selected grids, (the one that was selected first in a sequence of select operations)

Returns:

The first selected grid as a dictionary

Return type:

(dict)

get_grids()[source]#

Get all Grids currently handled.

Returns:

(list[Grid]) All lines currently handled

get_lines()[source]#

Get all Lines currently handled.

Returns:

(list[Line]) All lines currently handled

get_points()[source]#

Get all Points currently handled.

Returns:

(list[Point]) All points currently handled

get_selected_shapes()[source]#

Get all selected shapes.

Returns:

(list[Shape]) List fot selected Shapes

get_shape(sid)[source]#

Get Shape with id <sid>.

Parameters:

sid (str) – id of Shape to retrieve

Returns:

(Shape) All the shapes

get_shapes()[source]#

Get all Shapes.

Returns:

(list[Shape]) All the shapes

get_snapshot(overlay=True, bw=False, return_as_array=False)[source]#

Get snapshot(s) :param overlay: Display shapes and other items on the snapshot :type overlay: bool :param bw: return grayscale image :type bw: bool :param return_as_array: return as np array :type return_as_array: bool

inc_used_for_collection(cpos)[source]#

Increase counter that keepts on collect made on this shape, shape with associated CenteredPosition cpos

Parameters:

cpos (CenteredPosition) – CenteredPosition of shape

init()[source]#

Hardware object init.

is_selected(sid)[source]#

Check if Shape with <sid> is selected.

Returns:

(Boolean) True if Shape with <sid> is selected False otherwise

save_snapshot(path, overlay=True, bw=False)[source]#

Save a snapshot to file. :param path: The filename. :type path: str :param overlay: Display shapes and other items on the snapshot :type overlay: bool :param bw: return grayscale image :type bw: bool

select_shape(sid)[source]#

Select the shape <shape>.

Parameters:

sid (str) – Id of the shape to select.

select_shape_with_cpos(cpos)[source]#

Selects shape with the assocaitaed centerd posotion <cpos>

Parameters:

cpos (CenteredPosition) –

set_grid_data(sid, result_data, data_file_path)[source]#

Sets grid rsult data for a shape with the specified id.

Parameters:
  • sid (str) – The id of the shape to set grid data for.

  • result_data – The result data to set for the shape. Either a base64 encoded string for PNG/image

  • RGB (or a dictionary for) –

  • data_file_path (str) – The path to the data file associated with the result data.

Returns:

None

Raises:

AttributeError – If no shape with the specified id exists.

property shapes#

Get shapes dict. :returns: Shapes hardware object. :rtype: (AbstractShapes)

start_auto_centring()[source]#

Start automatic centring procedure

start_centring(tree_click=True)[source]#

Starts centring procedure

class mxcubecore.HardwareObjects.SampleView.Shape(mpos_list=[], screen_coord=(-1, -1))[source]#

Bases: object

Base class for shapes.

get_centred_positions()[source]#
Returns:

The centred position(s) associated with the shape.

Return type:

List of CentredPosition objects.

class mxcubecore.HardwareObjects.SampleView.TwoDPoint(mpos_list, screen_coord)[source]#

Bases: Point