magscope.utils#

Classes#

AcquisitionMode

Enum for the different acquisition modes

PoolVideoFlag

Enum where members are also (and must be) ints

Units

Functions#

crop_stack_to_rois(stack, rois)

numpy_type_to_qt_image_type(numpy_type)

date_timestamp_str(timestamp)

register_script_command(command_type)

Decorator marking a method as callable from a MagScope script.

check_cupy(→ bool)

Return True when the CuPy package is usable.

Module Contents#

class magscope.utils.AcquisitionMode[source]#

Bases: enum.StrEnum

Enum for the different acquisition modes

TRACK = 'track'[source]#
TRACK_AND_CROP_VIDEO = 'track & video (cropped)'[source]#
TRACK_AND_FULL_VIDEO = 'track & video (full)'[source]#
CROP_VIDEO = 'video (cropped)'[source]#
FULL_VIDEO = 'video (full)'[source]#
magscope.utils.crop_stack_to_rois(stack, rois)[source]#
magscope.utils.numpy_type_to_qt_image_type(numpy_type)[source]#
magscope.utils.date_timestamp_str(timestamp)[source]#
class magscope.utils.PoolVideoFlag[source]#

Bases: enum.IntEnum

Enum where members are also (and must be) ints

READY = 0[source]#
RUNNING = 1[source]#
FINISHED = 2[source]#
class magscope.utils.Units[source]#
m = 1.0[source]#
cm = 0.01[source]#
mm = 0.001[source]#
um = 1e-06[source]#
nm = 1e-09[source]#
N = 1.0[source]#
mN = 0.001[source]#
uN = 1e-06[source]#
nN = 1e-09[source]#
pN = 1e-12[source]#
fN = 1e-15[source]#
ms = 0.001[source]#
us = 1e-06[source]#
ns = 1e-09[source]#
ps = 1e-12[source]#
fs = 1e-15[source]#
magscope.utils.register_script_command(command_type: type[magscope.ipc_commands.Command])[source]#

Decorator marking a method as callable from a MagScope script.

Each script command must be paired with the IPC Command that will be dispatched when the script executes that step. The decorator mirrors magscope.ipc_commands.command_handler() by attaching metadata to the wrapped function without constraining how it is collected.

magscope.utils.check_cupy() bool[source]#

Return True when the CuPy package is usable.