diff --git a/.gitignore b/.gitignore
index 90393e6..5128d08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,4 @@
/.idea/inspectionProfiles/Project_Default.xml
/.idea/vcs.xml
/.idea/workspace.xml
-/Elegant/
+/unused/Elegant/
diff --git a/MatchingConfig/Reference.json b/MatchingConfig/Reference.json
deleted file mode 100644
index 00bb4b2..0000000
--- a/MatchingConfig/Reference.json
+++ /dev/null
@@ -1,1005 +0,0 @@
-{
- "Label": "Reference",
- "Order": [
- {
- "Reference": null,
- "MatchID": "Preset",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Start",
- "MatchID": "Laser Heater",
- "End": "SINLH02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "SINSB04",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": "SINSB04",
- "Save": true
- },
- {
- "Reference": "Laser Heater",
- "MatchID": "Match to SINSB04",
- "End": "SINSB04",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Laser Heater",
- "MatchID": "Bunch Compressor 1",
- "End": "SINDI02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "Linac 1",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": "S10CB02",
- "Save": true
- },
- {
- "Reference": "Bunch Compressor 1",
- "MatchID": "Match to Linac 1",
- "End": "S10CB02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Bunch Compressor 1",
- "MatchID": "End of Linac 1",
- "End": "S10BC01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Bunch Compressor 1",
- "MatchID": "Bunch Compressor 2",
- "End": "S10MA01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "Linac 2",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": [
- "S20CB01",
- "S20CB02"
- ],
- "Save": true
- },
- {
- "Reference": "Bunch Compressor 2",
- "MatchID": "Match to Linac 2",
- "End": "S20CB04",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Bunch Compressor 2",
- "MatchID": "Match to Switchyard",
- "End": "S20SY02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Switchyard",
- "MatchID": "Resonant Kicker",
- "End": "S20SY02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Switchyard",
- "MatchID": "Switchyard",
- "End": "SATCL01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Switchyard",
- "MatchID": "Athos Diagnostics",
- "End": "SATDI01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "Athos Linac",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": "SATCB01",
- "Save": true
- },
- {
- "Reference": "HERO",
- "MatchID": "Athos Stopper",
- "End": "SATCL02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "HERO",
- "MatchID": "Athos EEHG",
- "End": "SATMA01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "Athos Undulator",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": [
- "SATUN06",
- "SATUN07"
- ],
- "Save": true
- },
- {
- "Reference": "EEHG",
- "MatchID": "Match to Athos Undulator",
- "End": "SATUN09",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "EEHG",
- "MatchID": "Match to Athos Deflector",
- "End": "SATBD01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "Linac 3",
- "End": null,
- "Destination": "SARBD01",
- "Sequence": [
- "S30CB01",
- "S30CB02"
- ],
- "Save": true
- },
- {
- "Reference": "Switchyard",
- "MatchID": "Match to Linac 3",
- "End": "S30CB03",
- "Destination": "SARBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Switchyard",
- "MatchID": "End of Linac 3",
- "End": "S30CB10",
- "Destination": "SARBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "Aramis Undulator",
- "End": null,
- "Destination": "SARBD01",
- "Sequence": [
- "SARUN03",
- "SARUN04"
- ],
- "Save": true
- },
- {
- "Reference": "Linac3",
- "MatchID": "Aramis - ECOL",
- "End": null,
- "Destination": "SARBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Linac3",
- "MatchID": "Match to Aramis Undulator",
- "End": "SARUN20",
- "Destination": "SARBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Linac3",
- "MatchID": "Aramis Dump",
- "End": "SARBD02",
- "Destination": "SARBd02",
- "Sequence": null,
- "Save": null
- }
- ],
- "Dependence": {
- "SINSB04-MQUA230": [
- "SINSB03-MQUA230"
- ],
- "S10CB02-MQUA230": [
- "S10DI01-MQUA120",
- "S10CB03-MQUA430",
- "S10CB04-MQUA430",
- "S10CB05-MQUA430",
- "S10CB06-MQUA430",
- "S10CB07-MQUA430",
- "S10CB08-MQUA430"
- ],
- "S10CB02-MQUA430": [
- "S10CB03-MQUA230",
- "S10CB04-MQUA230",
- "S10CB05-MQUA230",
- "S10CB06-MQUA230",
- "S10CB07-MQUA230",
- "S10CB08-MQUA230"
- ],
- "S20CB01-MQUA430": [
- "S20CB03-MQUA430"
- ],
- "SATCB01-MQUA230": [
- "SATCL02-MQUA430"
- ],
- "SATCB01-MQUA430": [
- "SATCL02-MQUA430"
- ],
- "SATUN06-MQUA080": [
- "SATUN08-MQUA080",
- "SATUN10-MQUA080",
- "SATUN12-MQUA080",
- "SATUN14-MQUA420",
- "SATUN16-MQUA080",
- "SATUN18-MQUA080",
- "SATUN20-MQUA080"
- ],
- "SATUN07-MQUA080": [
- "SATUN09-MQUA080",
- "SATUN11-MQUA080",
- "SATUN13-MQUA080",
- "SATUN15-MQUA080",
- "SATUN17-MQUA080",
- "SATUN19-MQUA080",
- "SATUN21-MQUA080"
- ],
- "S30CB01-MQUA430": [
- "S30CB03-MQUA430",
- "S30CB05-MQUA430",
- "S30CB07-MQUA430",
- "S30CB09-MQUA430",
- "S30CB11-MQUA430",
- "S30CB13-MQUA430",
- "S30CB15-MQUA430"
- ],
- "S30CB02-MQUA430": [
- "S30CB04-MQUA430",
- "S30CB06-MQUA430",
- "S30CB08-MQUA430",
- "S30CB10-MQUA430",
- "S30CB12-MQUA430",
- "S30CB14-MQUA430"
- ],
- "SARUN03-MQUA080": [
- "SARMA02-MQUA050",
- "SARUN01-MQUA080",
- "SARUN05-MQUA080",
- "SARUN07-MQUA080",
- "SARUN09-MQUA080",
- "SARUN11-MQUA080",
- "SARUN13-MQUA080",
- "SARUN15-MQUA080",
- "SARUN17-MQUA080",
- "SARUN19-MQUA080"
- ],
- "SARUN04-MQUA080": [
- "SARMA02-MQUA120",
- "SARUN02-MQUA080",
- "SARUN06-MQUA080",
- "SARUN08-MQUA080",
- "SARUN10-MQUA080",
- "SARUN12-MQUA080",
- "SARUN14-MQUA080",
- "SARUN16-MQUA080",
- "SARUN18-MQUA080",
- "SARUN20-MQUA080"
- ]
- },
- "Reference": {
- "Start": {
- "Location": "start",
- "Twiss": {
- "betax": 29.971,
- "alphax": 0.003,
- "betay": 26.0,
- "alphay": -0.288
- }
- },
- "Laser Heater": {
- "Location": "sinlh02.mqua410$start",
- "Twiss": {
- "betax": 11.2,
- "alphax": 3.2,
- "betay": 0.8,
- "alphay": 0.75
- }
- },
- "Bunch Compressor 1": {
- "Location": "sindi02.mqua020$start",
- "Twiss": {
- "betax": 11.1557,
- "alphax": -1.17,
- "betay": 50,
- "alphay": 0.0
- }
- },
- "Bunch Compressor 2": {
- "Location": "s10ma01.mqua020$start",
- "Twiss": {
- "betax": 6.14,
- "alphax": -0.83,
- "betay": 22.86,
- "alphay": -1.18
- }
- },
- "Switchyard": {
- "Location": "s20sy02$start",
- "Twiss": {
- "betax": 48.26,
- "alphax": 7.322,
- "betay": 14.293,
- "alphay": -3.513
- }
- },
- "Linac3": {
- "Location": "s30cb10.mqua430$start",
- "Twiss": {
- "betax": 8.83,
- "alphax": 0.548,
- "betay": 30.44,
- "alphay": -1.866
- }
- },
- "Aramis Stopper": {
- "Location": "sarma01.mqua010$start",
- "Twiss": {
- "betax": 2.304,
- "alphax": -1.4045,
- "betay": 25.929,
- "alphay": -6.363
- }
- },
- "HERO": {
- "Location": "satdi01.mqua250$start",
- "Twiss": {
- "betax": 35.76,
- "alphax": -1.166,
- "betay": 24.087,
- "alphay": 0.648
- }
- },
- "Athos Deflector": {
- "Location": "satbd01.mqua010$start",
- "Twiss": {
- "betax": 50,
- "alphax": 0,
- "betay": 50,
- "alphay": 0
- }
- },
- "EEHG": {
- "Location": "satma01.mqua610$start",
- "Twiss": {
- "betax": 10.0,
- "alphax": 0.027,
- "betay": 16.85,
- "alphay": 0.027
- }
- }
- },
- "Parameter": {
- "Preset": {
- "Variable": [],
- "Target": [
- {
- "Preset": {
- "sinlh01.mqsk030.k1": 0,
- "sinbc02.mqsk110.k1": 0,
- "sinbc02.mqsk350.k1": 0,
- "sindi01.mqsk030.k1": 0,
- "s10bc02.mqsk110.k1": 0,
- "s10bc02.mqsk350.k1": 0,
- "sarcl02.mqsk160.k1": 0,
- "sarcl02.mqsk300.k1": 0,
- "sarcl02.mqsk420.k1": 0,
- "satsy01.mqsk030.k1": 0,
- "satsy01.mqsk270.k1": 0,
- "sinbc02.mqua120.k1": 0,
- "sinbc02.mqua340.k1": 0,
- "s10bc02.mqua120.k1": 0,
- "s10bc02.mqua340.k1": 0,
- "sarcl02.mqua150.k1": 0,
- "sarcl02.mqua430.k1": 0,
- "satbd01.mqua010.k1": 0.50697,
- "satbd01.mqua030.k1": -0.618466,
- "satbd01.mqua050.k1": 0.13249,
- "satbd01.mqua070.k1": 0.47403,
- "satbd01.mqua090.k1": -0.74426,
- "satbd02.mqua030.k1": -1.05081
- }
- }
- ]
- },
- "Laser Heater": {
- "Variable": [
- "SINLH01-MQUA020",
- "SINLH01-MQUA040",
- "SINLH01-MQUA050",
- "SINLH01-MQUA070",
- "SINLH02-MQUA010"
- ],
- "Target": [
- {
- "Location": "sinlh02.mqua410$start",
- "Twiss": {
- "betax": 11.2,
- "alphax": 3.2,
- "betay": 0.8,
- "alphay": 0.75
- }
- }
- ]
- },
- "SINSB04": {
- "Variable": [
- "SINSB04-MQUA130",
- "SINSB04-MQUA230"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.2,
- "MUY": 0.2
- }
- }
- ]
- },
- "Match to SINSB04": {
- "Variable": [
- "SINLH02-MQUA410",
- "SINLH03-MQUA030",
- "SINLH03-MQUA040",
- "SINLH03-MQUA060",
- "SINLH03-MQUA080",
- "SINSB03-MQUA130"
- ],
- "Target": [
- {
- "Location": "sinsb04$start",
- "SavedID": "SINSB04"
- }
- ]
- },
- "Bunch Compressor 1": {
- "Variable": [
- "SINBC01-MQUA020",
- "SINBC01-MQUA050",
- "SINBC01-MQUA070",
- "SINBC01-MQUA090",
- "SINBC01-MQUA110",
- "SINDI01-MQUA020",
- "SINDI01-MQUA070"
- ],
- "Target": [
- {
- "Location": "sindi02.mqua020$start",
- "Twiss": {
- "betax": 11.1557,
- "alphax": -1.17,
- "betay": 50,
- "alphay": 0.0
- }
- },
- {
- "Location": "sinbc02.mbnd400",
- "Twiss": {
- "betax": 5.1,
- "betay": 100
- },
- "Limit": 1
- },
- {
- "Location": "sinbc01.mqua110$end",
- "Twiss": {
- "betax": 100
- },
- "Limit": 1
- }
- ]
- },
- "Linac 1": {
- "Variable": [
- "S10CB02-MQUA230",
- "S10CB02-MQUA430"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.1883,
- "MUY": 0.1883
- }
- }
- ]
- },
- "Match to Linac 1": {
- "Variable": [
- "S10CB01-MQUA230",
- "S10CB01-MQUA430",
- "SINDI02-MQUA020",
- "SINDI02-MQUA030",
- "SINDI02-MQUA050",
- "SINDI02-MQUA060",
- "SINDI02-MQUA090"
- ],
- "Target": [
- {
- "Location": "s10cb02$start",
- "SavedID": "Linac 1"
- }
- ]
- },
- "End of Linac 1": {
- "Variable": [
- "S10CB07-MQUA430",
- "S10CB08-MQUA230",
- "S10CB08-MQUA430",
- "S10CB09-MQUA230"
- ],
- "Target": [
- {
- "Location": "s10bc01.mqua020$start",
- "Twiss": {
- "betax": 4.88,
- "betay": 16.11,
- "alphax": 0.5546,
- "alphay": -1.81
- }
- }
- ]
- },
- "Bunch Compressor 2": {
- "Variable": [
- "S10BC01-MQUA020",
- "S10BC01-MQUA040",
- "S10BC01-MQUA060",
- "S10BC01-MQUA080",
- "S10BC01-MQUA100"
- ],
- "Target": [
- {
- "Location": "s10ma01.mqua020$start",
- "Twiss": {
- "betax": 6.14,
- "alphax": -0.83,
- "betay": 22.86,
- "alphay": -1.18
- }
- }
- ]
- },
- "Linac 2": {
- "Variable": [
- "S20CB01-MQUA430",
- "S20CB02-MQUA430"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.2,
- "MUY": 0.2
- }
- }
- ]
- },
- "Match to Linac 2": {
- "Variable": [
- "S10MA01-MQUA020",
- "S10MA01-MQUA050",
- "S10MA01-MQUA070",
- "S10MA01-MQUA110",
- "S10MA01-MQUA130"
- ],
- "Target": [
- {
- "Location": "s20cb01$start",
- "SavedID": "Linac 2"
- }
- ]
- },
- "Match to Switchyard": {
- "Variable": [
- "S20SY01-MQUA020",
- "S20SY01-MQUA030",
- "S20SY01-MQUA050",
- "S20SY01-MQUA080"
- ],
- "Target": [
- {
- "Location": "s20sy02$start",
- "Twiss": {
- "betax": 48.26,
- "alphax": 7.322,
- "betay": 14.293,
- "alphay": -3.513
- }
- }
- ]
- },
- "Resonant Kicker": {
- "Variable": [
- "S20SY02-MQUA070",
- "S20SY02-MQUA100",
- "S20SY02-MQUA140",
- "S20SY02-MQUA180",
- "S20SY02-MKDC010",
- "S20SY02-MKAC020",
- "S20SY02-MKDC030",
- "S20SY02-MKAC040",
- "S20SY02-MKDC050"
- ],
- "Target": [
- {
- "Script": "Scripts/switchyard_kicker.madx"
- }
- ]
- },
- "Switchyard": {
- "Variable": [
- "SATSY01-MQUA020",
- "SATSY01-MQUA040",
- "SATSY01-MQUA070",
- "SATSY01-MQUA090",
- "SATSY01-MQUA210",
- "SATSY01-MQUA230",
- "SATSY01-MQUA260",
- "SATSY01-MQUA280",
- "SATSY01-MQUA300",
- "SATSY02-MQUA010",
- "SATSY02-MQUA110",
- "SATSY02-MQUA120",
- "SATSY02-MQUA230",
- "SATSY03-MQUA010",
- "SATSY03-MQUA040",
- "SATSY03-MQUA070",
- "SATSY03-MQUA100",
- "SATSY03-MQUA130",
- "SATCL01-MQUA120",
- "SATCL01-MQUA130",
- "SATCL01-MQUA180",
- "SATCL01-MQUA190"
- ],
- "Target": [
- {
- "Script": "Scripts/switchyard.madx"
- }
- ],
- "User": {
- "LEAKDISP": 0.0
- }
- },
- "Athos Diagnostics": {
- "Variable": [
- "SATDI01-MQUA025",
- "SATDI01-MQUA080",
- "SATDI01-MQUA220",
- "SATDI01-MQUA230"
- ],
- "Target": [
- {
- "Location": "satdi01.mqua250$start",
- "Twiss": {
- "betax": 35.76,
- "alphax": -1.166,
- "betay": 24.087,
- "alphay": 0.648
- }
- }
- ]
- },
- "Athos Linac": {
- "Variable": [
- "SATCB01-MQUA230",
- "SATCB01-MQUA430"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.053,
- "MUY": 0.053
- }
- }
- ]
- },
- "Athos Stopper": {
- "Variable": [
- "SATDI01-MQUA250",
- "SATDI01-MQUA260",
- "SATDI01-MQUA280",
- "SATDI01-MQUA300"
- ],
- "Target": [
- {
- "Location": "satcl01$start",
- "SavedID": "Athos Linac"
- }
- ]
- },
- "Athos EEHG": {
- "Variable": [
- "SATMA01-MQUA050",
- "SATMA01-MQUA120",
- "SATMA01-MQUA140",
- "SATMA01-MQUA160",
- "SATMA01-MQUA180",
- "SATMA01-MQUA230",
- "SATMA01-MQUA250"
- ],
- "Target": [
- {
- "Location": "satma01.mqua610$start",
- "Twiss": {
- "betax": 10.0,
- "alphax": 0.027,
- "betay": 16.85,
- "alphay": 0.027
- }
- },
- {
- "Location": "satma01.mqua140$start",
- "Twiss": {
- "betax": 70,
- "betay": 70
- },
- "Limit": 1
- },
- {
- "Location": "satma01.mqua160$start",
- "Twiss": {
- "betax": 70,
- "betay": 70
- },
- "Limit": 1
- },
- {
- "Location": "satma01.mqua180$start",
- "Twiss": {
- "betax": 70,
- "betay": 70
- },
- "Limit": 1
- }
- ]
- },
- "Athos Undulator": {
- "Variable": [
- "SATUN06-MQUA080",
- "SATUN07-MQUA080"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.15,
- "MUY": 0.15
- }
- }
- ]
- },
- "Match to Athos Undulator": {
- "Variable": [
- "SATMA01-MQUA610",
- "SATMA01-MQUA630",
- "SATMA01-MQUA640",
- "SATUN04-MQUA060",
- "SATUN05-MQUA420"
- ],
- "Target": [
- {
- "Location": "satun06$start",
- "SavedID": "Athos Undulator"
- },
- {
- "Location": "satun07$end",
- "Twiss": {
- "x": 10,
- "y": 10,
- "px": 10
- },
- "Limit": 1
- }
- ]
- },
- "Match to Athos Deflector": {
- "Variable": [
- "SATUN22-MQUA080",
- "SATMA02-MQUA010",
- "SATMA02-MQUA020",
- "SATMA02-MQUA040",
- "SATMA02-MQUA050",
- "SATMA02-MQUA070"
- ],
- "Target": [
- {
- "Location": "satbd01.mqua010$start",
- "Twiss": {
- "betax": 50,
- "alphax": 0,
- "betay": 50,
- "alphay": 0
- }
- },
- {
- "Location": "satun22$end",
- "Twiss": {
- "x": 0,
- "px": 0
- }
- }
- ]
- },
- "Linac 3": {
- "Variable": [
- "S30CB01-MQUA430",
- "S30CB02-MQUA430"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.1883,
- "MUY": 0.1883
- }
- }
- ]
- },
- "Match to Linac 3": {
- "Variable": [
- "S20SY03-MQUA020",
- "S20SY03-MQUA030",
- "S20SY03-MQUA050",
- "S20SY03-MQUA060",
- "S20SY03-MQUA100"
- ],
- "Target": [
- {
- "Location": "s30cb01$start",
- "SavedID": "Linac 3"
- }
- ]
- },
- "End of Linac 3": {
- "Variable": [
- "S30CB01-MQUA430",
- "S30CB01-MQUA430",
- "S30CB01-MQUA430",
- "S30CB01-MQUA430"
- ],
- "Target": [
- {
- "Location": "s30cb10.mqua430$start",
- "Twiss": {
- "betax": 8.83,
- "alphax": 0.548,
- "betay": 30.44,
- "alphay": -1.866
- }
- }
- ]
- },
- "Aramis - ECOL": {
- "Variable": [
- "SARCL02-MQUA130",
- "SARCL02-MQUA210",
- "SARCL02-MQUA250",
- "SARCL02-MQUA310",
- "SARCL02-MQUA350",
- "SARCL02-MQUA460",
- "SARCL01-MQUA020",
- "SARCL01-MQUA050",
- "SARCL01-MQUA080",
- "SARCL01-MQUA100",
- "SARCL01-MQUA140",
- "SARCL01-MQUA190"
- ],
- "Target": [
- {
- "Script": "Scripts/ecol.madx"
- }
- ]
- },
- "Aramis Undulator": {
- "Variable": [
- "SARUN03-MQUA080",
- "SARUN04-MQUA080"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.15,
- "MUY": 0.15
- }
- }
- ]
- },
- "Match to Aramis Undulator": {
- "Variable": [
- "SARMA01-MQUA010",
- "SARMA01-MQUA060",
- "SARMA01-MQUA080",
- "SARMA01-MQUA120",
- "SARMA01-MQUA140"
- ],
- "Target": [
- {
- "Location": "sarun03$start",
- "SavedID": "Aramis Undulator"
- },
- {
- "Location": "sarma01.mqua060",
- "Twiss": {
- "betax": 40
- },
- "Limit": 1
- }
- ]
- },
- "Aramis Dump": {
- "Variable": [
- "SARUN19-MQUA080",
- "SARUN20-MQUA080",
- "SARBD01-MQUA020",
- "SARBD02-MQUA030"
- ],
- "Target": [
- {
- "Location": "SARBD02$END",
- "Twiss": {
- "betax": 250,
- "betay": 250,
- "etax": 100,
- "etay": 1.2
- },
- "Limit": 1
- }
- ]
- }
- }
-}
\ No newline at end of file
diff --git a/MatchingConfig/Reference_old.json b/MatchingConfig/Reference_old.json
deleted file mode 100644
index fd2adb1..0000000
--- a/MatchingConfig/Reference_old.json
+++ /dev/null
@@ -1,775 +0,0 @@
-{
- "Label": "Reference",
- "Order": [
- {
- "Reference": null,
- "MatchID": "Preset",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Start",
- "MatchID": "Laser Heater",
- "End": "SINLH02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "SINSB04",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": "SINSB04",
- "Save": true
- },
- {
- "Reference": "Laser Heater",
- "MatchID": "Match to SINSB04",
- "End": "SINSB04",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Laser Heater",
- "MatchID": "Bunch Compressor 1",
- "End": "SINDI02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "Linac 1",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": "S10CB02",
- "Save": true
- },
- {
- "Reference": "Bunch Compressor 1",
- "MatchID": "Match to Linac 1",
- "End": "S10CB02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Bunch Compressor 1",
- "MatchID": "End of Linac 1",
- "End": "S10BC01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Bunch Compressor 1",
- "MatchID": "Bunch Compressor 2",
- "End": "S10MA01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "Linac 2",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": [
- "S20CB01",
- "S20CB02"
- ],
- "Save": true
- },
- {
- "Reference": "Bunch Compressor 2",
- "MatchID": "Match to Linac 2",
- "End": "S20CB04",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Bunch Compressor 2",
- "MatchID": "Match to Switchyard",
- "End": "S20SY02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Switchyard",
- "MatchID": "Resonant Kicker",
- "End": "S20SY02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Switchyard",
- "MatchID": "Switchyard",
- "End": "SATCL01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "Switchyard",
- "MatchID": "Athos Diagnostics",
- "End": "SATDI01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "Athos Linac",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": "SATCB01",
- "Save": true
- },
- {
- "Reference": "HERO",
- "MatchID": "Athos Stopper",
- "End": "SATCL02",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "HERO",
- "MatchID": "Athos EEHG",
- "End": "SATMA01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": null,
- "MatchID": "Athos Undulator",
- "End": null,
- "Destination": "SATBD01",
- "Sequence": [
- "SATUN06",
- "SATUN07"
- ],
- "Save": true
- },
- {
- "Reference": "EEHG",
- "MatchID": "Match to Athos Undulator",
- "End": "SATUN09",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- },
- {
- "Reference": "EEHG",
- "MatchID": "Match to Athos Deflector",
- "End": "SATBD01",
- "Destination": "SATBD01",
- "Sequence": null,
- "Save": null
- }
- ],
- "Dependence": {
- "SINSB04-MQUA230": [
- "SINSB03-MQUA230"
- ],
- "S10CB02-MQUA230": [
- "S10DI01-MQUA120",
- "S10CB03-MQUA430",
- "S10CB04-MQUA430",
- "S10CB05-MQUA430",
- "S10CB06-MQUA430",
- "S10CB07-MQUA430",
- "S10CB08-MQUA430"
- ],
- "S10CB02-MQUA430": [
- "S10CB03-MQUA230",
- "S10CB04-MQUA230",
- "S10CB05-MQUA230",
- "S10CB06-MQUA230",
- "S10CB07-MQUA230",
- "S10CB08-MQUA230"
- ],
- "S20CB01-MQUA430": [
- "S20CB03-MQUA430"
- ],
- "SATCB01-MQUA230": [
- "SATCL02-MQUA430"
- ],
- "SATCB01-MQUA430": [
- "SATCL02-MQUA430"
- ],
- "SATUN06-MQUA080": [
- "SATUN08-MQUA080",
- "SATUN10-MQUA080",
- "SATUN12-MQUA080",
- "SATUN14-MQUA420",
- "SATUN16-MQUA080",
- "SATUN18-MQUA080",
- "SATUN20-MQUA080"
- ],
- "SATUN07-MQUA080": [
- "SATUN09-MQUA080",
- "SATUN11-MQUA080",
- "SATUN13-MQUA080",
- "SATUN15-MQUA080",
- "SATUN17-MQUA080",
- "SATUN19-MQUA080",
- "SATUN21-MQUA080"
- ]
- },
- "Reference": {
- "Start": {
- "Location": "start",
- "Twiss": {
- "betax": 29.971,
- "alphax": 0.003,
- "betay": 26.0,
- "alphay": -0.288
- }
- },
- "Laser Heater": {
- "Location": "sinlh02.mqua410$start",
- "Twiss": {
- "betax": 11.2,
- "alphax": 3.2,
- "betay": 0.8,
- "alphay": 0.75
- }
- },
- "Bunch Compressor 1": {
- "Location": "sindi02.mqua020$start",
- "Twiss": {
- "betax": 11.1557,
- "alphax": -1.17,
- "betay": 50,
- "alphay": 0.0
- }
- },
- "Bunch Compressor 2": {
- "Location": "s10ma01.mqua020$start",
- "Twiss": {
- "betax": 6.14,
- "alphax": -0.83,
- "betay": 22.86,
- "alphay": -1.18
- }
- },
- "Switchyard": {
- "Location": "s20sy02$start",
- "Twiss": {
- "betax": 48.26,
- "alphax": 7.322,
- "betay": 14.293,
- "alphay": -3.513
- }
- },
- "Linac3": {
- "Location": "s30cb10.mqua430$start",
- "Twiss": {
- "betax": 8.83,
- "alphax": 0.548,
- "betay": 30.44,
- "alphay": -1.866
- }
- },
- "Aramis Stopper": {
- "Location": "sarma01.mqua010$start",
- "Twiss": {
- "betax": 2.304,
- "alphax": -1.4045,
- "betay": 25.929,
- "alphay": -6.363
- }
- },
- "HERO": {
- "Location": "satdi01.mqua250$start",
- "Twiss": {
- "betax": 35.76,
- "alphax": -1.166,
- "betay": 24.087,
- "alphay": 0.648
- }
- },
- "Athos Deflector": {
- "Location": "satbd01.mqua010$start",
- "Twiss": {
- "betax": 50,
- "alphax": 0,
- "betay": 50,
- "alphay": 0
- }
- },
- "EEHG": {
- "Location": "satma01.mqua610$start",
- "Twiss": {
- "betax": 10.0,
- "alphax": 0.027,
- "betay": 16.85,
- "alphay": 0.027
- }
- }
- },
- "Parameter": {
- "Preset": {
- "Variable": [],
- "Target": [
- {
- "Preset": {
- "sinlh01.mqsk030.k1": 0,
- "sinbc02.mqsk110.k1": 0,
- "sinbc02.mqsk350.k1": 0,
- "sindi01.mqsk030.k1": 0,
- "s10bc02.mqsk110.k1": 0,
- "s10bc02.mqsk350.k1": 0,
- "sarcl02.mqsk160.k1": 0,
- "sarcl02.mqsk300.k1": 0,
- "sarcl02.mqsk420.k1": 0,
- "satsy01.mqsk030.k1": 0,
- "satsy01.mqsk270.k1": 0,
- "sinbc02.mqua120.k1": 0,
- "sinbc02.mqua340.k1": 0,
- "s10bc02.mqua120.k1": 0,
- "s10bc02.mqua340.k1": 0,
- "sarcl02.mqua150.k1": 0,
- "sarcl02.mqua430.k1": 0,
- "satbd01.mqua010.k1": 0.50697,
- "satbd01.mqua030.k1": -0.618466,
- "satbd01.mqua050.k1": 0.13249,
- "satbd01.mqua070.k1": 0.47403,
- "satbd01.mqua090.k1": -0.74426,
- "satbd02.mqua030.k1": -1.05081
- }
- }
- ]
- },
- "Laser Heater": {
- "Variable": [
- "SINLH01-MQUA020",
- "SINLH01-MQUA040",
- "SINLH01-MQUA050",
- "SINLH01-MQUA070",
- "SINLH02-MQUA010"
- ],
- "Target": [
- {
- "Location": "sinlh02.mqua410$start",
- "Twiss": {
- "betax": 11.2,
- "alphax": 3.2,
- "betay": 0.8,
- "alphay": 0.75
- }
- }
- ]
- },
- "SINSB04": {
- "Variable": [
- "SINSB04-MQUA130",
- "SINSB04-MQUA230"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.2,
- "MUY": 0.2
- }
- }
- ]
- },
- "Match to SINSB04": {
- "Variable": [
- "SINLH02-MQUA410",
- "SINLH03-MQUA030",
- "SINLH03-MQUA040",
- "SINLH03-MQUA060",
- "SINLH03-MQUA080",
- "SINSB03-MQUA130"
- ],
- "Target": [
- {
- "Location": "sinsb04$start",
- "SavedID": "SINSB04"
- }
- ]
- },
- "Bunch Compressor 1": {
- "Variable": [
- "SINBC01-MQUA020",
- "SINBC01-MQUA050",
- "SINBC01-MQUA070",
- "SINBC01-MQUA090",
- "SINBC01-MQUA110",
- "SINDI01-MQUA020",
- "SINDI01-MQUA070"
- ],
- "Target": [
- {
- "Location": "sindi02.mqua020$start",
- "Twiss": {
- "betax": 11.1557,
- "alphax": -1.17,
- "betay": 50,
- "alphay": 0.0
- }
- },
- {
- "Location": "sinbc02.mbnd400",
- "Twiss": {
- "betax": 5.1,
- "betay": 100
- },
- "Limit": 1
- },
- {
- "Location": "sinbc01.mqua110$end",
- "Twiss": {
- "betax": 100
- },
- "Limit": 1
- }
- ]
- },
- "Linac 1": {
- "Variable": [
- "S10CB02-MQUA230",
- "S10CB02-MQUA430"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.1883,
- "MUY": 0.1883
- }
- }
- ]
- },
- "Match to Linac 1": {
- "Variable": [
- "S10CB01-MQUA230",
- "S10CB01-MQUA430",
- "SINDI02-MQUA020",
- "SINDI02-MQUA030",
- "SINDI02-MQUA050",
- "SINDI02-MQUA060",
- "SINDI02-MQUA090"
- ],
- "Target": [
- {
- "Location": "s10cb02$start",
- "SavedID": "Linac 1"
- }
- ]
- },
- "End of Linac 1": {
- "Variable": [
- "S10CB07-MQUA430",
- "S10CB08-MQUA230",
- "S10CB08-MQUA430",
- "S10CB09-MQUA230"
- ],
- "Target": [
- {
- "Location": "s10bc01.mqua020$start",
- "Twiss": {
- "betax": 4.88,
- "betay": 16.11,
- "alphax": 0.5546,
- "alphay": -1.81
- }
- }
- ]
- },
- "Bunch Compressor 2": {
- "Variable": [
- "S10BC01-MQUA020",
- "S10BC01-MQUA040",
- "S10BC01-MQUA060",
- "S10BC01-MQUA080",
- "S10BC01-MQUA100"
- ],
- "Target": [
- {
- "Location": "s10ma01.mqua020$start",
- "Twiss": {
- "betax": 6.14,
- "alphax": -0.83,
- "betay": 22.86,
- "alphay": -1.18
- }
- }
- ]
- },
- "Linac 2": {
- "Variable": [
- "S20CB01-MQUA430",
- "S20CB02-MQUA430"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.2,
- "MUY": 0.2
- }
- }
- ]
- },
- "Match to Linac 2": {
- "Variable": [
- "S10MA01-MQUA020",
- "S10MA01-MQUA050",
- "S10MA01-MQUA070",
- "S10MA01-MQUA110",
- "S10MA01-MQUA130"
- ],
- "Target": [
- {
- "Location": "s20cb01$start",
- "SavedID": "Linac 2"
- }
- ]
- },
- "Match to Switchyard": {
- "Variable": [
- "S20SY01-MQUA020",
- "S20SY01-MQUA030",
- "S20SY01-MQUA050",
- "S20SY01-MQUA080"
- ],
- "Target": [
- {
- "Location": "s20sy02$start",
- "Twiss": {
- "betax": 48.26,
- "alphax": 7.322,
- "betay": 14.293,
- "alphay": -3.513
- }
- }
- ]
- },
- "Resonant Kicker": {
- "Variable": [
- "S20SY02-MQUA070",
- "S20SY02-MQUA100",
- "S20SY02-MQUA140",
- "S20SY02-MQUA180",
- "S20SY02-MKDC010",
- "S20SY02-MKAC020",
- "S20SY02-MKDC030",
- "S20SY02-MKAC040",
- "S20SY02-MKDC050"
- ],
- "Target": [
- {
- "Script": "Scripts/switchyard_kicker.madx"
- }
- ]
- },
- "Switchyard": {
- "Variable": [
- "SATSY01-MQUA020",
- "SATSY01-MQUA040",
- "SATSY01-MQUA070",
- "SATSY01-MQUA090",
- "SATSY01-MQUA210",
- "SATSY01-MQUA230",
- "SATSY01-MQUA260",
- "SATSY01-MQUA280",
- "SATSY01-MQUA300",
- "SATSY02-MQUA010",
- "SATSY02-MQUA110",
- "SATSY02-MQUA120",
- "SATSY02-MQUA230",
- "SATSY03-MQUA010",
- "SATSY03-MQUA040",
- "SATSY03-MQUA070",
- "SATSY03-MQUA100",
- "SATSY03-MQUA130",
- "SATCL01-MQUA120",
- "SATCL01-MQUA130",
- "SATCL01-MQUA180",
- "SATCL01-MQUA190"
- ],
- "Target": [
- {
- "Script": "Scripts/switchyard.madx"
- }
- ],
- "User": {
- "LEAKDISP": 0.0
- }
- },
- "Athos Diagnostics": {
- "Variable": [
- "SATDI01-MQUA025",
- "SATDI01-MQUA080",
- "SATDI01-MQUA220",
- "SATDI01-MQUA230"
- ],
- "Target": [
- {
- "Location": "satdi01.mqua250$start",
- "Twiss": {
- "betax": 35.76,
- "alphax": -1.166,
- "betay": 24.087,
- "alphay": 0.648
- }
- }
- ]
- },
- "Athos Linac": {
- "Variable": [
- "SATCB01-MQUA230",
- "SATCB01-MQUA430"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.053,
- "MUY": 0.053
- }
- }
- ]
- },
- "Athos Stopper": {
- "Variable": [
- "SATDI01-MQUA250",
- "SATDI01-MQUA260",
- "SATDI01-MQUA280",
- "SATDI01-MQUA300"
- ],
- "Target": [
- {
- "Location": "satcl01$start",
- "SavedID": "Athos Linac"
- }
- ]
- },
- "Athos EEHG": {
- "Variable": [
- "SATMA01-MQUA050",
- "SATMA01-MQUA120",
- "SATMA01-MQUA140",
- "SATMA01-MQUA160",
- "SATMA01-MQUA180",
- "SATMA01-MQUA230",
- "SATMA01-MQUA250"
- ],
- "Target": [
- {
- "Location": "satma01.mqua610$start",
- "Twiss": {
- "betax": 10.0,
- "alphax": 0.027,
- "betay": 16.85,
- "alphay": 0.027
- }
- },
- {
- "Location": "satma01.mqua140$start",
- "Twiss": {
- "betax": 70,
- "betay": 70
- },
- "Limit": 1
- },
- {
- "Location": "satma01.mqua160$start",
- "Twiss": {
- "betax": 70,
- "betay": 70
- },
- "Limit": 1
- },
- {
- "Location": "satma01.mqua180$start",
- "Twiss": {
- "betax": 70,
- "betay": 70
- },
- "Limit": 1
- }
- ]
- },
- "Athos Undulator": {
- "Variable": [
- "SATUN06-MQUA080",
- "SATUN07-MQUA080"
- ],
- "Target": [
- {
- "Location": "#e",
- "Twiss": {
- "MUX": 0.15,
- "MUY": 0.15
- }
- }
- ]
- },
- "Match to Athos Undulator": {
- "Variable": [
- "SATMA01-MQUA610",
- "SATMA01-MQUA630",
- "SATMA01-MQUA640",
- "SATUN04-MQUA060",
- "SATUN05-MQUA420"
- ],
- "Target": [
- {
- "Location": "satun06$start",
- "SavedID": "Athos Undulator"
- },
- {
- "Location": "satun07$end",
- "Twiss": {
- "x": 10,
- "y": 10,
- "px": 10
- },
- "Limit": 1
- }
- ]
- },
- "Match to Athos Deflector": {
- "Variable": [
- "SATUN22-MQUA080",
- "SATMA02-MQUA010",
- "SATMA02-MQUA020",
- "SATMA02-MQUA040",
- "SATMA02-MQUA050",
- "SATMA02-MQUA070"
- ],
- "Target": [
- {
- "Location": "satbd01.mqua010$start",
- "Twiss": {
- "betax": 50,
- "alphax": 0,
- "betay": 50,
- "alphay": 0
- }
- },
- {
- "Location": "satun22$end",
- "Twiss": {
- "x": 0,
- "px": 0
- }
- }
- ]
- }
- }
-}
\ No newline at end of file
diff --git a/elegant.py b/elegant.py
deleted file mode 100644
index 1f52561..0000000
--- a/elegant.py
+++ /dev/null
@@ -1,103 +0,0 @@
-from onlinemodel.code import OMElegant
-#test
-class Elegant:
- def __init__(self,parent=None,model=None):
- self.parent=parent
- self.model=model
- self.elegant=OMElegant.ElegantLattice()
-
- def writeElegantFiles(self,path ='Elegant', filename='dummy',end='SARBD02'):
- self.writeElegantInput(path,filename)
- self.writeElegantLattice(path, filename,end)
-
- def writeElegantInput(self,path,name):
-
- filename = '%s/%s.ele' % (path, name)
- with open(filename, 'w') as fid:
- fid.write('&run_setup\n')
- fid.write('\tlattice\t\t= %s.lat,\n' % (name))
- fid.write('\tuse_beamline\t= SwissFEL,\n')
- fid.write('\trootname\t= %s,\n' % name)
- fid.write('\toutput\t\t= %s.out,\n')
- fid.write('\tcentroid\t\t= %s.cen,\n')
- fid.write('\tsigma\t\t= %s.sig,\n')
- fid.write('\tfinal\t\t= %s.fin,\n')
- fid.write('\tparameters\t= %s.par,\n')
- fid.write('\tmagnets\t\t= %s.mag,\n')
- fid.write('\tcombine_bunch_statistics = 0,\n')
- fid.write('\tdefault_order\t= 2,\n')
- fid.write('\tconcat_order\t= 0,\n')
- fid.write('\tprint_statistics\t= 0,\n')
- fid.write('\trandom_number_seed\t= 9876543210,\n')
- p0 = self.model.getInitialEnergy()
- fid.write('\tp_central\t= %f,\n' % p0)
- fid.write('\ttracking_updates\t= 1\n')
- fid.write('\talways_change_p0\t= 1\n')
- fid.write('&end\n\n')
- fid.write('&run_control\n')
- fid.write('\tn_steps\t= 1,\n')
- fid.write('\treset_rf_for_each_step = 1\n')
- fid.write('&end\n\n')
-
- twiss=self.parent.reference.reference['Start']['Twiss']
- print(twiss)
- fid.write('&twiss_output\n')
- fid.write('\tfilename\t= %s.twi,\n')
- fid.write('\tmatched\t\t= 0,\n')
- fid.write('\tbeta_x\t\t= %f,\n' % twiss['betax'])
- fid.write('\tbeta_y\t\t= %f,\n' % twiss['betay'])
- fid.write('\talpha_x\t\t= %f,\n' % twiss['alphax'])
- fid.write('\talpha_y\t\t= %f,\n' % twiss['alphay'])
- fid.write('&end\n\n')
-
- fid.write('&sdds_beam\n')
- fid.write('\tinput_type= "elegant",\n')
- fid.write('\tsample_interval\t= 1,\n')
- fid.write('\tinput = MyInputDist.sdds,\n')
- fid.write('\treuse_bunch\t= 0 \n')
- fid.write('&end\n\n')
-
- fid.write('&alter_elements\n')
- fid.write('\tname = *,\n')
- fid.write('\ttype = LSCDRIFT,\n')
- fid.write('\titem = LSC,\n')
- fid.write('\tvalue = 1\n')
- fid.write('&end\n\n')
-
- fid.write('&alter_elements\n')
- fid.write('\tname = *,\n')
- fid.write('\ttype = RFCW,\n')
- fid.write('\titem = LSC,\n')
- fid.write('\tvalue = 1\n')
- fid.write('&end\n\n')
-
- fid.write('&alter_elements\n')
- fid.write('\tname = *,\n')
- fid.write('\ttype = CSRDRIFT,\n')
- fid.write('\titem = CSR,\n')
- fid.write('\tvalue = 1\n')
- fid.write('&end\n\n')
-
- fid.write('&alter_elements\n')
- fid.write('\tname = *,\n')
- fid.write('\ttype = CSRCSBEND,\n')
- fid.write('\titem = CSR,\n')
- fid.write('\tvalue = 1\n')
- fid.write('&end\n\n')
-
- fid.write('&track\n')
- fid.write('&end\n\n')
- fid.close()
-
- def writeElegantLattice(self,path, filename,end):
- destination = 'ARAMIS'
- if 'SPO' in end:
- destination = 'PORTHOS'
- elif 'SAT' in end:
- destination = 'ATHOS'
- elif 'S10BD' in end or 'SIN' in end:
- destination = 'INJECTOR'
- self.model.om.setBranch(destination, 'SINLH01')
- self.elegant.openLatticeStream(path, filename)
- self.model.om.exportBranch(self.elegant)
- self.elegant.closeLatticeStream()
\ No newline at end of file
diff --git a/generateMatchSettings.py b/generateMatchSettings.py
deleted file mode 100644
index 1b89a42..0000000
--- a/generateMatchSettings.py
+++ /dev/null
@@ -1,274 +0,0 @@
-import json
-
-def configMatching(label_in = 'Reference',var={}):
- path = "MatchingConfig/"
- label = label_in
- print(var)
- dependence = generateDependences()
- reference = generateReferences()
- order = generateOrder()
- parameter = generateMatchingSteps(reference,var)
-
-
- settings={'Label':label,'Order':order,'Dependence':dependence,'Reference':reference,'Parameter':parameter}
- fname=path+label+'.json'
- with open(fname, 'w', encoding='utf-8') as f:
- json.dump(settings, f, ensure_ascii=False, indent=4)
- return fname
-#######
-# some internal functions
-def MatchReference(loc,twiss,limit=None): # limit 1 -> smaller than, 2 -> larger than (default is euqal)
- match ={'Location': loc, 'Twiss': twiss}
- if not limit is None:
- match['Limit'] = limit
- return match
-
-def MatchStep(ref,id,end, dest,sequence=None,saveTwiss=None):
- match={'Reference':ref,'MatchID':id,'End':end, 'Destination':dest,'Sequence':sequence,'Save':saveTwiss}
- return match
-
-def MatchParameter(var0,tar0,user0=None):
- if user0 is None:
- return {'Variable':var0,'Target':tar0}
- return {'Variable':var0,'Target':tar0,'User':user0}
-
-############
-# generating functions
-
-def generateReferences():
- # list of references with fixed twiss parameters
- reference = {}
- reference['Start'] = MatchReference('start', {'betax': 29.971, 'alphax': 0.003, 'betay': 26.00, 'alphay': -0.288})
- reference['Laser Heater'] = MatchReference('sinlh02.mqua410$start',
- {'betax': 11.2, 'alphax': 3.2, 'betay': 0.8, 'alphay': 0.75, })
- reference['Bunch Compressor 1'] = MatchReference('sindi02.mqua020$start',
- {'betax': 11.1557, 'alphax': -1.17, 'betay': 50, 'alphay': 0.})
- reference['Bunch Compressor 2'] = MatchReference('s10ma01.mqua020$start',
- {'betax': 6.14, 'alphax': -0.83, 'betay': 22.86, 'alphay': -1.18})
- reference['Switchyard'] = MatchReference('s20sy02$start',
- {'betax': 48.26, 'alphax': 7.322, 'betay': 14.293, 'alphay': -3.513})
- reference['Linac3'] = MatchReference('s30cb10.mqua430$start',
- {'betax': 8.83, 'alphax': 0.548, 'betay': 30.44, 'alphay': -1.866})
- reference['Aramis Stopper'] = MatchReference('sarma01.mqua010$start',
- {'betax': 2.304, 'alphax': -1.4045, 'betay': 25.929, 'alphay': -6.363})
- reference['HERO'] = MatchReference('satdi01.mqua250$start',
- {'betax': 35.76, 'alphax': -1.166, 'betay': 24.087, 'alphay': 0.648})
- reference['Athos Deflector'] = MatchReference('satbd01.mqua010$start',
- {'betax': 50, 'alphax': 0, 'betay': 50, 'alphay': 0})
- reference['EEHG'] = MatchReference('satma01.mqua610$start',
- {'betax': 10., 'alphax': 0.027, 'betay': 16.85, 'alphay': 0.027})
- return reference
-
-
-def generateDependences():
- dependence = {}
- dependence['SINSB04-MQUA230']=['SINSB03-MQUA230']
- dependence['S10CB02-MQUA230']=['S10DI01-MQUA120'] + ['S10CB%2.2d-MQUA430' % i for i in range(3,9)]
- dependence['S10CB02-MQUA430']=['S10CB%2.2d-MQUA230' % i for i in range(3,9)]
- dependence['S20CB01-MQUA430']=['S20CB03-MQUA430']
- dependence['SATCB01-MQUA230']=['SATCL02-MQUA430']
- dependence['SATCB01-MQUA430']=['SATCL02-MQUA430']
- dependence['SATUN06-MQUA080']=['SATUN%2.2d-MQUA080' % (2*i+6) for i in range(1,4)] +['SATUN14-MQUA420']+['SATUN%d-MQUA080' % (2*i+16) for i in range(3)]
- dependence['SATUN07-MQUA080']=['SATUN%2.2d-MQUA080' % (2*i+7) for i in range(1,8)]
- dependence['S30CB01-MQUA430'] = ['S30CB%2.2d-MQUA430' % (i*2 + 3) for i in range(7)]
- dependence['S30CB02-MQUA430'] = ['S30CB%2.2d-MQUA430' % (i*2 + 4) for i in range(6)]
- dependence['SARUN03-MQUA080'] = ['SARMA02-MQUA050','SARUN01-MQUA080'] + ['SARUN%2.2d-MQUA080' % (2*i + 5) for i in range(8)]
- dependence['SARUN04-MQUA080'] = ['SARMA02-MQUA120','SARUN02-MQUA080'] + ['SARUN%2.2d-MQUA080' % (2*i + 6) for i in range(8)]
- return dependence
-
-def generateOrder():
- order = []
- # order of elements:
- # - Match starting point with Twiss, None has no initial condition and starts with #s
- # - ID to find additional parameteters
- # - Last section in tracking/matching. If none it tracks to the end (#e)
- # - destination: selection of branch by giving a unique section name (e.g. SARBD01 for Aramis)
- # - sequence: sequence to use. If it is a list of sequence then a temporary sequence is used. Default to swissfel
- # - flag to last twiss parameters, needed for other routines to refer to.
- order.append(MatchStep(None, 'Preset', None, 'SATBD01'))
- order.append(MatchStep('Start', 'Laser Heater', 'SINLH02', 'SATBD01'))
- order.append(MatchStep(None, 'SINSB04', None, 'SATBD01', 'SINSB04', True))
- order.append(MatchStep('Laser Heater', 'Match to SINSB04', 'SINSB04', 'SATBD01'))
- order.append(MatchStep('Laser Heater', 'Bunch Compressor 1', 'SINDI02', 'SATBD01'))
- order.append(MatchStep(None, 'Linac 1', None, 'SATBD01', 'S10CB02', True))
- order.append(MatchStep('Bunch Compressor 1', 'Match to Linac 1', 'S10CB02', 'SATBD01'))
- order.append(MatchStep('Bunch Compressor 1', 'End of Linac 1', 'S10BC01', 'SATBD01'))
- order.append(MatchStep('Bunch Compressor 1', 'Bunch Compressor 2', 'S10MA01', 'SATBD01'))
- order.append(MatchStep(None, 'Linac 2', None, 'SATBD01', ['S20CB01', 'S20CB02'], True))
- order.append(MatchStep('Bunch Compressor 2', 'Match to Linac 2', 'S20CB04', 'SATBD01'))
- order.append(MatchStep('Bunch Compressor 2', 'Match to Switchyard', 'S20SY02', 'SATBD01'))
- order.append(MatchStep('Switchyard', 'Resonant Kicker', 'S20SY02', 'SATBD01'))
- order.append(MatchStep('Switchyard', 'Switchyard', 'SATCL01', 'SATBD01'))
- order.append(MatchStep('Switchyard', 'Athos Diagnostics', 'SATDI01', 'SATBD01'))
- order.append(MatchStep(None, 'Athos Linac', None, 'SATBD01', 'SATCB01', True))
- order.append(MatchStep('HERO', 'Athos Stopper', 'SATCL02', 'SATBD01'))
- order.append(MatchStep('HERO', 'Athos EEHG', 'SATMA01', 'SATBD01'))
- order.append(MatchStep(None, 'Athos Undulator', None, 'SATBD01', ['SATUN06', 'SATUN07'], True))
- order.append(MatchStep('EEHG', 'Match to Athos Undulator', 'SATUN09', 'SATBD01'))
- order.append(MatchStep('EEHG', 'Match to Athos Deflector', 'SATBD01', 'SATBD01'))
- order.append(MatchStep(None, 'Linac 3', None, 'SARBD01',['S30CB01','S30CB02'], True))
- order.append(MatchStep('Switchyard', 'Match to Linac 3', 'S30CB03', 'SARBD01'))
- order.append(MatchStep('Switchyard', 'End of Linac 3', 'S30CB10', 'SARBD01'))
- order.append(MatchStep(None, 'Aramis Undulator', None, 'SARBD01', ['SARUN03', 'SARUN04'], True))
- order.append(MatchStep('Linac3', 'Aramis - ECOL', None, 'SARBD01'))
- order.append(MatchStep('Linac3', 'Match to Aramis Undulator', 'SARUN20', 'SARBD01'))
- order.append(MatchStep('Linac3', 'Aramis Dump', 'SARBD02', 'SARBd02'))
- return order
-
-
-def generateMatchingSteps(reference,var_ext):
-
- parameter={}
- var=[]
- tar = [{'Preset':{'sinlh01.mqsk030.k1':0,'sinbc02.mqsk110.k1':0,'sinbc02.mqsk350.k1':0,
- 'sindi01.mqsk030.k1':0,'s10bc02.mqsk110.k1':0,'s10bc02.mqsk350.k1':0,
- 'sarcl02.mqsk160.k1':0,'sarcl02.mqsk300.k1':0,'sarcl02.mqsk420.k1':0,
- 'satsy01.mqsk030.k1':0,'satsy01.mqsk270.k1':0,
- 'sinbc02.mqua120.k1':0,'sinbc02.mqua340.k1':0,
- 's10bc02.mqua120.k1':0,'s10bc02.mqua340.k1':0,
- 'sarcl02.mqua150.k1':0,'sarcl02.mqua430.k1':0,
- 'satbd01.mqua010.k1':0.50697,'satbd01.mqua030.k1':-0.618466,
- 'satbd01.mqua050.k1':0.13249,'satbd01.mqua070.k1':0.47403,
- 'satbd01.mqua090.k1':-0.74426,'satbd02.mqua030.k1':-1.05081}}]
-
- parameter['Preset'] = MatchParameter(var,tar)
-
- var = ['SINLH01-MQUA020', 'SINLH01-MQUA040','SINLH01-MQUA050','SINLH01-MQUA070','SINLH02-MQUA010']
- tar = [reference['Laser Heater']]
- parameter['Laser Heater'] = MatchParameter(var,tar)
-
- var = ['SINSB04-MQUA130','SINSB04-MQUA230']
- tar =[MatchReference('#e',{'MUX':0.2,'MUY':0.2})]
- parameter['SINSB04'] = MatchParameter(var,tar)
-
- var = ['SINLH02-MQUA410','SINLH03-MQUA030','SINLH03-MQUA040','SINLH03-MQUA060','SINLH03-MQUA080','SINSB03-MQUA130']
- tar =[{'Location':'sinsb04$start','SavedID':'SINSB04'}]
- parameter['Match to SINSB04']=MatchParameter(var,tar)
-
- var = ['SINBC01-MQUA020','SINBC01-MQUA050','SINBC01-MQUA070','SINBC01-MQUA090','SINBC01-MQUA110','SINDI01-MQUA020','SINDI01-MQUA070']
- tar =[reference['Bunch Compressor 1'],
- MatchReference('sinbc02.mbnd400',{'betax':5.1,'betay':100},1),
- MatchReference('sinbc01.mqua110$end',{'betax':100},1)]
- parameter['Bunch Compressor 1']=MatchParameter(var, tar)
-
- var = ['S10CB02-MQUA230','S10CB02-MQUA430']
- tar = [MatchReference('#e',{'MUX':0.1883,'MUY':0.1883})]
- parameter['Linac 1'] = MatchParameter(var, tar)
-
-
- var = ['S10CB01-MQUA230','S10CB01-MQUA430','SINDI02-MQUA020','SINDI02-MQUA030','SINDI02-MQUA050','SINDI02-MQUA060','SINDI02-MQUA090']
- tar =[{'Location':'s10cb02$start','SavedID':'Linac 1'}]
- parameter['Match to Linac 1']=MatchParameter(var,tar)
-
-
- var = ['S10CB07-MQUA430','S10CB08-MQUA230','S10CB08-MQUA430','S10CB09-MQUA230']
- tar = [MatchReference('s10bc01.mqua020$start',{'betax':4.88,'betay':16.11,'alphax':0.5546,'alphay':-1.81})]
- parameter['End of Linac 1']=MatchParameter(var, tar)
-
-
- var = ['S10BC01-MQUA020','S10BC01-MQUA040','S10BC01-MQUA060','S10BC01-MQUA080','S10BC01-MQUA100']
- tar = [reference['Bunch Compressor 2']]
- parameter['Bunch Compressor 2']=MatchParameter(var,tar)
-
- var = ['S20CB01-MQUA430','S20CB02-MQUA430']
- tar = [MatchReference('#e', {'MUX': 0.2, 'MUY': 0.2})]
- parameter['Linac 2'] = MatchParameter(var, tar)
-
-
- var = ['S10MA01-MQUA020','S10MA01-MQUA050','S10MA01-MQUA070','S10MA01-MQUA110','S10MA01-MQUA130']
- tar =[{'Location':'s20cb01$start','SavedID':'Linac 2'}]
- parameter['Match to Linac 2']=MatchParameter(var, tar)
-
- var = ['S20SY01-MQUA020','S20SY01-MQUA030','S20SY01-MQUA050','S20SY01-MQUA080']
- tar = [reference['Switchyard']]
- parameter['Match to Switchyard']=MatchParameter(var, tar)
-
-
- var = ['S20SY02-MQUA070','S20SY02-MQUA100','S20SY02-MQUA140','S20SY02-MQUA180','S20SY02-MKDC010','S20SY02-MKAC020','S20SY02-MKDC030','S20SY02-MKAC040','S20SY02-MKDC050']
- tar=[{'Script':'Scripts/switchyard_kicker.madx'}]
- parameter['Resonant Kicker']=MatchParameter(var, tar)
-
-
- var=['SATSY01-MQUA020','SATSY01-MQUA040','SATSY01-MQUA070','SATSY01-MQUA090','SATSY01-MQUA210','SATSY01-MQUA230','SATSY01-MQUA260','SATSY01-MQUA280',
- 'SATSY01-MQUA300','SATSY02-MQUA010','SATSY02-MQUA110','SATSY02-MQUA120','SATSY02-MQUA230','SATSY03-MQUA010','SATSY03-MQUA040','SATSY03-MQUA070',
- 'SATSY03-MQUA100','SATSY03-MQUA130','SATCL01-MQUA120','SATCL01-MQUA130','SATCL01-MQUA180','SATCL01-MQUA190']
- tar=[{'Script':'Scripts/switchyard.madx'}]
- val = 0.0
- if 'SYR56' in var_ext:
- val = var_ext['SYR56']
- uservar = {'LEAKDISP':val}
- parameter['Switchyard']=MatchParameter(var, tar, uservar)
-
-
- var=['SATDI01-MQUA025','SATDI01-MQUA080','SATDI01-MQUA220','SATDI01-MQUA230']
- tar = [reference['HERO']]
- parameter['Athos Diagnostics'] = MatchParameter(var,tar)
-
- var = ['SATCB01-MQUA230','SATCB01-MQUA430']
- tar =[MatchReference('#e',{'MUX':0.053,'MUY':0.053})]
- parameter['Athos Linac'] = MatchParameter(var,tar)
-
- var=['SATDI01-MQUA250','SATDI01-MQUA260','SATDI01-MQUA280','SATDI01-MQUA300']
- tar =[{'Location':'satcl01$start','SavedID':'Athos Linac'}]
- parameter['Athos Stopper'] = MatchParameter(var,tar)
-
-
- var=['SATMA01-MQUA050','SATMA01-MQUA120','SATMA01-MQUA140','SATMA01-MQUA160','SATMA01-MQUA180','SATMA01-MQUA230','SATMA01-MQUA250']
- tar = [reference['EEHG'],
- MatchReference('satma01.mqua140$start', {'betax': 70, 'betay': 70}, 1),
- MatchReference('satma01.mqua160$start', {'betax': 70, 'betay': 70}, 1),
- MatchReference('satma01.mqua180$start', {'betax': 70, 'betay': 70}, 1)]
- parameter['Athos EEHG'] = MatchParameter(var,tar)
-
- var = ['SATUN06-MQUA080','SATUN07-MQUA080']
- tar =[MatchReference('#e',{'MUX':0.15,'MUY':0.15})]
- parameter['Athos Undulator'] = MatchParameter(var,tar)
-
- var=['SATMA01-MQUA610','SATMA01-MQUA630','SATMA01-MQUA640','SATUN04-MQUA060','SATUN05-MQUA420']
- tar =[{'Location':'satun06$start','SavedID':'Athos Undulator'},
- MatchReference('satun07$end', {'x': 10, 'y': 10,'px':10}, 1)]
- parameter['Match to Athos Undulator'] = MatchParameter(var,tar)
-
- var = ['SATUN22-MQUA080','SATMA02-MQUA010','SATMA02-MQUA020','SATMA02-MQUA040','SATMA02-MQUA050','SATMA02-MQUA070']
- tar = [reference['Athos Deflector'],
- MatchReference('satun22$end', {'x':0, 'px': 0})]
- parameter['Match to Athos Deflector'] = MatchParameter(var,tar)
-
- var = ['S30CB01-MQUA430', 'S30CB02-MQUA430']
- tar = [MatchReference('#e', {'MUX': 0.1883, 'MUY': 0.1883})]
- parameter['Linac 3'] = MatchParameter(var, tar)
-
- var = ['S20SY03-MQUA020', 'S20SY03-MQUA030', 'S20SY03-MQUA050', 'S20SY03-MQUA060', 'S20SY03-MQUA100']
- tar = [{'Location': 's30cb01$start', 'SavedID': 'Linac 3'}]
- parameter['Match to Linac 3'] = MatchParameter(var, tar)
-
- var = ['S30CB01-MQUA430', 'S30CB01-MQUA430', 'S30CB01-MQUA430', 'S30CB01-MQUA430']
- tar = [reference['Linac3']]
- parameter['End of Linac 3'] = MatchParameter(var, tar)
-
- var = ['SARCL02-MQUA130','SARCL02-MQUA210','SARCL02-MQUA250',
- 'SARCL02-MQUA310','SARCL02-MQUA350','SARCL02-MQUA460',
- 'SARCL01-MQUA020', 'SARCL01-MQUA050', 'SARCL01-MQUA080',
- 'SARCL01-MQUA100', 'SARCL01-MQUA140', 'SARCL01-MQUA190'
- ]
- tar = [{'Script': 'Scripts/ecol.madx'}]
- parameter['Aramis - ECOL'] = MatchParameter(var, tar)
-
- var = ['SARUN03-MQUA080', 'SARUN04-MQUA080']
- tar = [MatchReference('#e', {'MUX': 0.15, 'MUY': 0.15})]
- parameter['Aramis Undulator'] = MatchParameter(var, tar)
-
- var = ['SARMA01-MQUA010', 'SARMA01-MQUA060', 'SARMA01-MQUA080', 'SARMA01-MQUA120', 'SARMA01-MQUA140']
- tar = [{'Location': 'sarun03$start', 'SavedID': 'Aramis Undulator'},
- MatchReference('sarma01.mqua060', {'betax': 40}, 1)]
- parameter['Match to Aramis Undulator'] = MatchParameter(var, tar)
-
- var = ['SARUN19-MQUA080', 'SARUN20-MQUA080', 'SARBD01-MQUA020', 'SARBD02-MQUA030']
- tar = [MatchReference('SARBD02$END', {'betax': 250, 'betay': 250,'etax':100,'etay':1.2}, 1)]
- parameter['Aramis Dump'] = MatchParameter(var, tar)
- return parameter
-
-
-
-
-
diff --git a/issues.txt b/issues.txt
index f560373..452fe6d 100644
--- a/issues.txt
+++ b/issues.txt
@@ -1,10 +1,11 @@
-1) Initialize all quadrupoles at the beginning!
-2) Allow for parameter inputs, e.g. phase advance
+
3) matching output on a log
-4) Save matched values (e.g. automatically)
-5) Load Reference
-6) filter for curent, planned and final phase for matching scripts
-7) support for start twiss for tracking
+
+5) Load Reference -> initial matching condition
+4) Save aver matching -> save initial twiss conditions
+6) filter for current, planned and final phase for matching scripts
+1) Check reference settings directory, depending on online and offline mode
+2) switch between references
diff --git a/matching.py b/matching.py
deleted file mode 100644
index d6d68c6..0000000
--- a/matching.py
+++ /dev/null
@@ -1,58 +0,0 @@
-
-converttwiss= {'betax':'betx','betay':'bety','alphax':'alfx','alphay':'alfy',
- 'etax':'dx','etay':'dy','etapx':'dpx','etapy':'dpy',
- 'x':'x','y':'y','px':'px','py':'py','energy':'energy'}
-
-class Matching:
- def __init__(self,parent=None,model=None,reference = None):
- self.parent = parent
- self.model = model
- self.reference = reference
-
- self.destination=''
-
- def match(self):
- config = self.reference.getMatchingPoint()
- if config is None:
- return
- vars = {}
- for var in config['Variable']:
- var0=var.replace('-','.').lower()
- if 'mqua' in var0 or 'mqsk' in var0:
- var0 += '.k1'
- elif 'msex' in var0:
- var0 += '.k2'
- vars[var0]={'Min':-1e6,'Max':1e6,'Preset':0,'Step':0.00001}
-
-
-
- print(vars)
-
-
- return
- if not config['End'] == self.destination:
- self.destination = config['End']
- self.model.setBranch(self.destination)
- start=config['Reference']['Location']
- if not start in self.reference.reference.keys():
- return
- twiss_in = self.reference.reference[start]['Twiss']
- twiss0 = {converttwiss[key]: twiss_in[key] for key in twiss_in.keys()}
- twiss0['Energy']= 150.*1e-3
- loc = self.reference.reference[start]['Location']
- print(loc)
- print(twiss0)
- print(config['Variable'])
-#
-
-
- def matchold(self,sequence,destination, variables,conditions,periodic=False,plot=True):
- self.setBranch(destination.upper())
- twiss={'energy0':150.}
- self.madx.updateVariables(twiss)
- res,twiss,tar=self.madx.match(sequence,variables,conditions,periodic)
- energy = self.calcEnergyProfile(twiss)
- matchtwiss={'betax':twiss.betx[0],'betay':twiss.bety[0],'alphax':twiss.alfx[0],'alphay':twiss.alfy[0]}
- if plot:
- self.parent.plot.newData(twiss, energy)
- return res, matchtwiss,tar
diff --git a/matchingmanager.py b/matchingmanager.py
deleted file mode 100644
index 9c638ae..0000000
--- a/matchingmanager.py
+++ /dev/null
@@ -1,69 +0,0 @@
-class MatchManager:
- def __init__(self,parent=None):
- self.parent=parent
- self.FODO={}
- self.defineFODO()
- self.updateFODOWidget()
- self.parent.UIMFodoList.currentIndexChanged.connect(self.updateFODOWidget)
-
- def getFODOInfo(self,reference):
- """
- retrieve if a seciton is matched and if yes get initial fodo values
- :param reference:
- :return:
- """
- if reference == 'Injector':
- a = 1
- elif reference == 'Linac 1':
- a = 1
- elif reference == 'Linac 2':
- a = 1
- elif reference == 'Linac 3':
- a = 1
- elif reference == 'Aramis Undulator':
- a = 1
- elif reference == 'Athos Undulator':
- a = 1
-
- ###########################
- ##### generic FODO matching
-
- def updateFODOWidget(self):
- reference = self.parent.UIMFodoList.currentText()
- if not reference in self.FODO.keys():
- print('Not Supported')
- return
- self.parent.UIMFodoPhase.setText('%7.3f' % self.FODO[reference]['mu'])
- self.parent.UIMFodoFlip.setChecked(self.FODO[reference]['FlipPol'])
- if self.FODO[reference]['Result'] is None:
- self.parent.UIMFodoResult.setText('Not matched yet')
- else:
- self.parent.UIMFodoResult.setText('%7.3e' % self.FODO[reference]['Result'])
-
- def setFODOParameters(self,par):
- reference = self.parent.UIMFodoList.currentText()
- if not reference in self.FODO.keys():
- print('Not Supported')
- return None
- self.FODO[reference]=par
- self.updateFODOWidget()
-
- def getFODOParameters(self):
- reference = self.parent.UIMFodoList.currentText()
- if not reference in self.FODO.keys():
- print('Not Supported')
- return None
- self.FODO[reference]['mu'] = float(str(self.parent.UIMFodoPhase.text()))
- self.FODO[reference]['FlipPol'] = self.parent.UIMFodoFlip.isChecked()
- return self.FODO[reference]
-
- def defineFODO(self):
- Periodic={}
- Periodic['Injector']={'Sequence':'SINSB04','Destination': 'SARBD01',
- 'Quads':['sinsb04.mqua130.k1','sinsb04.mqua230.k1'],
- 'Init':[0.722,-0.7156],'FlipPol':False,'mu':0.2,'Matched':False, 'Twiss':None}
-
- Periodic['Linac 1']={'Sequence':'S10CB01','Destination': 'SARBD01',
- 'Quads':['s10cb01.mqua230.k1','s10cb01.mqua430.k1'],
- 'Init':[-1.491,1.4905],'FlipPol':False,'mu':0.1883,'Result':None,'Twiss':None}
-
diff --git a/model.py b/model.py
index d241073..84ce3fa 100644
--- a/model.py
+++ b/model.py
@@ -43,6 +43,13 @@ class Model:
def getInitialEnergy(self):
return self.om.EnergyAt(self.energyReference)[0]
+ def initializeMagnets(self):
+ print('Initializing all magnets to zero')
+ self.om.setRegExpElement('.*', 'MQUA', 'k1', 0)
+ self.om.setRegExpElement('.*', 'MQSK', 'k1', 0)
+ self.om.setRegExpElement('.*', 'MSEX', 'k2', 0)
+
+
def updateFromMachine(self,machine):
pol = ['LH', 'LV+', 'LV-', 'C+', 'C-', 'ZL']
mag = machine['Magnet']
diff --git a/reference.py b/reference.py
index 13c733e..aba8fab 100644
--- a/reference.py
+++ b/reference.py
@@ -1,9 +1,4 @@
-import json
-import copy
-from PyQt5 import QtCore, QtGui, QtWidgets
-from numpy.ma.core import floor_divide
-
-from generateMatchSettings import configMatching
+from PyQt5 import QtGui
CBeige = QtGui.QColor(250, 240, 200)
CGreen = QtGui.QColor(100, 255, 100)
diff --git a/ui/OpticsToolsGui.py b/ui/OpticsToolsGui.py
index eacd9e0..d666b16 100644
--- a/ui/OpticsToolsGui.py
+++ b/ui/OpticsToolsGui.py
@@ -350,15 +350,15 @@ class Ui_OpticsGUI(object):
self.UIMatchAramis.setObjectName("UIMatchAramis")
self.gridLayout_5.addWidget(self.UIMatchAramis, 1, 1, 1, 1)
self.verticalLayout_3.addWidget(self.matchbranches)
- self.checkBox_3 = QtWidgets.QCheckBox(self.widget)
- self.checkBox_3.setObjectName("checkBox_3")
- self.verticalLayout_3.addWidget(self.checkBox_3)
- self.checkBox = QtWidgets.QCheckBox(self.widget)
- self.checkBox.setObjectName("checkBox")
- self.verticalLayout_3.addWidget(self.checkBox)
- self.checkBox_2 = QtWidgets.QCheckBox(self.widget)
- self.checkBox_2.setObjectName("checkBox_2")
- self.verticalLayout_3.addWidget(self.checkBox_2)
+ self.UISaveMatchSettings = QtWidgets.QCheckBox(self.widget)
+ self.UISaveMatchSettings.setObjectName("UISaveMatchSettings")
+ self.verticalLayout_3.addWidget(self.UISaveMatchSettings)
+ self.UIInitAllMagnets = QtWidgets.QCheckBox(self.widget)
+ self.UIInitAllMagnets.setObjectName("UIInitAllMagnets")
+ self.verticalLayout_3.addWidget(self.UIInitAllMagnets)
+ self.UIModifyKnobs = QtWidgets.QCheckBox(self.widget)
+ self.UIModifyKnobs.setObjectName("UIModifyKnobs")
+ self.verticalLayout_3.addWidget(self.UIModifyKnobs)
self.label_19 = QtWidgets.QLabel(self.widget)
font = QtGui.QFont()
font.setBold(True)
@@ -655,9 +655,9 @@ class Ui_OpticsGUI(object):
self.UIMatchPorthos.setText(_translate("OpticsGUI", "Porthos"))
self.UIMatchAthos.setText(_translate("OpticsGUI", "Athos"))
self.UIMatchAramis.setText(_translate("OpticsGUI", "Aramis"))
- self.checkBox_3.setText(_translate("OpticsGUI", "Save matched machine settings automtically"))
- self.checkBox.setText(_translate("OpticsGUI", "Initialize all magnets to zero before matching"))
- self.checkBox_2.setText(_translate("OpticsGUI", "Overwrite default values for matching variables "))
+ self.UISaveMatchSettings.setText(_translate("OpticsGUI", "Save matched machine settings automtically"))
+ self.UIInitAllMagnets.setText(_translate("OpticsGUI", "Initialize all magnets to zero before matching"))
+ self.UIModifyKnobs.setText(_translate("OpticsGUI", "Overwrite default values for matching variables "))
self.label_19.setText(_translate("OpticsGUI", "Matching Variables"))
item = self.UIMatchKnobs.horizontalHeaderItem(0)
item.setText(_translate("OpticsGUI", "Parameter"))
diff --git a/ui/OpticsToolsGui.ui b/ui/OpticsToolsGui.ui
index 09a6bec..c6e344b 100644
--- a/ui/OpticsToolsGui.ui
+++ b/ui/OpticsToolsGui.ui
@@ -568,21 +568,21 @@
-
-
+
Save matched machine settings automtically
-
-
+
Initialize all magnets to zero before matching
-
-
+
Overwrite default values for matching variables