science_jubilee.tools package#

Subpackages#

Submodules#

science_jubilee.tools.AS7341 module#

class science_jubilee.tools.AS7341.AS7341(index, name, config)[source]#

Bases: Tool

A class representation of the AS7341 spectral sensor.

Parameters:

Tool (Tool) – The base tool class

Send a blink command to the connected Seeed device

Parameters:

cmd (Union[int, str]) – The blink command parameter

Raises:

ToolStateError – If no serial port is connected

connect_seeed(ser_port_index: int = 0) Serial[source]#

Connect to a Seeed device at the specified port index

Parameters:

ser_port_index (int, optional) – Index of the serial port to connect to, defaults to 0

Returns:

Connected serial port

Return type:

serial.Serial

disconnect_seeed() bool[source]#

Disconnect from the currently connected Seeed device

Returns:

True if disconnection was successful

Return type:

bool

find_seeed() List[Serial][source]#

Find all Seeed Studio or Espressif devices connected to the system

Returns:

List of serial ports for connected Seeed devices

Return type:

List[serial.Serial]

Raises:

IOError – If no Seeed devices are found

get_raw_spectrum(duty_cycle: int = 100) str[source]#

Get the raw spectral data string from the AS7341 sensor

Parameters:

duty_cycle (int, optional) – The duty cycle for the measurement (0-100), defaults to 100

Returns:

Raw string output from the sensor

Return type:

str

Raises:

ToolStateError – If no serial port is connected

load_config(config)[source]#

Loads the configuration file for the AS7341 sensor tool

measure_spectrum(duty_cycle: int = 100) Dict[str, Any][source]#

Measure the spectral values from the AS7341 sensor

Parameters:

duty_cycle (int, optional) – The duty cycle for the measurement (0-100), defaults to 100

Returns:

Dictionary containing the spectral readings from different channels

Return type:

Dict[str, Any]

Raises:

science_jubilee.tools.Camera module#

science_jubilee.tools.HTTPSyringe module#

class science_jubilee.tools.HTTPSyringe.HTTPSyringe(index, name, url)[source]#

Bases: Tool

aspirate(*args, **kwargs)[source]#
dispense(*args, **kwargs)[source]#
classmethod from_config(index, fp)[source]#
load_syringe(volume, pulsewidth)[source]#

Configure a syringe after physically loading it

volume: Current loaded volume in syringe pulsewidth: current pulsewidth position of servo

mix(*args, **kwargs)[source]#
set_pulsewidth(pulsewidth: int, s: int = 100)[source]#

Manually move the servo actuator to a new location by setting the new pulsewidth.

Does not update volume, use carefully

Parameters:
  • pulsewidth (int) – The servo motor pulsewidth to set the servo to. Read up on servo positioning for this to make sense. Ranges from 1000-2000 with a stricter range of accessible values for each syringe tool.

  • s (int) – Speed of movement in uL/S.

status()[source]#

Fetch and update status

science_jubilee.tools.Loop module#

class science_jubilee.tools.Loop.Loop(index, name)[source]#

Bases: Tool

A class representation of an inoculation loop.

Parameters:

Tool (Tool) – The base tool class

transfer(*args, **kwargs)[source]#

science_jubilee.tools.PeristalticPumps module#

class science_jubilee.tools.PeristalticPumps.PeristalticPumps(n_pumps: int, steps_per_ml: float | int | list, tool_axis: str = 'E', name: str = 'dispenser_pumps')[source]#

Bases: Tool

class representation of peristaltic pumps. Due to duet-level axis definition requirements, currently requires an accompanying PumpDispenser tool to control pumps.

Parameters:
  • n_pumps (int) – Number of peristaltic pumps

  • steps_per_mL (float, int, list) – stepper motor steps to turn pump to pump 1mL of liquid. calibrate gravimetrically. Can pass a float or int to apply same value to each pump or list to apply unique value to each pump.

  • tool_axis (str) – Motion axis tool is defined to on duet. Default E

  • name (str) – name of tool

classmethod from_config(config_file: str, path: str = '/home/docs/checkouts/readthedocs.org/user_builds/science-jubilee/checkouts/latest/docs/../src/science_jubilee/tools/configs')[source]#

Initialize a PeristalticPumps object from a config file

Parameters:

config_file (str) – The name of the config file containign the pump parameters

Returns:

A PeristalticPumps object

Return type:

PeristalticPumps

post_load()[source]#

