You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -22,7 +22,7 @@ The slits have already been set up with the addition of the `jaws.cmd` during th
22
22
You will need to add a constant for the distance to these slits, `S1_Z`, which needs to be set to `10.0`.
23
23
You can add slit parameters to your config with a helper method, e.g.:`add_slit_parameters(slit_number=1, include_centres=True)`, for this slit set the centres should be included.
24
24
As with the supermirror in the previous exercise add a component for the slits, using `0.0`, `S1_Z`, and the `NATURAL_ANGLE` to set the `PositionAndAngle` of the component.
25
-
Add another parameter here, but this time the axis parameter is a `POSITION` related to the height of the slit set.
25
+
Add another parameter here, but this time the axis parameter is a `POSITION` related to the height of the slit set, which has to be called `S1OFFSET`.
26
26
Add the driver for that parameter pointing at `MTR0301`.
27
27
28
28
### 2. Add Slit 2
@@ -31,24 +31,128 @@ The slits have already been set up with the addition of the `jaws.cmd` during th
31
31
You will need to add a constant for the distance to these slits, `S2_Z`, which needs to be set to `S1_Z + 10`. Whilst these distances can be absolute, they are often given as relative to the previous item on the beamline.
32
32
Add the slit parameters to your config with the helper method, including the centres and making sure you set the `slit_number` to `2`.
33
33
As previously add a component for these slits, using `0.0`, `S2_Z`, and the `NATURAL_ANGLE` to set the `PositionAndAngle` of the component.
34
-
Add another parameter here, but this time the axis parameter is a `POSITION` related to the height of the slit set.
34
+
Add another parameter here, called `S2OFFSET`, with a `POSITION` axis parameter related to the height of the slit set.
35
35
Add the driver for that parameter pointing at `MTR0302`.
36
36
37
37
### 3. Add the Sample stack
38
38
The sample is placed after Slits 2.
39
39
We added in the axes for this during the setup via the `axes.cmd`.
40
40
Again, a distance will be needed, this time it is `SAMPLE_Z` and should be set to `S2_Z + 10.0`.
41
-
Add parameters and drivers for the height, translation, phi, and psi.
41
+
Add parameters and drivers for the height, translation, phi, and psi, which should be called `SAMPOFFSET`, `SAMPTRANS`, `SAMPPHI`, and `SAMPPSI`.
42
42
The height (or vertical position) is a `POSITION` axis, on motor `MTR0307`, phi (or the pitch) is an `ANGLE` on `MTR0306`, psi (or the roll) is a `PSI` on `MTR0308`, and the translation (or horizontal position) is a `TRANS` on `MTR0305`.
43
43
Perhaps counterintuitively, we do not want the sample to change the beam path! While the sample reflects the beam in the physical world, in the reflectometry server this is handled via a special parameter "Theta" which we will talk about more later. We do, however, want this component to track the beam in both height and angle, so it's a `TiltingComponent`.
44
44
45
45
## To Test
46
46
Once you have added all these components, you should now be able to set the parameters and see the related motor axes move as in the previous exercise. You now also have enough in your beamline model to see beamline parameters react to changes in the beam.
47
47
1. Go to the table of motors and make sure all are at a `0` position.
48
-
1. Restart the IOC to pick up the updated `config.py`.
49
-
1. Set an angle SP for `sm_angle`. I recommend 22.5 as this results in a reflection angle of 45 degrees - this produces tracked positions for downstream components that are easy to understand.
50
-
1. When you move `sm_angle` to this setpoint you should now see the RBV of all downstream components change. This is because while the physical axes have not moved, the *beam* has, so their relative positions are now different.
51
-
-`s2_offset` should read equivalent to its distance due to the 45 degree angle i.e. **-10** (negative because it is still centred on the natural beam i.e. below the new reflected beam
52
-
-`sa_offset` similar to `s2_offset` i.e. should be at -20
53
-
-`sa_phi` as still sitting perpendicular to the natural beam, but the reflected beam has been bounced up 45 degrees, i.e. this should now read back -45
54
-
1. If you now click move on any of the downstream parameters, you should see it re-apply its last SP of 0, i.e. move to re-centre itself on the new, reflected beam. The Motor axis should now read back the offset required to move these parameters back into the beam i.e. 10, 20 and 45 respectively.
48
+
2. Restart the IOC to pick up the updated `config.py`.
49
+
3. When you look at the `Front Panel` you should now see fewer disconnected items, similarly there should be more values available in the following tabs.
50
+
4. If you go to the `Collimation` tab, and set the SP of `SMANGLE` to `22.5` (this results in a reflection angle of 45 degrees - which produces tracked positions for downstream components that are easy to understand), when you click on `Move` you should now see the RBV of all downstream components change. This is because while the physical axes have not moved, the *beam* has, so their relative positions are now different.
51
+
-`S2OFFSET` should read equivalent to its distance due to the 45 degree angle i.e. **-10** (negative because it is still centred on the natural beam i.e. below the new reflected beam
52
+
-`SAMPOFFSET` similar to `S2OFFSET` i.e. should be at -20
53
+
-`SAMPPHI` as still sitting perpendicular to the natural beam, but the reflected beam has been bounced up 45 degrees, i.e. this should now read back -45
54
+
5. At this stage, if you look at the table of motors, only the supermirror angle will have moved, everything else is reported according to the relationship to the beam.
55
+
6. If you now click move on any of the downstream parameters, you should see it re-apply its last SP of 0, i.e. move to re-centre itself on the new, reflected beam. When the move has finished the `Collimation` tab in the reflectometry perspective should have 0s for everthying except `SMANGLE`. The appropriate motor axes on the table of motors should now read back the offset required to move these parameters back into the beam i.e. 10, 20 and 45 respectively, alongside the value of 22.5 for the supermirror angle.
56
+
57
+
## Solution
58
+
<details>
59
+
<summary>Should you have trouble the following is what the code could look like</summary>
60
+
61
+
```python
62
+
from typing import Dict
63
+
64
+
from ReflectometryServer.beamline import Beamline
65
+
from ReflectometryServer.beamline_constant import BeamlineConstant
66
+
from ReflectometryServer.components import (
67
+
Component,
68
+
ReflectingComponent,
69
+
TiltingComponent,
70
+
)
71
+
from ReflectometryServer.config_helper import (
72
+
add_component,
73
+
add_constant,
74
+
add_driver,
75
+
add_mode,
76
+
add_parameter,
77
+
add_slit_parameters,
78
+
get_configured_beamline,
79
+
)
80
+
from ReflectometryServer.geometry import ChangeAxis, PositionAndAngle
81
+
from ReflectometryServer.ioc_driver import IocDriver
82
+
from ReflectometryServer.parameters import AxisParameter
83
+
from ReflectometryServer.pv_wrapper import MotorPVWrapper
0 commit comments