Example: Perkin-Elmer EPICS Area Detector

In this example, we’ll show how to create an ophyd object that operates a Perkin-Elmer Camera as a detector. We’ll start with the Pilatus example.

The only difference from the Pilatus example is the detector class (PerkinElmerDetector), the PV prefix (we’ll use PE1: here), and possibly the plugin version. For simplicity, we’ll assume the same version of EPICS Area Detector (3.7) is used in this example. We’ll use a different object name, det_pe, for this detector and different directories (where the write and read directories are the same).

Follow the Pilatus Support Code Explained to learn more about the choices made below. The process is similar.

Perkin-Elmer Support Code

Here is the Perkin-Elmer support, derived from the Pilatus support (Example: Pilatus EPICS Area Detector).

Perkin-Elmer Area Detector support, writing HDF5 image files
 1from ophyd import ADComponent
 2from ophyd import ImagePlugin
 3from ophyd import PerkinElmerDetector
 4from ophyd import SingleTrigger
 5from ophyd.areadetector.filestore_mixins import FileStoreHDF5IterativeWrite
 6from ophyd.areadetector.plugins import HDF5Plugin_V34
 7import os
 8
 9IMAGE_FILES_ROOT = "/local/data"
10TEST_IMAGE_DIR = "test/"
11
12class MyHDF5Plugin(FileStoreHDF5IterativeWrite, HDF5Plugin_V34): ...
13
14class MyPerkinElmerDetector(SingleTrigger, PerkinElmerDetector):
15    """Perkin-Elmer detector"""
16
17    image = ADComponent(ImagePlugin, "image1:")
18    hdf1 = ADComponent(
19        MyHDF5Plugin,
20        "HDF1:",
21        write_path_template=os.path.join(
22            IMAGE_FILES_ROOT, TEST_IMAGE_DIR
23        ),
24    )
25
26det_pe = MyPerkinElmerDetector("PE1:", name="det_pe")
27det_pe.hdf1.create_directory.put(-5)
28det_pe.cam.stage_sigs["image_mode"] = "Single"
29det_pe.cam.stage_sigs["num_images"] = 1
30det_pe.cam.stage_sigs["acquire_time"] = 0.1
31det_pe.cam.stage_sigs["acquire_period"] = 0.105
32det_pe.hdf1.stage_sigs["lazy_open"] = 1
33det_pe.hdf1.stage_sigs["compression"] = "LZ4"
34det_pe.hdf1.stage_sigs["file_template"] = "%s%s_%3.3d.h5"
35del det_pe.hdf1.stage_sigs["capture"]
36det_pe.hdf1.stage_sigs["capture"] = 1