After tool load, set steps per mm on machine

pump(volume: int | float | list)[source]#

transfer volume using pump

Parameters:

volume (int, float, list) – volume to pump. Specify a number (int/float) to pump same amount from all pumps simultaneously, or a list of numbers to pump unique amount from each pump.

science_jubilee.tools.Pipette module#

class science_jubilee.tools.Pipette.Pipette(index, name, brand, model, max_volume, min_volume, zero_position, blowout_position, drop_tip_position, mm_to_ul)[source]#

Bases: Tool

A class representation of an Opentrons OT2 pipette.

add_tiprack(tiprack: Labware | list)[source]#

Associate a tiprack with the pipette tool

Parameters:

tiprack (Union[Labware, list]) – The tiprack to associate with the pipette

air_gap(*args, **kwargs)[source]#
aspirate(*args, **kwargs)[source]#
blowout(*args, **kwargs)[source]#
dispense(*args, **kwargs)[source]#
drop_tip(*args, **kwargs)[source]#
classmethod from_config(index, name, config_file: str, path: str = '/home/docs/checkouts/readthedocs.org/user_builds/science-jubilee/checkouts/latest/docs/../src/science_jubilee/tools/configs')[source]#

Initialize the pipette object from a config file

Parameters:
  • index (int) – The tool index of the pipette on the machine

  • name (str) – The tool name

  • config_file (str) – The name of the config file containign the pipette parameters

  • path – The path to the pipette configuration .json files for the tool, defaults to the ‘config/’ in the science_jubilee/tools/configs directory.

Returns:

A Pipette object

Return type:

Pipette

mix(*args, **kwargs)[source]#
pickup_tip(*args, **kwargs)[source]#
post_load()[source]#

Prime the Pipette after loading it onto the Machine sot hat it is ready to use

prime(s=2500)[source]#

Moves the plunger to the low-point on the pipette motor axis to prepare for further commands Note::This position should not engage the pipette tip plunger

Parameters:

s (int) – The speed of the plunger movement in mm/min

return_tip(*args, **kwargs)[source]#
stir(*args, **kwargs)[source]#
transfer(*args, **kwargs)[source]#
update_z_offset(tip: bool = None)[source]#

Shift the z-offset of the tool to account for the tip length

Parameters:

tip (bool, optional) – Parameter to indicated whether to add or remove the tip offset, defaults to None

vol2move(vol)[source]#

Converts desired volume in uL to a movement of the pipette motor axis

Parameters:

vol (float) – The desired amount of liquid expressed in uL

Returns:

The corresponding motor movement in mm

Return type:

float

class science_jubilee.tools.Pipette.TipTracker(tips, start_well=None)[source]#

Bases: object

A class to track the usage of pipette tips and their location in the tiprack

Parameters:
  • tips (list[Well]) – The list of tips in the tiprack

  • start_well (Well, optional) – The starting well to begin tracking the tips from, defaults to None

Note: This function was taken from the Opentrons API and modified to work with the Pipette class of Science_Jubilee

assign_tip_to_stock(tip_well, stock_well)[source]#
next_tip(start_well=None)[source]#
previous_tip()[source]#
return_tip(well=None)[source]#
use_tip(tip_well)[source]#
science_jubilee.tools.Pipette.tip_check(func)[source]#

Decorator to check if the pipette has a tip attached before performing an action.

science_jubilee.tools.PneumaticSampleLoader module#

class science_jubilee.tools.PneumaticSampleLoader.PneumaticSampleLoader(url, port, name, cell_location, safe_position, username, password)[source]#

Bases: Tool

Interfaces the AFL sample loader tool with Jubilee deck

enqueue(task: dict)[source]#

Enqueue a task to be executed by the pneumatic sample loader.

returns task uuid

classmethod from_config(fp)[source]#
get_cell_state() str[source]#

Get the current state of the sample cell.

Returns:

The current state of the sample cell (e.g., ‘LOADED’, ‘IDLE’, etc.)

Return type:

str

get_safety_state()[source]#

Returns the safety state of the machine.

load_sample(tool, sample_location: str, volume) bool[source]#

Load a sample into the sample cell using pneumatic pressure. First moves to the specified position, then performs the loading operation.

Parameters:
  • tool – pipette-like tool (ie OT P300, HTTP syringe)

  • sample_location – location

Returns:

True if sample was loaded successfully, False otherwise.

Return type:

bool

