Skip to content

Commit

Permalink
Get and set some of the properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ivalaginja committed Apr 2, 2024
1 parent 9174d38 commit ba8122c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions catkit2/services/hamamatsu_camera/hamamatsu_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def open(self):
', must be one of ' +
str(list(self.pixel_formats.keys())))
self.log.info('Using pixel format: %s', self.current_pixel_format)
# self.cam.set_pixel_format(self.pixel_formats[self.current_pixel_format]) # TODO
self.cam.prop_setvalue(dcam.DCAM_IDPROP.IMAGE_PIXELTYPE, self.pixel_formats[self.current_pixel_format])

# Set device values from config file (set width and height before offsets)
offset_x = self.config.get('offset_x', 0)
Expand Down Expand Up @@ -258,7 +258,7 @@ def get_temperature(self):
float:
The temperature of the camera in degrees Celsius.
"""
return self.cam.DeviceTemperature.get() # TODO
return self.cam.prop_getvalue(dcam.DCAM_IDPROP.SENSORTEMPERATURE)

@property
def exposure_time(self):
Expand All @@ -269,24 +269,24 @@ def exposure_time(self):
Returns:
--------
int:
The exposure time in microseconds. # TODO
float:
The exposure time in seconds.
"""
return self.cam.ExposureTime.get() # TODO
return self.cam.prop_getvalue(dcam.DCAM_IDPROP.EXPOSURETIME)

@exposure_time.setter
def exposure_time(self, exposure_time: int):
def exposure_time(self, exposure_time: float):
"""
Set the exposure time in microseconds.
This property can be used to set the exposure time of the camera.
Parameters
----------
exposure_time : int
The exposure time in microseconds. # TODO
exposure_time : float
The exposure time in seconds.
"""
self.cam.ExposureTime.set(exposure_time) # TODO
self.cam.prop_setvalue(dcam.DCAM_IDPROP.EXPOSURETIME, exposure_time)

@property
def gain(self):
Expand Down Expand Up @@ -356,7 +356,7 @@ def sensor_width(self):
int:
The width of the sensor in pixels.
"""
return self.cam.SensorWidth.get() # TODO
return self.cam.prop_getvalue(dcam.DCAM_IDPROP.IMAGE_WIDTH) # TODO: Is this sensor or image width?

@property
def sensor_height(self):
Expand All @@ -370,7 +370,7 @@ def sensor_height(self):
int:
The height of the sensor in pixels.
"""
return self.cam.SensorHeight.get() # TODO
return self.cam.prop_getvalue(dcam.DCAM_IDPROP.IMAGE_HEIGHT) # TODO: Is this sensor or image height?

@property
def width(self):
Expand Down

0 comments on commit ba8122c

Please sign in to comment.