From 33841cb1122d8ab66d6b6f015f30747d4184a05b Mon Sep 17 00:00:00 2001 From: arrell_c Date: Wed, 12 Feb 2025 17:56:47 +0100 Subject: [PATCH] Update Web app startup --- Web-app-startup.md | 141 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 124 insertions(+), 17 deletions(-) diff --git a/Web-app-startup.md b/Web-app-startup.md index cb14340..b23292a 100644 --- a/Web-app-startup.md +++ b/Web-app-startup.md @@ -1,30 +1,137 @@ -## Startup options on the web server -Several tools are being added to the web server to add efficient startups. -### Save and restore for camera settings -Without a save and restore tool for SwissFEL camera settings, this tool sets listed camera settings for **Basler** and **PCO edge** cameras. Please note setting the configuration will stop selected running cameras for around 1 second and overwrite current settings. +# Startup Options on the Web Server + +Several tools are available on the web server to **initialize and restore camera and spectrometer settings efficiently**. These tools ensure that **EPICS settings match the configurations stored in the camera server**, preventing data acquisition issues due to misconfigurations. + +--- + +## Save and Restore for Camera Settings + +SwissFEL cameras **do not** have a built-in save-and-restore function for settings. This tool allows **Basler** and **PCO edge** cameras to be **configured with predefined settings stored in the camera server**. + +> **⚠️ Important:** Applying saved settings **momentarily stops running cameras (~1 second)** and **overwrites current settings**. ### Operation -The configuration restore script is set from https://sf-photodiag-test.psi.ch/ under the **Startup** tab. Cameras are grouped (e.g, Beamline Aramis, Beamline Athos.....), and by pressing the desired button all cameras under that group name are set **if their configuration file contains a `hardware_configuration` dictionary** - +The **Camera Settings Panel** is accessible via **[https://sf-photodiag-test.psi.ch/](https://sf-photodiag-test.psi.ch/)** under the **Startup** tab. -### Camera group -The tool uses the existing `group` field in the camera configuration. This is how the cameras are group by the screen panel etc. Currently used groups are: -- Beamline Aramis -- Beamline Athos +Cameras are **grouped by beamline** (e.g., **Beamline Aramis, Beamline Athos, etc.**). **Pressing the relevant button applies settings to all cameras in the selected group**, provided that their configuration file contains a `hardware_configuration` dictionary. -Any group can be easily added to the tool. +### Camera Grouping -### Database +The tool uses the **`group` field** in the camera configuration to organize cameras into logical groups for easier bulk operations. Currently used groups include: -After filtering by camera group, the tool uses the camera configuration files on the camera server (accessible via CSM or API) as a database for the settings. Setting are contained in a dictionary called "hardware_configuration" in the camera configuration: +- **Beamline Aramis** +- **Beamline Athos** -```` +Other groups **can be added** by modifying the camera configurations. + +### Database and Configuration Structure + +The tool retrieves camera settings from configuration files stored on the **camera server**, accessible via **CSM or API**. Settings are stored in a dictionary called **`"hardware_configuration"`**, which contains key-value pairs corresponding to **EPICS process variables (PVs)**. + +#### Example Camera Configuration + +```json "hardware_configuration": { "EXPOSURE": 9.9, "HSSPEED": 1, "REGIONX_START": 1, "REGIONY_START": 500 - }, -```` -where the item names are the suffix of the PV name of the camera PV to set. For example, for the camera `SARFE10-PSSS059` the item in the dictionary above `EXPOSURE` sets the PV `SARFE10-PSSS059:EXPOSURE` to 9.9. To add settings for a desired camera, simply add the dictionary (if not already present) to the camera config file and add the items that should be restored. \ No newline at end of file +} +``` + +Each key in `"hardware_configuration"` corresponds to a **PV suffix** for the respective camera. For example, for the camera **`SARFE10-PSSS059`**, the `"EXPOSURE"` setting will update the EPICS PV: + +```plaintext +SARFE10-PSSS059:EXPOSURE → 9.9 +``` + +> **Adding New Settings:** +To include additional settings for a camera, **edit its configuration file** in the camera server, ensure the `"hardware_configuration"` dictionary is present, and add the required EPICS parameters. + +--- + +## Spectrometer Setup Panel + +The **Spectrometer Setup Panel** ensures that **spectrometers operate with the correct EPICS settings** and that the **energy axis is calibrated** to match the camera’s current image dimensions. + +### What Happens When a Setup Button is Pressed? + +When a **Setup** button is pressed for a spectrometer, the following process takes place: + +1. **Retrieve Stored Configuration** + - The system **loads the predefined EPICS settings** from the camera server. + - **Key parameters such as exposure time, binning, and trigger settings are retrieved**. + +2. **Prepare the Camera for Update** + - The camera is **set to idle mode (`CAMERASTATUS = 1`)** to allow safe modifications. + - The system **waits for the camera to stop acquiring data** before proceeding. + +3. **Apply Configuration Settings to EPICS** + - Each stored setting is **written to the corresponding EPICS PV**. + +4. **Apply Settings Using `SET_PARAM`** + - Once all values are updated, the system **triggers `SET_PARAM`**, instructing the camera to apply the new settings. + +5. **Update the Energy Axis Calibration** + - The system **determines the correct energy axis length** based on **camera image width or height**. + - A new **energy axis array** is generated and written to **`SPECTRUM_X`**. + +6. **Restore Camera Status** + - The system **returns the camera to its original state (`CAMERASTATUS` is restored)** after updating. + +7. **User Feedback** + - A **status message** below each button confirms whether the update was **successful** or if an **error occurred**. + +--- + +### When Should These Buttons Be Used? + +Use these buttons in the following cases: + +- **Spectrometer data is not updating** or is missing from the display. +- **Values appear incorrect** or **not aligned with expectations**. +- **Camera or spectrometer settings were changed and need to be restored**. +- **After a system reboot or power cycle** to ensure proper configuration. + +--- + +## Example: Camera and Spectrometer Configuration Process + +This example illustrates how settings are applied to an EPICS-controlled camera and spectrometer. + +#### Example Configuration for a Spectrometer (`SARFE10-PSSS059`) + +```json +"hardware_configuration": { + "EXPOSURE": 12.5, + "TRIGGER": 1, + "BINX": 2, + "BINY": 2 +} +``` + +When the **setup button is pressed**, the following EPICS PVs are updated: + +```plaintext +SARFE10-PSSS059:EXPOSURE → 12.5 +SARFE10-PSSS059:TRIGGER → 1 +SARFE10-PSSS059:BINX → 2 +SARFE10-PSSS059:BINY → 2 +``` + +The system then applies `SET_PARAM`, recalibrates the **energy axis**, and **restores the camera to its original state**. + +--- + +## User Interface Overview + +Below is a preview of the interface, showing the Camera Settings Panel and Spectrometer Setup Panel: + +![Interface Preview](https://docs.google.com/drawings/d/138H9Jph71I3xpSsGuAYB4wlwvoDWJgVUTBsgNFMNrdo/pub?w=960&h=720) + +--- + +### Conclusion + +These tools ensure that **SwissFEL cameras and spectrometers are correctly configured at startup**, reducing downtime and preventing data acquisition errors due to misconfigured EPICS settings. \ No newline at end of file