pyvenus package

Submodules

pyvenus.connection module

class pyvenus.connection.Connection(run_environment: str = 'C:\\Program Files (x86)\\HAMILTON\\Bin\\HxRun.exe', start_minimized: bool = False)[source]

Bases: object

Connection class that starts the Venus run environment and takes care of data exchange to python environment

Initialize run environment

Parameters
  • run_environment (str, optional) – Path to the Venus run environment executable. Defaults to r”C:Program Files (x86)HAMILTONBinHxRun.exe”.

  • start_minimized (bool, optional) – Start the window minimized. Defaults to False.

close()[source]

Close connection and shut down run environment

execute(HSLcode: str = '', definitions: str = '') str[source]

Send HSL code and/or variable/object defintions to the Venus environment and execute them

Parameters
  • HSLcode (str, optional) – HSL code to execute. Defaults to “”.

  • definitions (str, optional) – Variable or object definitions. Defaults to “”.

Returns

JSON string with information returned from Venus

Return type

str

pyvenus.data_types module

class pyvenus.data_types.Array(con: Connection, value: list = None, name: str = None)[source]

Bases: list

Replicates functionality of Venus arrays in python. Expands basic list type from python.

Intialize a new array

None as value for the name parameter (default) will generate a unique ID for this array in the Venus environment. By setting a name explicitly the generated HSL code is easier to read/debug.

Parameters
  • con (Connection) – Connection object to Venus environment

  • value (list, optional) – Starting value of the array in the form of a python list. Defaults to None which generates an empty array.

  • name (str, optional) – Name the array should carry in the Venus environment. Defaults to None which will generate a random name.

property name

Get the name of the array in the Venus environment

pull()[source]

Pull current state of the array from the Venus environment

push()[source]

Push current state of the array to the Venus environment

class pyvenus.data_types.Device(con: Connection, layout_file: str, name: str = 'ML_STAR', main: bool = True)[source]

Bases: object

Replicate the functionality of a Venus device object in python

Initialize the device object

Parameters
  • con (Connection) – Connection object to Venus environment

  • layout_file (str) – Path to Venus deck layout file

  • name (str, optional) – Name of the device in Venus (e.g. ML_STAR, HxFan). Defaults to “ML_STAR”.

  • main (bool, optional) – Is this the main device object (e.g. ML_STAR). Set to False for e.g. HxFan. Defaults to True.

property name

Get the name of the device in the Venus environment

class pyvenus.data_types.Liquidclass(name: str, liquid_parameters: dict)[source]

Bases: object

Python class representing a Venus liquid class

Initialize the liquid class

Parameters
  • name (str) – Name of the liquid class in the liquid class database

  • liquid_parameters (dict) – A dictionary containing all the parameters of the liquid class

property liquid_parameters

Get a dictionary with all liquid parameters

property name

Get the name of the liquid class in the liquid class database

class pyvenus.data_types.Sequence(con: Connection, name: str = None, copy: Union[Sequence, str] = None, deck_sequence: bool = False)[source]

Bases: object

Replicates functionality of a Venus sequence in python

Initialize a new sequence

None as value for the name parameter (default) will generate a unique ID for this sequence in the Venus environment. By setting a name explicitly the generated HSL code is easier to read/debug. If deck_sequence is set to True (and copy is None) the sequence is not initiated in the Venus environment (i.e. it already exists) For deck sequences the name parameter is required!

Parameters
  • con (Connection) – Connection object to Venus environment

  • name (str, optional) – Name the sequence should carry in Venus environment. Defaults to None which will generate a random name.

  • copy (Union[Sequence, str], optional) – Either an existing Sequence object or a string referencing an existing Venus sequence (e.g. deck sequence), the content of which will be copied. Defaults to None which generates an empty sequence.

  • deck_sequence (bool, optional) – Is this a reference to a deck sequence?

add(labware: str, position: str, at_index: int = None) Sequence[source]

Add a new item (defined by labware ID and position) to the sequence

If the ad_index parameter is omitted the new item is appended at the end.

Parameters
  • labware (str) – Venus labware ID

  • position (str) – Position on the labware

  • at_index (int, optional) – One-based position index where the item should be added. Defaults to None which will append to the end.

Returns

Returns the updated sequence

Return type

Sequence

clear() Sequence[source]

Remove all items from a sequence

Returns

Returns the updated sequence

Return type

Sequence

property current

Get or set the current position of the sequence (i.e. next available position)

property end

Get or set the end position of the sequence (i.e. the last position to process)

from_dataframe(dataframe: DataFrame, append: bool = False) Sequence[source]

Update the content of the sequence with the information from the dataframe

Parameters
  • dataframe (Pandas.DataFrame) – The dataframe to use for the update. The dataframe needs to contain two columns labelled ‘labware’ and ‘position’

  • append (Optional, bool) – Append to the existing sequence (instead of replacing its content)?

Returns

Returns the updated sequence

Return type

Sequence

from_list(labware: list, positions: list, append: bool = False) Sequence[source]

Update the content of the sequence to the give lists of labware and positions

If the two lists do not have the same length then the shorter one is recycled to the full length.

Parameters
  • labware (list) – List of Venus labware IDs

  • positions (list) – List of position IDs on the specified labware IDs

  • append (Optional, bool) – Append to the existing sequence (instead of replacing its content)?

Returns

Returns the updated the sequence

Return type

Sequence

get_dataframe(include_position_data: bool = False) DataFrame[source]

Returns the current content of the sequence as a pandas dataframe

Parameters

include_position_data (bool, optional) – Include for each item in the sequence the x,y,z deck coordinate and rotational angle? Defaults to False.

