wip
This commit is contained in:
@@ -11,21 +11,6 @@
|
||||
# readoutPriority: baseline
|
||||
# softwareTrigger: false
|
||||
|
||||
samx:
|
||||
readoutPriority: baseline
|
||||
deviceClass: ophyd_devices.SimPositioner
|
||||
deviceConfig:
|
||||
delay: 1
|
||||
limits:
|
||||
- -50
|
||||
- 50
|
||||
tolerance: 0.01
|
||||
update_frequency: 400
|
||||
deviceTags:
|
||||
- user motors
|
||||
enabled: true
|
||||
readOnly: false
|
||||
|
||||
timepix:
|
||||
readoutPriority: async
|
||||
description: ASI Serval Timepix Detector
|
||||
@@ -39,3 +24,14 @@ timepix:
|
||||
enabled: true
|
||||
readOnly: false
|
||||
softwareTrigger: true
|
||||
|
||||
ic1:
|
||||
readoutPriority: monitored
|
||||
description: Ionization Chamber 1
|
||||
deviceClass: ophyd.EpicsSignalRO
|
||||
deviceConfig:
|
||||
read_pv: X10DA-ES1-SAI_01:MEAN
|
||||
auto_monitor: True
|
||||
onFailure: raise
|
||||
enabled: True
|
||||
softwareTrigger: False
|
||||
|
||||
@@ -268,6 +268,20 @@ class Timepix(PSIDeviceBase, TimePixControl):
|
||||
doc="Spectra signal of the TimePix detector.",
|
||||
)
|
||||
|
||||
xes_data_accumulated_1 = Cpt(
|
||||
AsyncSignal,
|
||||
name="xes_accumulated_energy_1",
|
||||
ndim=1,
|
||||
max_size=1000,
|
||||
doc="1D time spectra for energy bin 2.",
|
||||
)
|
||||
xes_data_accumulated_2 = Cpt(
|
||||
AsyncSignal,
|
||||
name="xes_accumulated_energy_2",
|
||||
ndim=1,
|
||||
max_size=1000,
|
||||
doc="1D time spectra for energy bin 2.",
|
||||
)
|
||||
file_event = Cpt(
|
||||
FileEventSignal, name="file_event", doc="File event signal for TimePix detector."
|
||||
)
|
||||
@@ -325,6 +339,9 @@ class Timepix(PSIDeviceBase, TimePixControl):
|
||||
self._readout_time = self.MIN_DETECTOR_READOUT_TIME
|
||||
self.r_lock = threading.RLock() # Lock to access the message buffer safely
|
||||
|
||||
self.accumulated_data_e1 = None
|
||||
self.accumulated_data_e2 = None
|
||||
|
||||
def stage(self) -> list[object] | StatusBase: # type: ignore
|
||||
"""Stage the device.
|
||||
|
||||
@@ -418,12 +435,26 @@ class Timepix(PSIDeviceBase, TimePixControl):
|
||||
self.xes_data.put(
|
||||
xes_data, async_update={"type": "add", "max_shape": [None, troin, n_energy_points]}
|
||||
)
|
||||
self.xes_energy_1.put(
|
||||
xes_data[:, 0], async_update={"type": "add", "max_shape": [None, troin]}
|
||||
)
|
||||
if n_energy_points > 1:
|
||||
self.xes_energy_2.put(
|
||||
xes_data[:, 1], async_update={"type": "add", "max_shape": [None, troin]}
|
||||
if n_energy_points == 8:
|
||||
data_1 = np.sum(xes_data[:, 0:4], axis=1)
|
||||
data_2 = np.sum(xes_data[:, 4:8], axis=1)
|
||||
self.xes_energy_1.put(data_1, async_update={"type": "add", "max_shape": [None, troin]})
|
||||
self.xes_energy_2.put(data_2, async_update={"type": "add", "max_shape": [None, troin]})
|
||||
if self.accumulated_data_e1 is None:
|
||||
self.accumulated_data_e1 = data_1
|
||||
else:
|
||||
self.accumulated_data_e1 += data_1
|
||||
if self.accumulated_data_e2 is None:
|
||||
self.accumulated_data_e2 = data_2
|
||||
else:
|
||||
self.accumulated_data_e2 += data_2
|
||||
self.xes_data_accumulated_1.put(
|
||||
self.accumulated_data_e1,
|
||||
async_update={"type": "replace", "max_shape": [None, troin]},
|
||||
)
|
||||
self.xes_data_accumulated_2.put(
|
||||
self.accumulated_data_e2,
|
||||
async_update={"type": "replace", "max_shape": [None, troin]},
|
||||
)
|
||||
self.xes_spectra.put(
|
||||
xes_data.sum(axis=1), async_update={"type": "add", "max_shape": [None, troin]}
|
||||
@@ -620,6 +651,8 @@ class Timepix(PSIDeviceBase, TimePixControl):
|
||||
|
||||
def on_stage(self) -> StatusBase | None:
|
||||
"""Called while staging the device."""
|
||||
self.accumulated_data_e1 = None
|
||||
self.accumulated_data_e2 = None
|
||||
scan_msg: ScanStatusMessage = self.scan_info.msg # type: ignore
|
||||
exp_time = scan_msg.scan_parameters.get("exp_time", 0)
|
||||
if exp_time - self._readout_time <= 0:
|
||||
|
||||
Reference in New Issue
Block a user