Skip to content

Bioshake

This module provides a class to control the QInstruments BioShake device.

ATTRIBUTE DESCRIPTION
MAX_LEN

maximum length of data buffer

TYPE: int

ACCELERATION_LIMIT

lower and upper limits for acceleration

TYPE: tuple

CLASS DESCRIPTION
BioShake

BioShake provides methods to control the QInstruments BioShake device.

Documentation last updated: 2025-02-22/i>

BioShake

BioShake(
    port: str,
    *,
    speed_tolerance: float = 10,
    temp_tolerance: float = 1.5,
    stabilize_timeout: float = 10,
    verbose: bool = False,
    simulation: bool = False,
    **kwargs,
)

Bases: HeaterMixin, Maker

BioShake provides methods to control the QInstruments BioShake device.

ATTRIBUTE DESCRIPTION
buffer_df

buffer dataframe to store collected data

TYPE: DataFrame

records_df

records dataframe to store collected data

TYPE: DataFrame

limits

hardware limits for device

TYPE: dict[str, tuple]

ranges

user-defined ranges for controls

TYPE: dict[str, tuple]

model

device model description

TYPE: str

serial_number

device serial number

TYPE: str

acceleration

acceleration / deceleration of the shaker in seconds

TYPE: float

speed

actual speed of shake in rpm

TYPE: float

set_speed

target speed

TYPE: float

speed_tolerance

fractional tolerance to be considered on target for speed

TYPE: float

shake_time_left

remaining time left on shaker

TYPE: float

temperature

actual temperature of the plate in °C

TYPE: float

set_temperature

target temperature

TYPE: float

temp_tolerance

fractional tolerance to be considered on target for temperature

TYPE: float

stabilize_timeout

time in seconds to wait before considering temperature stabilized

TYPE: float

is_counterclockwise

returns the current mixing direction

TYPE: bool

is_locked

returns the current ELM state

TYPE: bool

connection_details

connection details for the device

TYPE: dict

device

device object that communicates with physical tool

TYPE: Device

flags

flags for the class

TYPE: SimpleNamespace[str, bool]

is_busy

whether the device is busy

TYPE: bool

is_connected

whether the device is connected

TYPE: bool

verbose

verbosity of class

TYPE: bool

METHOD DESCRIPTION
clearCache

clears and remove data in buffer

connect

connect to the device

controlTemp

switches on/off the temperature control feature and starts/stops heating/cooling

execute

Set target temperature, then shake the plate at target speed and hold target temperature for desired duration

getAcceleration

returns the acceleration/deceleration value

getDefaults

retrieve the default and starting configuration of the device upon start up

getErrors

returns a list with errors and warnings which can occur during processing

getShakeDirection

returns the current mixing direction

getElmState

returns the current ELM state

getErrors

returns a list with errors and warnings which can occur during processing

getShakeTimeLeft

returns the remaining shake time in seconds if device was started with the a defined duration

getSpeed

returns the set speed and current mixing speed in rpm

getStatus

retrieve the status of the device's ELM, shaker, and temperature control

getTemperature

returns the set temperature and current temperature in °C

getUserLimits

retrieve the user defined limits for speed and temperature

grip

grip or release the object

holdTemperature

hold target temperature for desired duration

home

move shaker to the home position and locks in place

record

start or stop data recording

reset

restarts the controller

setAcceleration

sets the acceleration/deceleration value in seconds

setCounterClockwise

sets the mixing direction to counter clockwise

setSpeed

set the target mixing speed

setTemperature

sets target temperature between TempMin and TempMax in 1/10°C increments

shake

shake the plate at target speed, for specified duration

shutdown

shutdown procedure for tool

stop

stop the shaker immediately at an undefined position, ignoring the defined deceleration time if in an emergency

toggleECO

toggle the economical mode to save energy and decrease abrasion

toggleRecord

start or stop data recording

toggleShake

starts/stops shaking with defined speed with defined acceleration/deceleration time

toggleTemperature

switches on/off the temperature control feature and starts/st

Initialize the class

PARAMETER DESCRIPTION
port

serial port address

TYPE: str

speed_tolerance

fractional tolerance to be considered on target for speed. Defaults to 10.

TYPE: float DEFAULT: 10

temp_tolerance

fractional tolerance to be considered on target for temperature. Defaults to 1.5.

TYPE: float DEFAULT: 1.5

stabilize_timeout

time in seconds to wait before considering temperature stabilized. Defaults to 10.

TYPE: float DEFAULT: 10

verbose

verbosity of class. Defaults to False.

TYPE: bool DEFAULT: False

simulation

whether to simulate. Defaults to False.

TYPE: bool DEFAULT: False

buffer_df property

buffer_df: DataFrame

Buffer dataframe to store collected data

is_counterclockwise property

is_counterclockwise: bool

Returns the current mixing direction

