Skip to content

Commit 79e7392

Browse files
committed
Proper stage sigs for spectrum analyzer
1 parent 48efd90 commit 79e7392

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

startup/30-detectors.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from pathlib import Path
22
from typing import Optional
3+
import time as ttime
34

45
import numpy as np
56
from bluesky.protocols import WritesStreamAssets, Readable
@@ -276,12 +277,6 @@ class SpectrumAnalyzer(Device, WritesStreamAssets, Readable):
276277

277278
def __init__(self, *args, **kwargs):
278279
super().__init__(*args, **kwargs)
279-
self.stage_sigs.update(
280-
[
281-
(self.acquire, 0),
282-
(self.file_capture, 1),
283-
]
284-
)
285280
self._status = None
286281
self._index = 0
287282
self._last_emitted_index = 0
@@ -294,6 +289,10 @@ def stage(self):
294289
"File capture must be off to stage the detector, otherwise the file will be corrupted"
295290
)
296291

292+
if self.acquire.get(as_string=True) == "RUNNING":
293+
self.stage_sigs.update([(self.acquire, 0)])
294+
self.stage_sigs.update([(self.file_capture, 1)])
295+
297296
path = _convert_path_to_posix(Path(self.file_path.get()))
298297
file_name = Path(self.file_name.get())
299298
self._full_path = str(path / file_name)
@@ -307,6 +306,7 @@ def _stage_changed(self, value=None, old_value=None, **kwargs):
307306
if self._status is None:
308307
return
309308
if value == "STANDBY" and old_value == "RUNNING":
309+
ttime.sleep(1.0)
310310
self._status.set_finished()
311311
self._index += 1
312312
self._status = None

0 commit comments

Comments
 (0)