Skip to content

Commit 3eee8de

Browse files
authored
Update Reflectometry-Config-Training-‐-Exercise-1.md
1 parent 7ae10e6 commit 3eee8de

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

doc/specific_iocs/reflectometry/config_training/Reflectometry-Config-Training-‐-Exercise-1.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Exercise 1 - Parameters, Drivers, Components
22

3+
## Introduction to Reflectomery and Specific Terminology
4+
35
![image](refl_beamline_setup.PNG)
46

57
Fundamentally, the Reflectometry Config defines a geometry model of the beamline, which we use to calculate relative positions for each axis in the model based on the current beam path. We think about this model in 3 layers:
@@ -18,44 +20,43 @@ To Note:
1820
- Parameters/Drivers have a many-to-one relationship to Components
1921
- Parameters and Drivers do not _have_ to be a one-to-one match, even though often this is the case (like a height offset parameter on the POLREF bench will equally displace front and back height jacks).
2022

23+
## The `config.py` file
24+
2125
In the following exercise, we will add a single item to the reflectometry configuration, a Supermirror, complete with Parameters and Drivers.
2226
Before we start making changes, let's review the content of the blank config in front of you:
2327

24-
```
25-
# Reference documentation for writing reflectometry configurations available at Reflectometry-Configuration
26-
27-
from ReflectometryServer import *
28+
```Python
29+
from typing import Dict
2830

31+
from ReflectometryServer.beamline import Beamline
32+
from ReflectometryServer.config_helper import (
33+
add_mode,
34+
get_configured_beamline,
35+
)
2936

30-
def get_beamline(macros):
31-
"""
3237

33-
Returns: The beamline model
34-
35-
"""
38+
def get_beamline(macros: Dict[str, str]) -> Beamline:
3639
#########################
3740
# FIXED BEAMLINE VALUES #
3841
#########################
39-
add_constant(BeamlineConstant("OPI", "SURF", "OPIs to show on front panel"))
40-
41-
DISTANCE = 10.0
42-
angle_of_movement = 90
4342

4443
# Modes
45-
nr = add_mode("NR")
44+
_nr = add_mode("NR")
4645

4746
##############################
4847
# BEAMLINE MODEL STARTS HERE #
4948
##############################
5049

5150
return get_configured_beamline()
51+
5252
```
53-
- `from ReflectometryServer import *`: This is required to use classes and helper methods which are used to construct the model of the beamline
53+
54+
- `from typing import Dict` relates to the output of the function and the enforcement of typing via PyRight.
55+
- The various imports from `ReflectometryServer` are the items used below. Any classes or helper methods needed to construct the model of the beamline is within this namespace.
5456
- `def get_beamline`: While the python config file gives you tremendous freedom to include arbitrary python code, this is the one method we expect to be here as the reflectometry server calls it on config load. It should return an object of type `Beamline`
55-
- `add_constant(BeamlineConstant("OPI", "SURF", "OPIs to show on front panel"))`: This adds a PV intended to expose constant values that are used across the instrument so that these do not have to be defined in multiple places. In this case, we are creating the PV `REFL_01:CONST:OPI` which holds the value "SURF". This PV then is used to populate the Front Panel OPI with hardcoded items for the named beamline.
56-
- `DISTANCE`: This is a constant we will be using just inside the config file to space every item in the beamline model an equal distance apart for simplicity as it helps with understanding & verifying position tracking behaviour. This is just for the training course, you will not find this on a real beamline.
57-
- `ANGLE_OF_MOVEMENT`: Another constant we will be using throughout the config. This lets us define the angle of movement of our physical components relative to the natural beam which defines our coordinate system, i.e. the angle between the dotted blue line and the dotted grey lines above. Usually this is 90 + 1.5 for TS1, and 90 + 2.3 for TS2 instruments. However, in this training course for now we will assume that the natural beam is level to the floor for simplicity.
58-
- `nr = add_mode("NR")`: Modes are "presets" used to define which devices are in use & should automatically track depending on the type of experiment being run.
57+
- The `fixed beamline values` will contain variables and things which do not change. For example, the distances between components.
58+
- The `beamline model` describes the actual beamline, in order, from the beam entry point to the detectors.
59+
- `_nr = add_mode("NR")`: Modes are "presets" used to define which devices are in use & should automatically track depending on the type of experiment being run. At least one mode should be specified. This version has the underscore `_` at the front because at present the variable is not used, and PyRight requires the variable to be used, but it accepts one with an underscore at the front.
5960

6061
## Exercise 1
6162

0 commit comments

Comments
 (0)