:orphan:

DCAM Camera
===========

**From:** Hamamatsu Photonics

**Class:** :py:class:`herosdevices.hardware.hamamatsu.dcam_camera.DcamCompatibleCamera`


**Driver Quality Index:** beta


.. admonition:: Requires the following packages 

   `dcamsdk4 <https://www.hamamatsu.com/eu/en/product/cameras/software/driver-software/dcam-sdk4.html>`_

Additional Information :bdg-warning:`Check before use`
------------------------------------------------------

.. dropdown:: Hamamatsu DCAM API and SDK Setup


   
   To use such a device, installing both, the API and the SDK4 is necessary.
   The API is needed to run camera and the SDK4 provides means to control the API via Python.
   Both can be downloaded directly from the vendor:
   
   - `DCAM-API Lite for Linux <https://www.hamamatsu.com/eu/en/product/cameras/software/driver-software/dcam-api-lite-for-linux.html>`_
   - `DCAM-SDK4 <https://www.hamamatsu.com/eu/en/product/cameras/software/driver-software/dcam-sdk4.html>`_
   
   
   API
     The API has to be installed using the included install instructions.
     On some linux distributions (e.g. archlinux), you have to run both parts of the installer manually after installing the necessary packages.
   
     .. code::
   
         # example for usb camera
         # add user to uucp group (possible re-login needed)
         usermod -aG uucp MY_USER
         # install libusb 0.x
         pacman -S libusb-compat
         cd DCAM_API_FOLDER_XXX
         bash api/driver/usb/install.sh
         bash api/runtime/install.sh
   
   
   SDK4
     The SDK4 contains (among other things) some Python examples on how to use the API.
     Therefore, it includes Python classes which encapsulate the API.
     These are located in the subfolder ``dcamsdk4/samples/python``:
   
     - ``dcam.py``
     - ``dcamapi4.py``
     - ``dcamcon.py``
   
     Clone the `barebone package <https://gitlab.com/atomiq-project/vendor-packages/hamamatsu-dcam-sdk4-python>`_.
     Place the three files in question into the subfolder ``src/dcamsdk4/``.
     They should reside on the same level as ``__init__.py``.
   
     The structure of the package should resemble::
   
         .
         ├── pyproject.toml
         ├── README.md
         └── src
             └── dcamsdk4
                 ├── dcamapi4.py
                 ├── dcamcon.py
                 ├── dcam.py
                 └── __init__.py
   
     - Open ``dcam.py`` and replace ``from dcamapi4 import *`` by ``from .dcamapi4 import *``.
     - Open ``dcamcon.py`` and replace ``from dcam import *`` by ``from .dcam import *``.
     - Note the leading dots in both cases.
   
     Finally, in the same Python environment ``herosdevices`` is installed in, install the ``dcamsdk4`` with ``pip``.
   

....................

Camera object for Hamamatsu DCAM cameras.

In particular, this code has been tested with the C15550-20UP.

.. tab-set:: 


   .. tab-item:: Arguments
   
   
      Bold arguments are mandatory. For more information on the listed arguments refer to the class             documentation: :py:class:`herosdevices.hardware.hamamatsu.dcam_camera.DcamCompatibleCamera` If parameters appear in this             list but not in the class definition, please recursively check the linked base classes for the             definition of the parameter.
      
      
      .. list-table:: 
         :widths: 50 50 50 100
         :header-rows: 1
      
         * - Argument
           - Type
           - Default Value
           - Description
         * - **config_dict**
           - **<class 'dict'>**
           - 
           - Configuration dictionary, see EXAMPLE_CONFIG
         * - default_config
           - str | None
           - None
           - 
         * - keep_device_open
           - <class 'bool'>
           - True
           - Keep the device open after it is first opened
         * - payload_metadata
           - dict | None
           - None
           - 
      

   .. tab-item:: Example JSON for BOSS
   
      The following JSON strings can be used to start a HERO device representation of             :py:class:`DcamCompatibleCamera <herosdevices.hardware.hamamatsu.dcam_camera.DcamCompatibleCamera>` using             `BOSS <https://boss-eb4966.gitlab.io/>`_.
      
      .. code-block:: json
      
         {
             "_id": "orca",
             "classname": "herosdevices.hardware.hamamatsu.DcamCompatibleCamera",
             "arguments": {
                 "keep_device_open": true,
                 "config_dict": {
                     "default": {
                         "DCAM_IDPROP.TRIGGERSOURCE": "DCAMPROP.TRIGGERSOURCE.INTERNAL",
                         "DCAM_IDPROP.TRIGGERPOLARITY": "DCAMPROP.TRIGGERPOLARITY.POSITIVE",
                         "DCAM_IDPROP.EXPOSURETIME": 0.01,
                         "DCAM_IDPROP.SENSORMODE": "DCAMPROP.SENSORMODE.AREA",
                         "DCAM_IDPROP.BINNING": "DCAMPROP.BINNING._4",
                         "DCAM_IDPROP.SUBARRAYHSIZE": 200,
                         "DCAM_IDPROP.SUBARRAYVSIZE": 200,
                         "DCAM_IDPROP.SUBARRAYHPOS": 136,
                         "DCAM_IDPROP.SUBARRAYVPOS": 468,
                         "DCAM_IDPROP.SUBARRAYMODE": "DCAMPROP.MODE.ON",
                         "frame_count": 1,
                         "timeout": 5
                     }
                 }
             }
         }
      
      :sup:`from examples/hamamatsu/orca.json` 
      
      
      .. code-block:: json
      
         {
             "_id": "my_DcamCompatibleCamera",
             "classname": "herosdevices.hardware.hamamatsu.dcam_camera.DcamCompatibleCamera",
             "arguments": {
                 "config_dict": "<class 'dict'>",
                 "default_config": null,
                 "keep_device_open": true,
                 "payload_metadata": null
             }
         }
      
      :sup:`generated from signature`
   .. tab-item:: Inheritance
   
   
      .. inheritance-diagram:: herosdevices.hardware.hamamatsu.dcam_camera.DcamCompatibleCamera
      
