magscope.utils
==============

.. py:module:: magscope.utils


Classes
-------

.. autoapisummary::

   magscope.utils.AcquisitionMode
   magscope.utils.PoolVideoFlag
   magscope.utils.Units


Functions
---------

.. autoapisummary::

   magscope.utils.crop_stack_to_rois
   magscope.utils.numpy_type_to_qt_image_type
   magscope.utils.date_timestamp_str
   magscope.utils.register_script_command
   magscope.utils.check_cupy


Module Contents
---------------

.. py:class:: AcquisitionMode

   Bases: :py:obj:`enum.StrEnum`


   Enum for the different acquisition modes


   .. py:attribute:: TRACK
      :value: 'track'



   .. py:attribute:: TRACK_AND_CROP_VIDEO
      :value: 'track & video (cropped)'



   .. py:attribute:: TRACK_AND_FULL_VIDEO
      :value: 'track & video (full)'



   .. py:attribute:: CROP_VIDEO
      :value: 'video (cropped)'



   .. py:attribute:: FULL_VIDEO
      :value: 'video (full)'



.. py:function:: crop_stack_to_rois(stack, rois)

.. py:function:: numpy_type_to_qt_image_type(numpy_type)

.. py:function:: date_timestamp_str(timestamp)

.. py:class:: PoolVideoFlag

   Bases: :py:obj:`enum.IntEnum`


   Enum where members are also (and must be) ints


   .. py:attribute:: READY
      :value: 0



   .. py:attribute:: RUNNING
      :value: 1



   .. py:attribute:: FINISHED
      :value: 2



.. py:class:: Units

   .. py:attribute:: m
      :value: 1.0



   .. py:attribute:: cm
      :value: 0.01



   .. py:attribute:: mm
      :value: 0.001



   .. py:attribute:: um
      :value: 1e-06



   .. py:attribute:: nm
      :value: 1e-09



   .. py:attribute:: N
      :value: 1.0



   .. py:attribute:: mN
      :value: 0.001



   .. py:attribute:: uN
      :value: 1e-06



   .. py:attribute:: nN
      :value: 1e-09



   .. py:attribute:: pN
      :value: 1e-12



   .. py:attribute:: fN
      :value: 1e-15



   .. py:attribute:: ms
      :value: 0.001



   .. py:attribute:: us
      :value: 1e-06



   .. py:attribute:: ns
      :value: 1e-09



   .. py:attribute:: ps
      :value: 1e-12



   .. py:attribute:: fs
      :value: 1e-15



.. py:function:: register_script_command(command_type: type[magscope.ipc_commands.Command])

   Decorator marking a method as callable from a MagScope script.

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


.. py:function:: check_cupy() -> bool

   Return ``True`` when the CuPy package is usable.


