This commit is contained in:
@@ -137,6 +137,13 @@ class FILEWRITEMODE(int, enum.Enum):
|
||||
STREAM = 2
|
||||
|
||||
|
||||
class IMAGEMODE(int, enum.Enum):
|
||||
"""Values for ImageMode PV"""
|
||||
|
||||
SINGLE = 0
|
||||
MULTIPLE = 1
|
||||
|
||||
|
||||
def load_pixel_map_from_json(file_path: str) -> PixelMap:
|
||||
"""Load a pixel map from a JSON file.
|
||||
|
||||
@@ -644,6 +651,8 @@ class Timepix(PSIDeviceBase, TimePixControl):
|
||||
self.cam.exposure_mode.set(EXPOSUREMODE.TIMED).wait(timeout=self._pv_timeout)
|
||||
# Reset array counter on connect
|
||||
self.cam.array_counter.set(0).wait(timeout=self._pv_timeout)
|
||||
# Set image mode to multiple
|
||||
self.cam.image_mode.set(IMAGEMODE.MULTIPLE).wait(timeout=self._pv_timeout)
|
||||
|
||||
# ------------------
|
||||
# Prepare file writing through AD HDF5 plugin
|
||||
@@ -715,7 +724,7 @@ class Timepix(PSIDeviceBase, TimePixControl):
|
||||
self.hdf.file_name.set(file_name).wait(5)
|
||||
# Setup file writing for the total expected number of images
|
||||
self.hdf.num_capture.set(self._n_images).wait(5)
|
||||
if self.hdf.enable.get() == 1:
|
||||
if self.hdf.enable.get() == "Enable":
|
||||
self.hdf.capture.put(1)
|
||||
self.file_event.put(
|
||||
file_path=self._full_path,
|
||||
@@ -758,11 +767,15 @@ class Timepix(PSIDeviceBase, TimePixControl):
|
||||
status_camera = CompareStatus(
|
||||
self.cam.acquire_busy, ACQUIRESTATUS.DONE, timeout=self._pv_timeout
|
||||
)
|
||||
status_writer = CompareStatus(
|
||||
self.hdf.capture, ACQUIRESTATUS.ACQUIRING, timeout=self._pv_timeout
|
||||
)
|
||||
status = status_camera & status_writer
|
||||
|
||||
status_writer = None
|
||||
if self.hdf.enable.get() == "Enable":
|
||||
status_writer = CompareStatus(
|
||||
self.hdf.capture, ACQUIRESTATUS.ACQUIRING, timeout=self._pv_timeout
|
||||
)
|
||||
if status_writer:
|
||||
status = status_camera & status_writer
|
||||
else:
|
||||
status = status_camera
|
||||
self.cancel_on_stop(status)
|
||||
return status
|
||||
|
||||
@@ -821,7 +834,7 @@ class Timepix(PSIDeviceBase, TimePixControl):
|
||||
# Status Writer
|
||||
st1 = CompareStatus(self.hdf.capture, ACQUIRESTATUS.DONE)
|
||||
status_writer = None
|
||||
if self.hdf.enable.get() == 1:
|
||||
if self.hdf.enable.get() == "Enable":
|
||||
st2 = CompareStatus(self.hdf.write_file, ACQUIRESTATUS.DONE)
|
||||
st3 = ExceptionStatus(self.hdf.write_status, 0, operation="!=")
|
||||
status_written_images = CompareStatus(self.hdf.num_captured, self._n_images)
|
||||
@@ -844,7 +857,9 @@ class Timepix(PSIDeviceBase, TimePixControl):
|
||||
|
||||
def _complete_callback(self, status: CompareStatus) -> None:
|
||||
"""Callback for when the device completes a scan."""
|
||||
if self.hdf.enable.get() != 1: # TODO: Not sure if we should support disabled file writing.
|
||||
if (
|
||||
self.hdf.enable.get() == "Enable"
|
||||
): # TODO: Not sure if we should support disabled file writing.
|
||||
return
|
||||
if status.success:
|
||||
self.file_event.put(
|
||||
|
||||
Reference in New Issue
Block a user