is_locked property

is_locked: bool

Returns the current ELM state

model property

model: str

Device model description

records_df property

records_df: DataFrame

Records dataframe to store collected data

serial_number property

serial_number: str

Device serial number

__info__

__info__()

Prints the boot screen text

__serial__

__serial__() -> str

Returns the device serial number

RETURNS DESCRIPTION
str

device serial number

TYPE: str

__version__

__version__() -> str

Retrieve the software version on the device

RETURNS DESCRIPTION
str

device version

TYPE: str

atSpeed

atSpeed(
    speed: float | None = None,
    *,
    tolerance: float | None = None,
) -> bool

Checks and returns whether target speed has been reached

PARAMETER DESCRIPTION
speed

target speed. Defaults to None.

TYPE: float | None DEFAULT: None

tolerance

fractional tolerance to be considered on target. Defaults to None.

TYPE: float | None DEFAULT: None

RETURNS DESCRIPTION
bool

whether target speed has been reached

TYPE: bool

atTemperature

atTemperature(
    temperature: float | None = None,
    *,
    tolerance: float | None = None,
    stabilize_timeout: float | None = None,
) -> bool

Checks and returns whether target temperature has been reached

PARAMETER DESCRIPTION
temperature

target temperature. Defaults to None.

TYPE: float | None DEFAULT: None

tolerance

fractional tolerance to be considered on target. Defaults to None.

TYPE: float | None DEFAULT: None

stabilize_timeout

time in seconds to wait before considering temperature stabilized. Defaults to None.

TYPE: float | None DEFAULT: None

RETURNS DESCRIPTION
bool

whether target temperature has been reached

TYPE: bool

clearCache

clearCache()

Clears and remove data in buffer

connect

connect()

Connect to the device

controlTemp

controlTemp(on: bool)

Switches on/off the temperature control feature and starts/stops heating/cooling

PARAMETER DESCRIPTION
on

whether to start temperature control

TYPE: bool

execute

execute(
    shake: bool,
    temperature: float | None = None,
    speed: int | None = None,
    duration: int | None = None,
    acceleration: int | None = None,
    *args,
    **kwargs,
)

Set target temperature, then shake the plate at target speed and hold target temperature for desired duration Alias for holdTemperature() and shake()

PARAMETER DESCRIPTION
shake

whether to shake

TYPE: bool

temperature

temperature in degree °C. Defaults to None.

TYPE: float | None DEFAULT: None

speed

shaking speed. Defaults to None.

TYPE: int | None DEFAULT: None

duration

duration of shake. Defaults to None.

TYPE: int | None DEFAULT: None

acceleration

acceleration value. Defaults to None.

TYPE: int | None DEFAULT: None

getAcceleration

getAcceleration() -> float | None

Returns the acceleration/deceleration value

RETURNS DESCRIPTION
float

acceleration/deceleration value

TYPE: float | None

getData

getData(
    query: Any | None = None, *args, **kwargs
) -> FloatData | None

Get data from device

PARAMETER DESCRIPTION
query

query to device. Defaults to None.

TYPE: Any DEFAULT: None

RETURNS DESCRIPTION
FloatData | None

FloatData|None: data from device

getDefaults

getDefaults()

Retrieve the default and starting configuration of the device upon start up

getElmState

getElmState() -> int

Returns the current ELM state

RETURNS DESCRIPTION
int

ELM state

TYPE: int

getErrors

getErrors() -> list[str]

Returns a list with errors and warnings which can occur during processing

RETURNS DESCRIPTION
list[str]

list[str]: list of errors and warnings

getShakeDirection

getShakeDirection() -> bool

Returns the current mixing direction

RETURNS DESCRIPTION
bool

whether mixing direction is counterclockwise

TYPE: bool

getShakeTimeLeft

getShakeTimeLeft() -> float | None

Returns the remaining shake time in seconds if device was started with the a defined duration

RETURNS DESCRIPTION
float | None

float|None: minimum target shake speed

getSpeed

getSpeed() -> float

Returns current mixing speed in rpm

RETURNS DESCRIPTION
float

current mixing speed

TYPE: float

getStatus

getStatus() -> dict[str, int | None]

Retrieve the status of the device's ELM, shaker, and temperature control

RETURNS DESCRIPTION
dict[str, int | None]

dict[str, int|None]: dictionary of states

getTargetSpeed

getTargetSpeed() -> float | None

Returns the set temperature

RETURNS DESCRIPTION
float

set temperature

TYPE: float | None

getTargetTemp

getTargetTemp() -> float | None

Returns the set temperature

RETURNS DESCRIPTION
float

set temperature

TYPE: float | None

getTemperature

getTemperature() -> float | None

Get temperature

RETURNS DESCRIPTION
float

actual temperature

TYPE: float | None

getUserLimits

getUserLimits()

