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

Update MIB simulator #159

Merged
merged 8 commits into from
Jul 30, 2024
Merged
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
2 changes: 1 addition & 1 deletion azure-pipelines-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ stages:
TOXENV: 'py311-data'
Python312:
python.version: '3.12'
TOXENV: 'py311-data'
TOXENV: 'py312-data'
variables:
TESTDATA_BASE_PATH: '/data/'
steps:
Expand Down
7 changes: 6 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ def ctx_pipelined():
cpus=num_cpus,
cudas=0,
)
executor = PipelinedExecutor(spec=spec, pin_workers=False)
executor = PipelinedExecutor(
spec=spec,
pin_workers=False,
startup_timeout=120,
cleanup_timeout=120,
)
yield ltl.LiveContext(executor=executor, plot_class=Dummy2DPlot)
finally:
if executor is not None:
Expand Down
7 changes: 7 additions & 0 deletions docs/source/changelog/bugfix/mib-simulator-fixes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Bugfix] Make the MIB simulator a bit more realistic
====================================================

* Allow multiple acquisitions per connection in triggered mode (:pr:`159`).
* Fix sequence number in continuous mode; fix generated acquisition header for
the continuous case
* Fix control socket handling
49 changes: 32 additions & 17 deletions docs/source/detectors/merlin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,45 @@ and how to run a LiberTEM UDF on the data stream.
Simulator
---------

A simple simulator for testing live acquisition without the actual hardware is
included in LiberTEM-live. It replays an MIB dataset and accepts the following
parameters:
A simple simulator that replays MIB datasets is included in LiberTEM-live.

Note that it is not a complete simulation of the Merlin software and
detector, but rather only meant for integration testing and development without
access to a real detector.

The simulator accepts the following parameters:

.. code-block:: shell

(libertem) $ libertem-live-mib-sim --help
Usage: libertem-live-mib-sim [OPTIONS] PATH

Minimal Merlin simulator. Point PATH at a .hdr file, and that mib dataset
will be replayed over the data socket.

Options:
--nav-shape <INTEGER INTEGER>...
--continuous
--cached [NONE|MEM|MEMFD]
--host TEXT Address to listen on (data, control, and
trigger sockets)
--data-port INTEGER
--control-port INTEGER
--wait-trigger Wait for a SOFTTRIGGER command on the
control port, or a trigger signal on the
trigger socket
--garbage Send garbage before trigger. Implies --wait-
trigger
--max-runs INTEGER
--help Show this message and exit.
--nav-shape <INTEGER INTEGER>...
--continuous In untriggered mode, send a single
continuous acquisition by repeating the
input file indefinitely (or `max_runs`
times)
--cached [NONE|MEM|MEMFD]
--host TEXT Address to listen on (data, control, and
trigger sockets)
--data-port INTEGER
--control-port INTEGER
--trigger-port INTEGER
--wait-trigger Wait for a SOFTTRIGGER command on the
control port, or a trigger signal on the
trigger socket
--manual-trigger Wait for a manual trigger by user input
after ARM
--garbage Send garbage before trigger. Implies --wait-
trigger
--max-runs INTEGER Maximum number of runs through the input
file in continuous mode
--help Show this message and exit.


A suitable MIB dataset for testing can be downloaded at
https://zenodo.org/record/5113449.
Expand Down
6 changes: 4 additions & 2 deletions src/libertem_live/detectors/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@
continue
except BrokenPipeError:
if "client_addr" in locals():
logger.info(f"BrokenPipeError: {locals()['client_addr']}")
logger.info(
f"{self.__class__.__name__}: BrokenPipeError: {locals()['client_addr']}"
)
else:
logger.info("BrokenPipeError")
logger.info(f"{self.__class__.__name__}: BrokenPipeError")

Check warning on line 117 in src/libertem_live/detectors/common.py

View check run for this annotation

Codecov / codecov/patch

src/libertem_live/detectors/common.py#L117

Added line #L117 was not covered by tests

continue # the other end died, but that doesn't mean we have to die
except (ConnectionResetError, ConnectionAbortedError):
Expand Down
Loading
Loading