# 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 **Camera Settings Panel** is accessible via **[https://sf-photodiag-test.psi.ch/](https://sf-photodiag-test.psi.ch/)** under the **Startup** tab. 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. ### Camera Grouping The tool uses the **`group` field** in the camera configuration to organize cameras into logical groups for easier bulk operations. Currently used groups include: - **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 } ``` 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) ---