Retrieve the user defined limits for speed and temperature

grip

grip(on: bool)

Grip or release the object

PARAMETER DESCRIPTION
on

whether to grip the object

TYPE: bool

home

home(timeout: int = 5)

Move shaker to the home position and locks in place

Note: Minimum response time is less than 4 sec (internal failure timeout)

PARAMETER DESCRIPTION
timeout

number of seconds to wait before aborting. Defaults to 5.

TYPE: int DEFAULT: 5

record

record(
    on: bool, show: bool = False, clear_cache: bool = False
)

Start or stop data recording

PARAMETER DESCRIPTION
on

whether to start recording

TYPE: bool

show

whether to print out data. Defaults to False.

TYPE: bool DEFAULT: False

clear_cache

whether to clear cache. Defaults to False.

TYPE: bool DEFAULT: False

reset

reset(timeout: int = 30)

Restarts the controller

Note: This takes about 30 seconds for BS units and 5 for the Q1, CP models

PARAMETER DESCRIPTION
timeout

number of seconds to wait before aborting. Defaults to 30.

TYPE: int DEFAULT: 30

setAcceleration

setAcceleration(
    acceleration: int, as_default: bool = False
)

Sets the acceleration/deceleration value in seconds

PARAMETER DESCRIPTION
acceleration

acceleration value

TYPE: int

as_default

whether to change the default acceleration. Defaults to False.

TYPE: bool DEFAULT: False

setCounterClockwise

setCounterClockwise(counterclockwise: bool)

Sets the mixing direction to counter clockwise

PARAMETER DESCRIPTION
counterclockwise

whether to set mixing direction to counter clockwise

TYPE: bool

setSpeed

setSpeed(speed: int, as_default: bool = False)

Set the target mixing speed

Note: Speed values below 200 RPM are possible, but not recommended

PARAMETER DESCRIPTION
speed

target mixing speed

TYPE: int

as_default

whether to change the default speed. Defaults to False.

TYPE: bool DEFAULT: False

setTemperature

setTemperature(
    temperature: float,
    blocking: bool = True,
    *,
    tolerance: float = None,
    release: Event = None,
) -> tuple[Thread, Event] | None

Set target temperature between TempMin and TempMax in 1/10°C increments

PARAMETER DESCRIPTION
temperature

target temperature

TYPE: float

blocking

whether to block until temperature is reached. Defaults to True.

TYPE: bool DEFAULT: True

tolerance

fractional tolerance to be considered on target. Defaults to None.

TYPE: float DEFAULT: None

release

event to release thread. Defaults to None.

TYPE: Event DEFAULT: None

RETURNS DESCRIPTION
tuple[Thread, Event] | None

tuple[threading.Thread, threading.Event]|None: thread and event

shake

shake(
    speed: int | None = None,
    duration: int | None = None,
    blocking: bool = True,
    *,
    acceleration: int | None = None,
    release: Event | None = None,
)

Shake the plate at target speed, for specified duration

PARAMETER DESCRIPTION
speed

shaking speed. Defaults to None.

TYPE: int | None DEFAULT: None

duration

duration of shake. Defaults to None.

TYPE: int | None DEFAULT: None

blocking

whether to block until shake is complete. Defaults to True.

TYPE: bool DEFAULT: True

acceleration

acceleration value. Defaults to None.

TYPE: int | None DEFAULT: None

release

event to release thread. Defaults to None.

TYPE: Event | None DEFAULT: None

shutdown

shutdown()

Shutdown procedure for tool

stop

stop(emergency: bool = True)

Stop the shaker immediately at an undefined position, ignoring the defined deceleration time if in an emergency

PARAMETER DESCRIPTION
emergency

whether to perform an emergency stop. Defaults to True.

TYPE: bool DEFAULT: True

stream

stream(on: bool, show: bool = False)

Start or stop data streaming

PARAMETER DESCRIPTION
on

whether to start streaming

TYPE: bool

show

whether to print out data. Defaults to False.

TYPE: bool DEFAULT: False

toggleECO

toggleECO(on: bool, timeout: int = 5)

Toggle the economical mode to save energy and decrease abrasion

PARAMETER DESCRIPTION
on

whether to enter eco mode

TYPE: bool

timeout

number of seconds to wait before aborting. Defaults to 5.

TYPE: int DEFAULT: 5

toggleShake

toggleShake(
    on: bool, duration: int | None = None, home: bool = True
)

Starts/stops shaking with defined speed with defined acceleration/deceleration time. Shake runtime can be specified, as well as whether to return to home position after stopping.

PARAMETER DESCRIPTION
on

whether to start shaking

TYPE: bool

duration

shake runtime. Defaults to None.

TYPE: int | None DEFAULT: None

home

whether to return to home when shaking stops. Defaults to True.

TYPE: bool DEFAULT: True