login()[source]#
parse_state(status_list: str) tuple[str, str][source]#

Parse the state and arm state from a status string.

Parameters:

status_str (str) – Raw status string from the device

Returns:

A tuple containing (cell_state, arm_state)

e.g., (‘LOADED’, ‘DOWN’)

Return type:

tuple[str, str]

pause_queue()[source]#
prepare_cell()[source]#

Prepare the cell for loading - raise arm and make sure it is clean

rinse_cell() bool[source]#

Clean the sample cell using pressurized air or cleaning solution.

Parameters:
  • pressure (float, optional) – The pressure (PSI) to use for cleaning. If None, uses default_clean_pressure from config.

  • cycles (int) – Number of cleaning cycles to perform.

Returns:

True if cleaning was successful, False otherwise.

Return type:

bool

unpause_queue()[source]#
update_status() dict[source]#

Get the current status of the sample loader.

Returns:

Status information including whether sample is loaded

and current pressure settings.

Return type:

dict

science_jubilee.tools.PumpDispenser module#

class science_jubilee.tools.PumpDispenser.PumpDispenser(index, name, pump_group, dispense_tip_offsets, line_volume, waste=None)[source]#

Bases: Tool

Class to manage dispenser tool, for example for a color mixing demo

Parameters:
  • index – The tool index of the dispenser head on the machine

  • name (str) – The tool name

  • pump_group (science_jubilee.tools.PeristalticPump.PeristalticPumps) – science_jubilee.tools.PeristalticPump.PeristalticPumps object to assign to dispenser head

  • dispense_tip_offset (list) – Offsets from tool reference point for every dispense tip on the tool

  • line_volume (int, float) – Volume in mL of tubing line between pump and dispense head for 1 line

  • waste (class 'Well') – Location of waste basin

add_waste(location: Well | Tuple | Location)[source]#

Specify a waste collection container to dump extra liquid into. This should be large enough to catch liquid from all dispenser tips simultaneously.

Parameters:

location (class 'Well') – location of container

dispense(vol: float | int | list, location: Well | Tuple | Location, dispense_head_index=None)[source]#

Dispense volume vol from dispense head dispense_head_index into location

Parameters:
  • vol (float, int list) – Volume to dispense, in mL. Specify a single number (float, int) and a dispense head index (int) to dispense from a single specific dispense head, the single volume with no dispense head to dispense this amount from all dispense tips, or a list of volumes to dispense unique amount from each dispense tip

  • location (class 'Well') – Location to dispense

  • dispense_head_index (int) – index of dispense tip to dispense from, if passing single number for vol

empty_lines(volume: int | float = None)[source]#

return line contents to stock wells.

Parameters:

volume (int, float) – line volume to return, if not set in instance already

classmethod from_config(index, pump_group, config_file: str, path: str = '/home/docs/checkouts/readthedocs.org/user_builds/science-jubilee/checkouts/latest/docs/../src/science_jubilee/tools/configs')[source]#

Initialize the pipette object from a config file

Parameters:
  • index (int) – The tool index of the dispenser_head on the machine

  • config_file (str) – The name of the config file containign the dispenser tool parameters

Returns:

A PumpDispenser object

Return type:

PumpDispenser

prime_lines(volume: int | float = None, location: Well | Tuple | Location = None)[source]#

Fill all lines with liquid from all pumps simultaneously.

Parameters:
  • volume – volume to prime with, if not specified in config file

  • location (class 'Well') – location of waste container, if not already specified

science_jubilee.tools.Sonicator module#

class science_jubilee.tools.Sonicator.Sonicator(index, name, mode: str, port: str = None)[source]#

Bases: Tool

A class representation for a Qsonica Sonicator tool.

perform_cleanining_protocol(plunge_depth: float = None)[source]#

Perform the cleaning protocol on the sonicator.

Parameters:

plunge_depth (float, optional) – depth to plunge the sonicator into the well, defaults to None

set_cleaning_protocol(wells: List[Well], power: List[float], time: List[float], plunge_depth: float = None)[source]#

Set the cleaning protocol for the sonicator.

Parameters:
  • wells (List[Well]) – list of wells to clean

  • power (List[float]) – power level to clean at

  • time (List[float]) – time to clean for

  • plunge_depth (float, optional) – depth of the sonicator into the well, defaults to None

sonicate_well(*args, **kwargs)[source]#

science_jubilee.tools.Spectrometer module#

science_jubilee.tools.Syringe module#

