Skip to content

Commit 79636f7

Browse files
committed
Added working version of SpectrumAnalyzer and instantiated it
1 parent a7507ee commit 79636f7

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

startup/30-detectors.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class SpectrumAnalyzer(Device):
199199
sync = Cpt(EpicsSignal, "SYS:SYNC")
200200

201201
# Detector parameters
202-
state = Cpt(EpicsSignalRO, "STATE")
202+
state = Cpt(EpicsSignalRO, "STATE", string=True)
203203
endX = Cpt(EpicsSignal, "ENDX")
204204
startY = Cpt(EpicsSignal, "STARTY")
205205
num_slice = Cpt(EpicsSignal, "NUM_SLICE")
@@ -259,19 +259,21 @@ class SpectrumAnalyzer(Device):
259259

260260
def __init__(self, *args, **kwargs):
261261
super().__init__(*args, **kwargs)
262-
self.stage_sigs.update([
263-
(self.acquire, 0),
264-
])
262+
self.stage_sigs.update(
263+
[
264+
(self.acquire, 0),
265+
]
266+
)
265267
self._status = None
266268

267269
def stage(self):
268270
self.state.subscribe(self._stage_changed, run=False)
269271
return super().stage()
270272

271-
def _stage_changed(self, value, old_value, timestamp):
273+
def _stage_changed(self, value=None, old_value=None, **kwargs):
272274
if self._status is None:
273275
return
274-
if value == 83 and old_value == 82:
276+
if value == "STANDBY" and old_value == "RUNNING":
275277
self._status.set_finished()
276278
self._status = None
277279

@@ -289,6 +291,7 @@ def unstage(self):
289291
super().unstage()
290292
self.state.unsubscribe(self._stage_changed)
291293

294+
spectrum_analyzer = SpectrumAnalyzer("XF:21ID1-ES{A1Soft}", name="spectrum_analyzer")
292295

293296
Diag1_CamH = MyDetector("XF:21IDA-BI{Diag:1-Cam:H}", name="Diag1_CamH")
294297
Diag1_CamH.hdf5.write_path_template = "/nsls2/data/esm/legacy/image_files/cam01/"

0 commit comments

Comments
 (0)