property name

Get the name of the sequence in the Venus environment

pull()[source]

Pull the current state of the sequence to the Venus environment

push()[source]

Push the current state of the sequence to the Venus environment

property remaining

Get the remaining positions in the sequence (end - (current - 1))

remove(at_index: int) Sequence[source]

Remove an item from the sequence at the specified index (one-based)

Parameters

at_index (int) – One-based index of the position to remove

Returns

Returns the updated sequence

Return type

Sequence

set_current(current: int) Sequence[source]

Update the current position of the sequence

Parameters

current (int) – New value for current position

Returns

Returns the updated sequence

Return type

Sequence

set_end(end: int) Sequence[source]

Update the end position of the sequence

Parameters

end (int) – New value for end position

Returns

Returns the updated sequence

Return type

Sequence

property total

Get the total number of positions in the sequence (regardless of current and end position)

class pyvenus.data_types.Variable(con: Connection, value: Union[int, float, str] = 0, name: str = None)[source]

Bases: object

Replicates functionality of basic Venus variables (i.e. string, integer, float) in python

Initialize a new variable

None as value for the name parameter (default) will generate a unique ID for this variable in the Venus environment. By setting a name explicitly the generated HSL code is easier to read/debug.

Parameters
  • con (Connection) – Connection object to Venus environment

  • value (Union[int, float, str], optional) – Starting value for variable. Defaults to 0.

  • name (str, optional) – Name the variable should carry in Venus environment. Defaults to None which will generate a random name.

property name

Get the name of the variable in the Venus environment

pull()[source]

Pull the current state of the variable from the Venus environment

push()[source]

Push the current state of the variable to the Venus environment

property value

Get and set the value of the variable

pyvenus.helpers module

class pyvenus.helpers.Helpers[source]

Bases: object

Various helper functions for making the method setup easier

classmethod get_well_map(plate_type: Union[int, str], sorting_mode: str = 'column-by-column', zero_padding: bool = False) list[source]

Generate a list of alphanumeric well IDs for the specified plate type and sorting (e.g. [A1, B2, etc.])

Parameters
  • plate_type (Union[int, str]) – Plate type (6,12,24,48,96,384,1536)

  • sorting_mode (str, optional) – Mode of traversing the plate (‘column-by-column’ or ‘row-by-row’). Defaults to “column-by-column”.

  • zero_padding (bool, optional) – Pad numeric part with a zero (e.g. A1 to A01). Defaults to False.

Returns

List of well IDs

Return type

list

classmethod numeric_to_alphanumeric(well_number: Union[int, str], plate_type: Union[int, str], sorting_mode: str = 'column-by-column', zero_padding: bool = False) str[source]

Convert a well number to a alphanumeric well ID (e.g. 1 to A1 / 96 to H12)

Parameters
  • well_number (Union[int, str]) – Well number to convert

  • plate_type (Union[int, str]) – Plate type (6,12,24,48,96,384,1536)

  • sorting_mode (str, optional) – Mode of traversing the plate (‘column-by-column’ or ‘row-by-row’). Defaults to “column-by-column”.

  • zero_padding (bool, optional) – Pad numeric part with a zero (e.g. A1 to A01). Defaults to False.

Returns

Alphanumeric well ID (e.g. A1)

Return type

str

pyvenus.resources module

class pyvenus.resources.Resources[source]

Bases: object

Static class with functions to generate python classes from Venus resources

classmethod read_layout(layout: str) None[source]

Reads in a Venus layout file (*.lay) and converts it to a python class.

The generated python class is located in /venus_resources/ and will be named the same as original layout file prefixed with __layout__.

Parameters

layout (str) – Relative or absolute path to the layout file

classmethod read_liquid_classes(include_1ml_channels: bool = True, include_5ml_channels: bool = False, include_96head: bool = True, include_384head: bool = False, include_washstations: bool = False, include_default: bool = True, include_custom: bool = True, database: str = 'C:\\Program Files (x86)\\HAMILTON\\Config\\ML_STARLiquids.mdb') None[source]

Reads in the default Venus liquid class database and converts it to a python class.

It is possible to restrict the list of liquid classes to those fitting the system configuration. The generated python class is located at /venus_resources/__liquid_classes__.py

Parameters
  • include_1ml_channels (bool, optional) – Load liquid classes for 1 mL channels. Defaults to True.

  • include_5ml_channels (bool, optional) – Load liquid classes for 5 mL channels. Defaults to False.

  • include_96head (bool, optional) – Load liquid classes for the 96 multiprobe head. Defaults to True.

  • include_384head (bool, optional) – Load liquid classes for the 384 multiprobe head. Defaults to False.

  • include_washstations (bool, optional) – Load liquid classes for the wash stations. Defaults to False.

  • include_default (bool, optional) – Load default liquid classes (all LCs that ship with Venus). Defaults to True.

  • include_custom (bool, optional) – Load user created liquid classes. Defaults to True.

  • database (str, optional) – Path to a non-standard liquid class database file. Defaults to r’C:Program Files (x86)HAMILTONConfigML_STARLiquids.mdb’.

classmethod read_submethods(directory: str = '') None[source]

Reads in all the submethod files at the specified folder and converts them to python classes.

An empty string for the directory parameter (default) loads from /smt/

All python classes are generated in venus_resources/ and are given the same name as the original smt file, prefixed with __smt__

Parameters

directory (str, optional) – The path to directory with smt files. Defaults to “”.

pyvenus.scripts module

pyvenus.scripts.pyvenus_main()[source]
pyvenus.scripts.pyvenus_setup()[source]

Module contents