mirror of
https://github.com/ivan-usov-org/bec.git
synced 2025-04-22 02:20:02 +02:00
docs: update documentation on the simulation
This commit is contained in:
parent
ae07b9fab6
commit
0ec3dac85f
88
docs/source/assets/simulation_context_diagram.drawio
Normal file
88
docs/source/assets/simulation_context_diagram.drawio
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<mxfile host="Electron" modified="2024-03-05T07:29:02.714Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/23.1.5 Chrome/120.0.6099.109 Electron/28.1.0 Safari/537.36" etag="7GHwNhR7WAC2rOnc1UU4" scale="1" border="0" version="23.1.5" type="device">
|
||||||
|
<diagram name="Page-1" id="Cfy-Rn5kCS3EPLz5Mwja">
|
||||||
|
<mxGraphModel dx="1114" dy="686" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||||
|
<root>
|
||||||
|
<mxCell id="0" />
|
||||||
|
<mxCell id="1" parent="0" />
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=13;" parent="1" source="h67aKU-kCp2sBK-wfrBz-3" target="h67aKU-kCp2sBK-wfrBz-8" edge="1">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=13;" parent="1" source="h67aKU-kCp2sBK-wfrBz-3" target="h67aKU-kCp2sBK-wfrBz-17" edge="1">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-3" value="sim.py" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;fontSize=13;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="274" y="160" width="140" height="120" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-4" value="SimPositioner<span style="white-space: pre; font-size: 13px;">	</span>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;fontSize=13;" parent="h67aKU-kCp2sBK-wfrBz-3" vertex="1">
|
||||||
|
<mxGeometry y="30" width="140" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-5" value="SimMonitor" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;fontSize=13;" parent="h67aKU-kCp2sBK-wfrBz-3" vertex="1">
|
||||||
|
<mxGeometry y="60" width="140" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-6" value="SimCamera" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;fontSize=13;" parent="h67aKU-kCp2sBK-wfrBz-3" vertex="1">
|
||||||
|
<mxGeometry y="90" width="140" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-21" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=classic;endFill=1;startArrow=classic;startFill=1;fontSize=13;" parent="1" source="h67aKU-kCp2sBK-wfrBz-7" target="h67aKU-kCp2sBK-wfrBz-15" edge="1">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-22" value="- sim_state <br style="font-size: 13px;">(hosts simulated state)" style="edgeLabel;html=1;align=left;verticalAlign=middle;resizable=0;points=[];fontSize=13;" parent="h67aKU-kCp2sBK-wfrBz-21" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="-0.25" y="-2" relative="1" as="geometry">
|
||||||
|
<mxPoint x="-60" y="15" as="offset" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-7" value="sim_signals.py" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;fontSize=13;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="414" y="30" width="140" height="90" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-8" value="SettableSignal" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;fontSize=13;" parent="h67aKU-kCp2sBK-wfrBz-7" vertex="1">
|
||||||
|
<mxGeometry y="30" width="140" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-9" value="ReadOnlySignal" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;fontSize=13;" parent="h67aKU-kCp2sBK-wfrBz-7" vertex="1">
|
||||||
|
<mxGeometry y="60" width="140" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-15" value="sim_data.py" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;fontSize=13;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="414" y="320" width="140" height="120" as="geometry">
|
||||||
|
<mxRectangle x="510" y="280" width="110" height="30" as="alternateBounds" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-16" value="SimulatedDataBase" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;fontSize=13;" parent="h67aKU-kCp2sBK-wfrBz-15" vertex="1">
|
||||||
|
<mxGeometry y="30" width="140" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-17" value="SimulatedDataMonitor" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;fontSize=13;" parent="h67aKU-kCp2sBK-wfrBz-15" vertex="1">
|
||||||
|
<mxGeometry y="60" width="140" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-18" value="SimulatedDataCamera" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;fontSize=13;" parent="h67aKU-kCp2sBK-wfrBz-15" vertex="1">
|
||||||
|
<mxGeometry y="90" width="140" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-28" value="assigns method to override&nbsp;<br style="font-size: 13px;">behaviour of a signal of&nbsp;<br style="font-size: 13px;">a simulated device" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=13;" parent="1" source="h67aKU-kCp2sBK-wfrBz-23" target="h67aKU-kCp2sBK-wfrBz-5" edge="1">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-23" value="sim_frameworks.py" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;fontSize=13;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="20" y="320" width="140" height="90" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-24" value="<div style="color: rgb(36, 41, 46); background-color: rgb(255, 255, 255); line-height: 18px; font-size: 13px;"><font face="Helvetica" style="font-size: 13px;">SlitProxy</font></div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;fontSize=13;" parent="h67aKU-kCp2sBK-wfrBz-23" vertex="1">
|
||||||
|
<mxGeometry y="30" width="140" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-25" value="<div style="color: rgb(36, 41, 46); background-color: rgb(255, 255, 255); line-height: 18px; font-size: 13px;"><font face="Helvetica" style="font-size: 13px;">H5ImageReplayProxy</font></div>" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;fontSize=13;" parent="h67aKU-kCp2sBK-wfrBz-23" vertex="1">
|
||||||
|
<mxGeometry y="60" width="140" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="h67aKU-kCp2sBK-wfrBz-29" value="overrides _compute_method&nbsp;<br style="font-size: 13px;">from sim_data class" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.486;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;startArrow=classic;startFill=1;exitX=0.486;exitY=1.033;exitDx=0;exitDy=0;exitPerimeter=0;fontSize=13;" parent="1" source="h67aKU-kCp2sBK-wfrBz-25" target="h67aKU-kCp2sBK-wfrBz-18" edge="1">
|
||||||
|
<mxGeometry x="-0.4341" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset" />
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="eiqkBEc7D3UI14zJ81t_-2" value="<div style="text-align: justify; font-size: 13px;"><br style="font-size: 13px;"></div>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#000000;dashed=1;strokeColor=#9673a6;strokeWidth=1.5;fillStyle=solid;opacity=12;gradientColor=none;fontSize=13;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="270" y="20" width="290" height="460" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="NRfVWOsRHMjiBT5IuF4j-1" value="<font size="1" style=""><b style="font-size: 16px;">Device</b></font>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;strokeColor=none;fontSize=13;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="273" y="20" width="50" height="20" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="NRfVWOsRHMjiBT5IuF4j-2" value="<font size="1" style=""><b style="font-size: 16px;">DeviceProxy</b></font>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;strokeColor=none;fontSize=13;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="30" y="180" width="50" height="20" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="NRfVWOsRHMjiBT5IuF4j-3" value="<div style="text-align: justify; font-size: 13px;"><br style="font-size: 13px;"></div>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#67AB9F;dashed=1;strokeColor=#9673a6;strokeWidth=1.5;fillStyle=solid;opacity=15;gradientColor=none;fontSize=13;" vertex="1" parent="1">
|
||||||
|
<mxGeometry y="180" width="250" height="300" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
</root>
|
||||||
|
</mxGraphModel>
|
||||||
|
</diagram>
|
||||||
|
</mxfile>
|
BIN
docs/source/assets/simulation_context_diagram.png
Normal file
BIN
docs/source/assets/simulation_context_diagram.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
117
docs/source/developer/bec_sim.md
Normal file
117
docs/source/developer/bec_sim.md
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
(developer.bec_sim)=
|
||||||
|
# BEC Simulation
|
||||||
|
|
||||||
|
The BEC simulation framework comprises a set of simulated devices. These devices offer a platform for developers to explore, test, or add new features to the core libraries of BEC and BEC-Widgets. Additionally, the end-to-end test framework enables the simulation of user behavior at the beamline, facilitating the testing of newly developed features against common user commands. These end-to-end tests encompass various scans, motions, and scenarios, such as requesting a motor to move beyond its limits or simulating system recovery from user interruptions (CTRL-C). Moreover, the framework allows advanced users to develop scripts, GUIs, or data processing tools in parallel, preparing for upcoming beamtimes.
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
```{figure} ../assets/simulation_context_diagram.png
|
||||||
|
Architecture Diagram:
|
||||||
|
The BEC simulation currently hosts three main devices: `SimMonitor`, `SimPositioner`, and `SimCamera`. Their state, as well as readback value, can be configured within the simulation_state of the device. Additionally, we provide two examples of `DeviceProxies` demonstrating how multiple devices can be linked within the simulation to imitate specific scenarios.
|
||||||
|
```
|
||||||
|
|
||||||
|
This architecture diagram illustrates the relevant classes for the simulation and their interconnections. To comprehend individual components fully, we recommend reading the following sections with the architecture in mind.
|
||||||
|
|
||||||
|
## Simulated Devices
|
||||||
|
The core of the simulation provides a range of devices that allow the simulation of monitors (`SimMonitor`), motors (`SimPositioner`), or cameras (`SimCamera`). Although these devices are simulated, we inherit from [Ophyd](https://nsls-ii.github.io/ophyd/) , ensuring compliance with the structure prescribed for devices within Ophyd. Each device can host different signals, for which we have created two custom [Signals](https://nsls-ii.github.io/ophyd/signals.html): a `SettableSignal` for storing configuration signals such as velocity or num_images, with read and write access, and a `ReadOnlySignal` for read-only signals. The computation logic for the readback value, as well as the storage of all signal states, is housed in sim_data.
|
||||||
|
|
||||||
|
For example, the readback of the `SimMonitor` device can be configured to return values calculated based on a range of models from [LMFIT](https://lmfit.github.io/lmfit-py/builtin_models.html), together with a reference position defined by a motor. For `SimCamera`, we have implemented two custom readback functions allowing simulation of a multivariate Gaussian or constant readback. Noise can be added to all signals, and we also allow hot, dead, or fluctuating pixels to be added to the readback of `SimCamera`.
|
||||||
|
|
||||||
|
## Simulation Frameworks
|
||||||
|
To more realistically mimic the behavior of a beamline, we have introduced a new type of device called a `DeviceProxy`. We have provided two examples for `SimCamera`. The first, H5ImageReplayProxy, allows you to replay data from an existing h5 file. This proxy is configured through the deviceConfig, specifying the h5 file location and the entry with the images composed as an array with dimensions (slice, x, y). The simulation will wrap if your scan exceeds the number of images in the file and play them from the start. Notably, this proxy implements the replay capability within the scope of BEC scans. The second simulation, `SlitProxy`, allows the linking of single or multiple motors' positions to be taken into account when computing the readback for `SimCamera`, e.g., slit widths.
|
||||||
|
|
||||||
|
```{Note}
|
||||||
|
Proxies override the `_compute` method from the signal of the device they are configured to act upon. They can be enabled or disabled from the command-line interface for simple usage.
|
||||||
|
```
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The simulation framework for each simulated device can be accessed through `dev.<devname>.sim`. We have implemented three methods and a property to facilitate easy access configuration and configuration of the simulation parameters. These are `dev.<devname>.sim.sim_get_models()`, `dev.<devname>.sim.sim_select_model()`, `dev.<devname>.sim.sim_show_all()`, and `dev.<devname>.sim.sim_params`. With these functions, you can configure the simulation of your device as needed.
|
||||||
|
|
||||||
|
### Configuration of simulated devices
|
||||||
|
As mentioned earlier, `SimMonitor` and `SimCamera` offer different simulation types. To receive a list of strings with all available simulation types for `SimMonitor`, you can use the code below:
|
||||||
|
|
||||||
|
```ipython
|
||||||
|
• demo [11/171] ❯❯ dev.bpm4i.sim.sim_get_models()
|
||||||
|
Out[11]:
|
||||||
|
['BreitWignerModel',
|
||||||
|
'ConstantModel',
|
||||||
|
'DampedHarmonicOscillatorModel',
|
||||||
|
'DampedOscillatorModel',
|
||||||
|
'DoniachModel',
|
||||||
|
'ExponentialGaussianModel',
|
||||||
|
'ExponentialModel',
|
||||||
|
'GaussianModel',
|
||||||
|
'LinearModel',
|
||||||
|
'LognormalModel',
|
||||||
|
'LorentzianModel',
|
||||||
|
'MoffatModel',
|
||||||
|
'ParabolicModel',
|
||||||
|
'Pearson4Model',
|
||||||
|
'Pearson7Model',
|
||||||
|
'PolynomialModel',
|
||||||
|
'PowerLawModel',
|
||||||
|
'PseudoVoigtModel',
|
||||||
|
'QuadraticModel',
|
||||||
|
'RectangleModel',
|
||||||
|
'SineModel',
|
||||||
|
'SkewedGaussianModel',
|
||||||
|
'SkewedVoigtModel',
|
||||||
|
'SplitLorentzianModel',
|
||||||
|
'StepModel',
|
||||||
|
'StudentsTModel',
|
||||||
|
'ThermalDistributionModel',
|
||||||
|
'VoigtModel']
|
||||||
|
```
|
||||||
|
By default, monitors are initialized with the *ConstantModel* and a uniform noise pattern. To change this for the device `dev.bpm4i` to first simulate a *Gaussian* function and then use *Poisson* noise, follow the steps below:
|
||||||
|
```ipython
|
||||||
|
• demo [12/171] ❯❯ dev.bpm4i.sim.sim_select_model("GaussianModel")
|
||||||
|
+------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
|
| Currently active model: <lmfit.Model: Model(gaussian)> |
|
||||||
|
+----------------------------------------------------------+-------------------+-----------------------------------------------------------+
|
||||||
|
| Parameter | Value | Type |
|
||||||
|
+----------------------------------------------------------+-------------------+-----------------------------------------------------------+
|
||||||
|
| amplitude | 100 | <class 'int'> |
|
||||||
|
| center | 0 | <class 'int'> |
|
||||||
|
| sigma | 1 | <class 'int'> |
|
||||||
|
| fwhm | 2.35482 | <class 'float'> |
|
||||||
|
| height | 39.89423 | <class 'float'> |
|
||||||
|
| noise | uniform | <enum 'NoiseType'> |
|
||||||
|
| noise_multiplier | 10 | <class 'int'> |
|
||||||
|
| ref_motor | samx | <class 'str'> |
|
||||||
|
+----------------------------------------------------------+-------------------+-----------------------------------------------------------+
|
||||||
|
• demo [13/171] ❯❯ dev.bpm4i.sim.sim_params = {"noise" : "poisson"}
|
||||||
|
• demo [14/171] ❯❯ dev.bpm4i.sim.sim_params
|
||||||
|
Out[14]:
|
||||||
|
{'amplitude': 100,
|
||||||
|
'center': 0,
|
||||||
|
'sigma': 1,
|
||||||
|
'fwhm': 2.35482,
|
||||||
|
'height': 39.89423,
|
||||||
|
'noise': 'poisson',
|
||||||
|
'noise_multiplier': 10,
|
||||||
|
'ref_motor': 'samx'}
|
||||||
|
```
|
||||||
|
```{note}
|
||||||
|
`dev.<devname>.sim.sim_params` is a property and by assigning a new dictionary to it, you will not override all parameters but update the current set of parameters stored in the property. It will raise if you are trying to set a key to an irregular value, e.g. non existing model, or in case of a key does not exist in sim_params.
|
||||||
|
```
|
||||||
|
Finally, you can use `dev.bpm4i.sim.sim_show_all()` to obtain a comprehensive printout of the currently active model, all available methods, and the available models for this device. Similarly, you may configure the `SimCamera`, which implements only a limited scope of simulation models, as shown below:
|
||||||
|
```ipython
|
||||||
|
• demo [15/171] ❯❯ dev.eiger.sim.sim_get_models()
|
||||||
|
Out[15]: ['constant', 'gaussian']
|
||||||
|
```
|
||||||
|
### Simulation scenarios
|
||||||
|
As mentioned earlier, the simulation frameworks enable us to replay certain simulation scenarios easily. The two current examples serve as templates for implementing new scenarios. New implementations need to inherit from the abstract class `DeviceProxy` and implement the `_compute` method, which overrides the computation method for the given signal. An example config entry for the given scenarios is stored in their docstring. For example, for the class `H5ImageReplayProxy`:
|
||||||
|
```yaml
|
||||||
|
h5_image_sim:
|
||||||
|
readoutPriority: baseline
|
||||||
|
deviceClass: H5ImageReplayProxy
|
||||||
|
deviceConfig:
|
||||||
|
eiger:
|
||||||
|
signal_name: image
|
||||||
|
file_source: /path/to/h5file.h5
|
||||||
|
h5_entry: /entry/data
|
||||||
|
enabled: true
|
||||||
|
readOnly: false
|
||||||
|
```
|
||||||
|
You will need to adapt *file_source* and *h5_entry* to point to an h5 file for the device to work. The device itself becomes available in the client like any other device and can be enabled and disabled on demand. This allows the user to control whether data is to be replayed from the file.
|
||||||
|
|
||||||
|
|
@ -13,6 +13,7 @@ contributing/
|
|||||||
install_developer_env/
|
install_developer_env/
|
||||||
vscode/
|
vscode/
|
||||||
bec_cli/
|
bec_cli/
|
||||||
|
bec_sim/
|
||||||
bec_gui/
|
bec_gui/
|
||||||
bec_config/
|
bec_config/
|
||||||
data_access/
|
data_access/
|
||||||
@ -33,6 +34,7 @@ Here, we aim to provide you with all the essential information to kickstart your
|
|||||||
* [Installing Developer Environment](#developer.install_developer_env): Set up your developer environment to work with BEC.
|
* [Installing Developer Environment](#developer.install_developer_env): Set up your developer environment to work with BEC.
|
||||||
* [Developing with Visual Studio Code](#developer.vscode): Learn how to set up Visual Studio Code for developing Python applications and how to use it to work with BEC.
|
* [Developing with Visual Studio Code](#developer.vscode): Learn how to set up Visual Studio Code for developing Python applications and how to use it to work with BEC.
|
||||||
* [BEC Command Line Interface (CLI)](#developer.bec_cli): Explore the command-line tool and customize its behaviour.
|
* [BEC Command Line Interface (CLI)](#developer.bec_cli): Explore the command-line tool and customize its behaviour.
|
||||||
|
* [BEC Simulation Framework](#developer.bec_sim): The simulation framework allows you to explore, test or develop within the BEC ecosystem with direct feedback.
|
||||||
* [BEC Graphical User Interface (GUI)](#developer.bec_gui): Learn how to use the graphical user interface to interact with BEC and explore how to create your own GUIs.
|
* [BEC Graphical User Interface (GUI)](#developer.bec_gui): Learn how to use the graphical user interface to interact with BEC and explore how to create your own GUIs.
|
||||||
* [BEC Configuration](#developer.bec_config): Learn about the different ways of customizing BEC to your needs.
|
* [BEC Configuration](#developer.bec_config): Learn about the different ways of customizing BEC to your needs.
|
||||||
* [Data Access](#developer.data_access): Explore different ways of accessing data acquired with BEC.
|
* [Data Access](#developer.data_access): Explore different ways of accessing data acquired with BEC.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user