File: gec_camera.py

package info (click to toggle)
extra-data 1.20.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 968 kB
  • sloc: python: 10,423; makefile: 4
file content (58 lines) | stat: -rw-r--r-- 2,092 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from .base import DeviceBase

class GECCamera(DeviceBase):
    control_keys = [
        ('acquisitionTime', 'f4', ()),
        ('binningX', 'i4', ()),
        ('binningY', 'i4', ()),
        ('coolingLevel', 'i4', ()),
        ('cropLines', 'i4', ()),
        ('enableBiasCorrection', 'u1', ()),
        ('enableBurstMode', 'u1', ()),
        ('enableCooling', 'u1', ()),
        ('enableCropMode', 'u1', ()),
        ('enableExtTrigger', 'u1', ()),
        ('enableShutter', 'u1', ()),
        ('enableSync', 'u1', ()),
        ('exposureTime', 'i4', ()),
        ('firmwareVersion', 'i4', ()),
        ('modelId', 'i4', ()),
        ('numPixelInX', 'i4', ()),
        ('numPixelInY', 'i4', ()),
        ('numberOfCoolingLevels', 'i4', ()),
        ('numberOfMeasurements', 'i4', ()),
        ('pixelSize', 'f4', ()),
        ('readOutSpeed', 'i4', ()),
        ('shutterCloseTime', 'i4', ()),
        ('shutterOpenTime', 'i4', ()),
        ('shutterState', 'i4', ()),
        ('syncHigh', 'u1', ()),
        ('targetTemperature', 'i4', ()),
        ('temperatureBack', 'f4', ()),
        ('temperatureSensor', 'f4', ()),
        ('triggerTimeOut', 'i4', ()),
        ('updateInterval', 'i4', ()),
    ]

    # Technically, only the part before the / is the output channel.
    # But there is a structure associated with the part one level after that,
    # and we don't know what else to call it.
    output_channels = ('daqOutput/data',)

    instrument_keys = [
        ('image/bitsPerPixel', 'i4', ()),
        ('image/dimTypes', 'i4', (2,)),
        ('image/dims', 'u8', (2,)),
        ('image/encoding', 'i4', ()),
        ('image/pixels', 'u2', (255, 1024)),
        ('image/roiOffsets', 'u8', (2,)),
    ]

    def write_instrument(self, f):
        super().write_instrument(f)

        # Fill in some fixed metadata about the image
        for channel in self.output_channels:
            image_grp = 'INSTRUMENT/%s:%s/image/' % (self.device_id, channel)
            f[image_grp + 'bitsPerPixel'][:self.nsamples] = 16
            f[image_grp + 'dims'][:self.nsamples] = [1024, 255]