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
Copy file name to clipboardExpand all lines: doc/specific_iocs/reflectometry/config_training/Reflectometry-Config-Training-‐-Overview-&-Setup.md
+41-15Lines changed: 41 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
This training unit presents a series of exercises which take you through the creation of a reflectometry config. The aim of this is to become more confident in working with the python configuration itself as well as to hopefully learn something about how the reflectometry IOC works internally.
4
4
5
-
**NB:**While I have taken care that the examples in the exercises produce a beamline model that resembles those of real instruments, it will be simplified in many ways for the sake of clarity.
5
+
**NB:**Whilst care has been taken so that the examples in the exercises produce a beamline model that resembles those of real instruments, it will be simplified in many ways for the sake of clarity.
6
6
7
7
## Useful Resources:
8
8
@@ -12,18 +12,44 @@ This training unit presents a series of exercises which take you through the cre
12
12
13
13
## Setup Instrument Configuration & Dev Environment:
14
14
15
-
1. Make sure your IBEX Server is not running
16
-
1. In `/Instrument/settings/config/<ND...>/`, pull branch `REFL_TRAINING`. This contains a blank reflectometry config `config.py` for the exercises, as well as example solutions. **Please do not commit anything to this branch directly** as it is intended as a blank starting point for anyone wanting to do this course. If you want to keep your local changes under version control, please create your own branch based off `REFL_TRAINING`.
17
-
1. (Optional) in `/Instrument/settings/config/<ND...>/Python/` rename `init_inst.py` to `init_<your machine name>.py`. This will load relevant reflectometry routines into genie_python sessions. Scripting is outside of the scope of this course so you should be able to complete everything without having done this, so this is just in case you want to play around.
18
-
1. (Optional but recommended) in `/Instrument/Apps/EPICS/ioc/master/Galil/iocBoot/iocGALIL-IOC-01/st-common.cmd`, find a line that says "Save motor settings every 30 seconds" and delete the relevant `$(IFNOTRECSIM)` conditional. This will make it so that simulated Galil axes retain their settings (limits, naming etc.) on IOC restart which can otherwise be a bit tedious to reapply every time.
19
-
1. Start IBEX Server
20
-
1. From an EPICS terminal, run `/Instrument/settings/config/<ND...>/configurations/refl/setup_motors.bat`. This will set up your motor axes to look like the SURF beamline through a series of caputs. SURF was chosen as a base as it is one of the more simple reflectometers.
21
-
1. In the IBEX Menu Bar, navigate to `Preferences > Select Visible Perspectives` and tick yes for "Reflectometry"
22
-
1. Restart the `REFL_01` IOC. The front panel on the Reflectometry Perspective should display a server status of "OKAY". If you see a lot of purple disconnected boxes, don't worry, this is expected. All other tabs should be blank at this point, i.e. no items listed.
23
-
1. You will be editing the python reflectometry configuration at `/Instrument/settings/config/<ND...>/configurations/refl/config.py` Next to it, there should be a list of example solutions to all exercises. I highly recommend opening this in an IDE of your choice that lets you add `/Instrument/Apps/EPICS/support/refl/` as a project dependency, as having access to class/function definitions and autocomplete will be extremely useful.
24
-
25
-
You should now be all set up! If you want to load one of the example solutions as the config for the reflectometry server, you can do this by setting a macro on the reflectometry IOC:
1. Set the `CONFIG_FILE` macro to e.g. `ex1_solution.py`
15
+
1. Open up the IBEX GUI.
16
+
2. Create a new configuration called `REFL_TRAINING` or something similar.
17
+
3. Add the `GALIL_01` IOC to the configuration, give it a `Sim. Level` of `RECSIM`, and assign `01` to the `MTRCTRL` macro, everything else can stay as the default values.
18
+
4. Add the `GALIL_02` IOC to the configuration, give it a `Sim. Level` of `RECSIM`, and assign `02` to the `MTRCTRL` macro, everything else can stay as the default values.
19
+
5. Add the `GALIL_03` IOC to the configuration, give it a `Sim. Level` of `RECSIM`, and assign `03` to the `MTRCTRL` macro, everything else can stay as the default values.
20
+
6. Add the `REFL_01` IOC to the configuration, everything stays as the default values.
21
+
7. Load your configuration.
22
+
8. Make sure the Reflectomery perspective is available to you, if it isn't you can make it visible via the `Preferences` menu.
23
+
9. At this point if you open the Relectometry perspective the `Server Status` should indicate an `ERROR` as it can't find the configuration.
24
+
10. In the configurations folder for the computer you are using create a folder called `refl`, and in `refl` create `config.py`.
25
+
11. If you restart the `REFL_01` IOC at this point, the server will still be in error, but the error text should have changed to being unable to read the file rather than beinig unable to find it.
26
+
12. Open `config.py` in the editor of your choice, and copy in this code, which is the most reflectometry configuration you have that will load.
_nr = add_mode("NR") # The underscore is to ensure this passes for pyright because the mode is needed for getting the configured beamline, but is unused locally
45
+
46
+
##############################
47
+
# BEAMLINE MODEL STARTS HERE #
48
+
##############################
49
+
50
+
return get_configured_beamline()
51
+
52
+
```
53
+
54
+
13. At this point you should be able to edit `config.py` in the following pages and build up your example system.
0 commit comments