class science_jubilee.tools.Syringe.Syringe(index, name, config)[source]#

Bases: Tool

A class representation of a syringe.

Parameters:

Tool (Tool) – The base tool class

aspirate(*args, **kwargs)[source]#
check_bounds(pos)[source]#

Disallow commands outside of the syringe’s configured range

Parameters:

pos (float) – The E position to check

dispense(*args, **kwargs)[source]#
extrude_syringe(*args, **kwargs)[source]#
load_config(config)[source]#

Loads the confirguration file for the syringe tool

Parameters:

config (str) – Name of the config file for your syringe. Expects the file to be in /tools/configs

mix(*args, **kwargs)[source]#
post_load()[source]#

Query the object model after loading the tool to find the extruder number of this syringe.

retract_syringe(*args, **kwargs)[source]#
transfer(*args, **kwargs)[source]#

science_jubilee.tools.SyringeExtruder module#

class science_jubilee.tools.SyringeExtruder.SyringeExtruder(index, name, config)[source]#

Bases: Tool

A class representation of a syringe for extrusion 3D printing.

Parameters:

Tool (Tool) – The base tool class

aspirate(*args, **kwargs)[source]#
check_bounds(pos)[source]#

Disallow commands outside of the syringe’s configured range

Parameters:

pos (float) – The E position to check

dispense(*args, **kwargs)[source]#
dist(start, end)[source]#
load_config(config)[source]#

Loads the confirguration file for the syringe tool

Parameters:

config (str) – Name of the config file for your syringe. Expects the file to be in /tools/configs

make_e(x, y, z)[source]#
move_extrude(*args, **kwargs)[source]#
post_load()[source]#

Query the object model after loading the tool to find the extruder number of this syringe.

wipe_nozzle(x=285, y=250, z=0.2)[source]#
wipe_tower(x=285, y=250, z=0.2)[source]#

science_jubilee.tools.Tool module#

class science_jubilee.tools.Tool.Tool(index, name, **kwargs)[source]#

Bases: object

post_load()[source]#

Run any code after tool has been associated with the machine.

exception science_jubilee.tools.Tool.ToolConfigurationError[source]#

Bases: Exception

Raise this error if there is something wrong with how the tool is configured

exception science_jubilee.tools.Tool.ToolStateError[source]#

Bases: Exception

Raise this error if the tool is in the wrong state to perform such a command.

science_jubilee.tools.Tool.requires_active_tool(func)[source]#

Decorator to ensure that a tool cannot complete an action unless it is the current active tool.

science_jubilee.tools.WebCamera module#

class science_jubilee.tools.WebCamera.Camera(index, name, ip_address, port, video_endpoint, still_endpoint, image_folder, focus_height, light: bool = False, light_pin: int = None)[source]#

Bases: Tool

A class representation of a Raspberry Pi camera server client.

capture_image(*args, **kwargs)[source]#
decode_image(image_bin)[source]#

Decode a bstring image into an np.array

Parameters:

image_bin (bytes) – the image as a bstring

Returns:

the image as an np.array

Return type:

np.array

classmethod from_config(index, name, config_file: str, path: str = '/home/docs/checkouts/readthedocs.org/user_builds/science-jubilee/checkouts/latest/docs/../src/science_jubilee/tools/configs')[source]#

Initialize the pipette object from a config file

Parameters:
  • index (int) – The tool index of the pipette on the machine

  • name (str) – The name associated with the tool (e.g. ‘WebCamera’)

  • config_file (str) – The name of the config file containing the tool parameters

  • path (str, optional) – The path to the labware configuration .json files for the labware, defaults to the ‘labware_definition/’ in the science_jubilee/labware directory.

Returns:

the initialized Camera object

Return type:

Camera object

process_image(image_bin, radius=50)[source]#

Externally callable function to run processing pipeline

Parameters:
  • image_bin (bytes) – the image as a bstring

  • radius (int, optional) – the radius (in pixels) of the circular mask, defaults to 50

Returns:

the average rgb values of the masked image

Return type:

list

video_feed()[source]#

Deploys a video feed at the url specified in the config file

view_image(image_bin, masked=False, radius=50)[source]#

Show the image in a matplotlib window

Parameters:
  • image_bin (bytes) – the image as a bstring

  • masked (bool, optional) – Wether to mask the image or not, defaults to False

  • radius (int, optional) – the size (in pixel) of the circular mask toapply to the image , defaults to 50

Module contents#