---
# System prepended metadata

title: Sydor Camera Note

---

Sydor Camera Note
===
<style>
.text-align-justify{
    text-align:justify;
    text-justify: distribute; //for IE瀏覽器  
}
</style>

<div class="text-align-justify">

> [Sydor Wraith sCMOS EUV/Soft X-ray detector(Product Code: WRAITH-11-2K-V)](https://sydortechnologies.com/direct-detectors/sydor-wraith/) 

## **Review from Email**
The company has provided DataViewer (on Windows) but required to install the TuCam driver.
<font color="#f00">
> #### Note:
> If the software is required to operate on the EPICS framework, the company can provide additional software.
</font>

Unfortunately, the company does not have the software development kit, but the application does support a socket interface which allows some basic controls- ==A python program could control the application and can set certain camera attributes and acquire data.==
    
:::info
#### Yoram Fisher, yoram.fisher@sydortechnologies.com 
Senior Systems Engineer, Sydor Technologies
585.278.1168 | www.SydorTechnologies.com
::: 
    

---

## **Sydor sCMOS- User Manual**
#### Principles of operation
For software overview, the detector is connected to an external computer for viewing data, saving data, and controlling device parameters such as gain and integration time. On a Windows or Linux machine, the client program ==DataViewer.exe== provides a direct user-controlled interface. ==DataViewerSettings.ini== contains camera specific settings.

For camera settings, exposure time, trigger rate, image size, and imaging mode will all impact camera performance if used in poor combinations.

#### Data viewer interface

![MainGUI](https://hackmd.io/_uploads/rJLg3TQs6.png)

The graphical user interface (GUI), DataViewer, is intended to be used for setup, data collection, live data viewing, and saving image data. The GUI can then be operated simultaneously with EPICS or Python. Not all parameters will automatically refresh in the GUI when changed through the alternate control methods.

___

## Software architecture overview
![SW_Arch](https://hackmd.io/_uploads/SJwznTXjp.png)

The most basic option for detector control is the DataViewer GUI located on the host computer. However, An EPICS plugin.dll file on the host computer offers the option to control the camera through an EPICS IOC or Python via socket protocol. Both of these options pass commands to DataViewer that are then sent to the detector electronics. ==DataViewer must be running in order these two protocols to work.== 

#### DataViewer Plugin
DataViewer supports a plug-in architecture that provides additional functions. There is an ’EPICS’ plugin that opens a listening socket on a port, and allows external control of the application by sending text strings to the socket over a Telnet-like interface.

The file ‘plugin epics.dll‘ must be placed in a folder called ’plugins’, located one directory higher than the DataViewer executable. Restart the application, and DataViewer will have a TCP server socket listening at port:
>     Listening on port 10030

    
#### Commands
Commands consist of text messages sent over the socket, terminated with CR-LF. The two basic types of commands are sets and gets.

![Commands](https://hackmd.io/_uploads/BJUC10Qja.png)


##### <font color="#f00"> Example: Use Python to control the Sydor </font>
   
The socket protocol in the EPICS Plugin that runs on the DataViewer/Host Computer can also be used for camera control with Python 3.0. DataViewer must be running as an intermediate layer between the detector electronics and Python. The computer used for camera control through Python does not have to be the Host as long as the software points to the correct IP Address in the Python program. ==This control protocol includes all required camera control, triggering, and data saving protocols.==

The DV socket class handles the command formatting described in the plug-in section, and makes setting/reading values much simpler.

```python
# program to collect sCMOS data with varying integration times
import DG645                                       # SRS box control
import sys
import os
import socket
import time
import DV_socket                                   # Data Viewer socket control

epics_cmd_port = 10030                             # EPICS port number
DV_Address = "127.0.0.1"                           # use 127.0.0.1 for local host if DataViewer is running on the same PC

# start the program
def main ( argv ) :
    dvs = DV_socket.DataViewerSocket( DV_Address )
    dvs . set ( ’ NImages ’ , 10)
    # software trigger (0) , external trigger (3)
    dvs . set (" Trigger " , 0)
    # what gain are you using ? " high " or " low " ?
    gain = high
    ##
    # select the number of files you want in range () for some short
    # integration times , 0 - based and the increment 
    # you want on the integration times in ms
    for i in range(4):
        Exp_ms = i * 500
        dvs.set(" Exposure " , Exp_ms )
        dvs.set(" q2c_SetFileName " , "./ Integ_ " + gain + str ( Exp_ms ) + ". raw " ,)
        dvs.set(" actionCapture " , 1)
        aquireTime = ( Exp_ms * 10) /1000 + 2
        time.sleep( aquireTime )
        # dvs.busy_poll(" FrameWaiting ")          # wait until the previous acquire is done before continuing

    ##
    # select the number of files you want in range () for 
    # some longer integration times , 0 - based
    # and the increment you want on the integration times in ms
    for i in range (5) :
        Exp_ms = ( i + 1) * 2000
        dvs.set(" Exposure " , Exp_ms )
        dvs.set(" q2c_SetFileName " , "./ Integ_ " + str ( Exp_ms ) + ". raw " ,)
        dvs.set(" actionCapture " , 1)
        aquireTime = ( Exp_ms * 10) /1000 + 2      # 10 images * exp_time , convert to seconds for " time " function , plus safety margin of 2
        time.sleep( aquireTime )
        # dvs.busy_poll (" FrameWaiting ")         # wait until the previous acquire is done before continuing

    ##
    # this has to be the last thing or the socket will close mid-experiment 
    # which would be sad
    dvs.epics_socket.close()

if __name__ == "__main__":
    main(sys.argv[1:])

```

The additional information can be found in [Github](https://github.com/yoramfisher/PAD_Analysis2/tree/yf-newcode/DataViewer_Python/sCMOS).
___
</div>



