Implement error checking of beam properties on landing page
On the add-landing-page branch, on the beam_selection.html page, implement the following error checks, to be carried out when 'Confirm beam properties' is pressed. This can either be done as a JS function on beam_selection.html or can be added as a python check with routing in init.py in apex. The error checking should either continue to the snapshot page (as it currently does) if all error checks pass, OR should pop up and error message if any fail with information on what is wrong with the beam props.
Basic things to check for beam properties:
- Any property with ':CHARGE' must be an integer
- Any property with :BIAS or :ENERGY must be a number
- Any property with ':TARGET' must be in the format [ABC]#[#]-[HP/LP]-[SIS/IGLIS/FEBIAS] (i.e. UCx#33-LP-SIS, Ta#55-HP-FEBIAD, etc)
- Any property with :ISOTOPE must be in the format ###ABC (133Cs, 12C, 7Li, etc)
- Any property with :ISOTOPE must be found in the list of nuclides (to be provided by spencer)
- Any property with :BIAS must be in the range from 1 to 65
- HEBT:ENERGY must be in the range from 0.100 to 1.90
- SEBT:ENERGY must be in the range from 0.100 to 20.0
- Along the given beam path, each successive property with ':CHARGE' must be equal to or higher than the previous charge.
Advanced things to check for beam properties:
- Field of all dipoles along the given beam path (IOS:MB, CSB:M14, IMS:MB1/2, MEBT:MB1/2, HEBT1:MB0, HEBT2:MB1/2, HEBT3:MB1/2, DSB:MB0/2/14/16, SEBT:MB20, SEBT3:MB0 agrees with calculated field based on input bias/energy, isotope, charge, to within 5%.
- The given isotope has a certain Z (number of protons). For example for Li Z=3, for Ne Z=10. Every property with ':CHARGE' for a given isotope must not exceed the corresponding Z (can't have MEBT:CHARGE = 5 for 7Li).
Edited by Spencer Kiy