Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes to eiger triggering #95

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions examples/configs/eiger/eiger-trigger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- type: tickit.devices.signal_generator.EpicsSignalGenerator
name: gen
inputs: {}
- type: tickit_devices.eiger.Eiger
inputs:
trigger:
component: gen
port: gate
name: eiger
7 changes: 6 additions & 1 deletion src/tickit_devices/eiger/eiger.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ async def abort(self) -> None:

The detector will immediately stop acquiring frames and disarm itself.
"""
self._abort()

def _abort(self) -> None:
self._set_state(State.IDLE)
self.stream.end_series(self._series_id)

Expand All @@ -176,7 +179,9 @@ def update(self, time: SimTime, inputs: Inputs) -> DeviceUpdate[Outputs]:
LOGGER.debug("Ending Series...")
self._set_state(State.IDLE)
self.stream.end_series(self._series_id)
if inputs.get("trigger", False):

trigger_high = inputs.get("trigger", False)
if trigger_high and self.settings.trigger_mode == "exts" and self._is_in_state(State.READY):
self._begin_acqusition_mode()
# Should have another update immediately to begin acquisition
return DeviceUpdate(self.Outputs(), SimTime(time))
Expand Down
3 changes: 3 additions & 0 deletions src/tickit_devices/eiger/eiger_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class EigerSettings:
trigger_mode: str = field(
default="exts", metadata=rw_str(allowed_values=["exts", "ints", "exte", "inte"])
)
trigger_start_delay: float = field(
default=0.0, metadata=rw_float()
)
two_theta_increment: float = field(default=0.0, metadata=rw_float())
two_theta_start: float = field(default=0.0, metadata=rw_float())
wavelength: float = field(default=1.0, metadata=rw_float())
Expand Down
2 changes: 2 additions & 0 deletions tests/eiger/test_eiger_adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ def test_after_update(mocker: MockerFixture) -> None:
test_data = [b"data", b"some more data"]

# Mock consume_data to return with data the first time and nothing the second time
# Patch consume_data to return with data the first time and nothing the second time
device_mock = mocker.MagicMock()
device_mock.stream.consume_data.side_effect = [test_data, []]

zmq_adapter = EigerZMQAdapter(device_mock)
add_mock = mocker.patch.object(zmq_adapter, "add_message_to_stream")

# Test after_update only calls add_message_to_stream with non-empty data
# First after_update should only call add_message_to_stream with non-empty data
zmq_adapter.after_update()
add_mock.assert_called_once_with(test_data)
add_mock.reset_mock()
Expand Down
Loading