mxcubecore 1.402.0__py3-none-any.whl → 1.404.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mxcubecore might be problematic. Click here for more details.
- mxcubecore/Command/Epics.py +1 -1
- {mxcubecore-1.402.0.dist-info → mxcubecore-1.404.0.dist-info}/METADATA +1 -1
- {mxcubecore-1.402.0.dist-info → mxcubecore-1.404.0.dist-info}/RECORD +6 -22
- mxcubecore/HardwareObjects/LNLS/EPICSActuator.py +0 -78
- mxcubecore/HardwareObjects/LNLS/EPICSMotor.py +0 -104
- mxcubecore/HardwareObjects/LNLS/EPICSNState.py +0 -87
- mxcubecore/HardwareObjects/LNLS/LNLSAperture.py +0 -69
- mxcubecore/HardwareObjects/LNLS/LNLSBeam.py +0 -125
- mxcubecore/HardwareObjects/LNLS/LNLSCamera.py +0 -507
- mxcubecore/HardwareObjects/LNLS/LNLSCollect.py +0 -482
- mxcubecore/HardwareObjects/LNLS/LNLSDetDistMotor.py +0 -76
- mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py +0 -538
- mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py +0 -81
- mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py +0 -478
- mxcubecore/HardwareObjects/LNLS/LNLSSlits.py +0 -48
- mxcubecore/HardwareObjects/LNLS/LNLSTransmission.py +0 -82
- mxcubecore/HardwareObjects/LNLS/LNLSZoom.py +0 -93
- mxcubecore/HardwareObjects/LNLS/read_transmission_mnc.py +0 -149
- mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py +0 -306
- {mxcubecore-1.402.0.dist-info → mxcubecore-1.404.0.dist-info}/COPYING +0 -0
- {mxcubecore-1.402.0.dist-info → mxcubecore-1.404.0.dist-info}/COPYING.LESSER +0 -0
- {mxcubecore-1.402.0.dist-info → mxcubecore-1.404.0.dist-info}/WHEEL +0 -0
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
"""Transmission control for MANACA.
|
|
4
|
-
Attenuator: ABS-300-12-C-DN-DN40 Flanges.
|
|
5
|
-
Foils: #1, 8 um Al;
|
|
6
|
-
#2, 10 um Al;
|
|
7
|
-
#3, 20 um Al;
|
|
8
|
-
#4, 80 um Al;
|
|
9
|
-
#5, 160 um Al;
|
|
10
|
-
#6, 320 um Al;
|
|
11
|
-
#7, 800 um Al;
|
|
12
|
-
#8, 1500 um Al;
|
|
13
|
-
#9, 8 um Ti;
|
|
14
|
-
#10, 10 um Cu
|
|
15
|
-
#11, 5 um Au;
|
|
16
|
-
#12, 25 um Zr.
|
|
17
|
-
Here we use the Beer-Lambert law to calculate the transmission/attenuation: I = I0 * e^-(MU * d)
|
|
18
|
-
were I is the transmitted (final) beam intensity, I0 is the incident (initial) beam intensity,
|
|
19
|
-
MU is the linear attenuation coefficient (cm^-1) and d is the thickness of the foil (cm).
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
import argparse
|
|
23
|
-
import math
|
|
24
|
-
|
|
25
|
-
from epics import PV
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def read_input():
|
|
29
|
-
# Read inputs from terminal
|
|
30
|
-
ap = argparse.ArgumentParser()
|
|
31
|
-
ap.add_argument(
|
|
32
|
-
"-e",
|
|
33
|
-
"--energy",
|
|
34
|
-
required=True,
|
|
35
|
-
type=float,
|
|
36
|
-
help="Energy of the x-ray beam [keV]",
|
|
37
|
-
)
|
|
38
|
-
args = vars(ap.parse_args())
|
|
39
|
-
return args
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def read_transmission(energy):
|
|
43
|
-
# Expressions (interpolation) for calculations of MU (linear attenuation coefficient [cm^-1]) for each material in function of the beam energy.
|
|
44
|
-
# The data used to obtain the expressions (curve fitting) are from "https://physics.nist.gov/PhysRefData/FFast/html/form.html"
|
|
45
|
-
# This attenuation coefficients can be verified and optimised after experimental validation at the beamline.
|
|
46
|
-
MU_Al = (
|
|
47
|
-
(78657.01011 * math.exp(-energy / 0.65969))
|
|
48
|
-
+ (6406.36151 * math.exp(-energy / 1.63268))
|
|
49
|
-
+ (492.29999 * math.exp(-energy / 4.42554))
|
|
50
|
-
+ (3.2588)
|
|
51
|
-
)
|
|
52
|
-
MU_Ti = (
|
|
53
|
-
(28062.17632 * math.exp(-energy / 1.88062))
|
|
54
|
-
+ (6354120 * math.exp(-energy / 0.49973))
|
|
55
|
-
+ (2257.91488 * math.exp(-energy / 5.28296))
|
|
56
|
-
+ (17.4342)
|
|
57
|
-
)
|
|
58
|
-
MU_Cu = (
|
|
59
|
-
(1147850000 * math.exp(-energy / 0.56933))
|
|
60
|
-
+ (2582.7593 * math.exp(-energy / 8.40671))
|
|
61
|
-
+ (30628.08291 * math.exp(-energy / 2.98937))
|
|
62
|
-
+ (22.4187)
|
|
63
|
-
)
|
|
64
|
-
MU_Au = (42783.04258 * math.exp(-energy / 5.39244)) + (399.59714)
|
|
65
|
-
MU_Zr = (11143.28458 * math.exp(-energy / 5.87029)) + (102.27474)
|
|
66
|
-
MU_EMPTY = 0.0
|
|
67
|
-
|
|
68
|
-
foils_pv = {
|
|
69
|
-
"F1_Al": (8, MU_Al, PV("MNC:B:RIO01:9425A:bi11"), PV("MNC:B:RIO01:9425A:bi12")),
|
|
70
|
-
"F2_Al": (
|
|
71
|
-
10,
|
|
72
|
-
MU_Al,
|
|
73
|
-
PV("MNC:B:RIO01:9425A:bi10"),
|
|
74
|
-
PV("MNC:B:RIO01:9425A:bi13"),
|
|
75
|
-
),
|
|
76
|
-
"F3_Al": (20, MU_Al, PV("MNC:B:RIO01:9425A:bi9"), PV("MNC:B:RIO01:9425A:bi14")),
|
|
77
|
-
"F4_Al": (80, MU_Al, PV("MNC:B:RIO01:9425A:bi8"), PV("MNC:B:RIO01:9425A:bi15")),
|
|
78
|
-
"F5_Al": (
|
|
79
|
-
160,
|
|
80
|
-
MU_Al,
|
|
81
|
-
PV("MNC:B:RIO01:9425A:bi7"),
|
|
82
|
-
PV("MNC:B:RIO01:9425A:bi16"),
|
|
83
|
-
),
|
|
84
|
-
"F6_Al": (
|
|
85
|
-
320,
|
|
86
|
-
MU_Al,
|
|
87
|
-
PV("MNC:B:RIO01:9425A:bi6"),
|
|
88
|
-
PV("MNC:B:RIO01:9425A:bi17"),
|
|
89
|
-
),
|
|
90
|
-
"F7_Al": (
|
|
91
|
-
800,
|
|
92
|
-
MU_Al,
|
|
93
|
-
PV("MNC:B:RIO01:9425A:bi5"),
|
|
94
|
-
PV("MNC:B:RIO01:9425A:bi18"),
|
|
95
|
-
),
|
|
96
|
-
"F8_Al": (
|
|
97
|
-
1500,
|
|
98
|
-
MU_Al,
|
|
99
|
-
PV("MNC:B:RIO01:9425A:bi4"),
|
|
100
|
-
PV("MNC:B:RIO01:9425A:bi19"),
|
|
101
|
-
),
|
|
102
|
-
"F9_Ti": (8, MU_Ti, PV("MNC:B:RIO01:9425A:bi3"), PV("MNC:B:RIO01:9425A:bi20")),
|
|
103
|
-
"F10_Cu": (
|
|
104
|
-
10,
|
|
105
|
-
MU_Cu,
|
|
106
|
-
PV("MNC:B:RIO01:9425A:bi2"),
|
|
107
|
-
PV("MNC:B:RIO01:9425A:bi21"),
|
|
108
|
-
),
|
|
109
|
-
"F11_Au": (5, MU_Au, PV("MNC:B:RIO01:9425A:bi1"), PV("MNC:B:RIO01:9425A:bi22")),
|
|
110
|
-
"F12_Zr": (
|
|
111
|
-
25,
|
|
112
|
-
MU_Zr,
|
|
113
|
-
PV("MNC:B:RIO01:9425A:bi0"),
|
|
114
|
-
PV("MNC:B:RIO01:9425A:bi23"),
|
|
115
|
-
),
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
# check what foils are in the the beam and calculate MU*x and then calculate transmission
|
|
119
|
-
|
|
120
|
-
# the commented lines below works for the attenuator expected logic (0 for foil out and 1 for foil in).
|
|
121
|
-
# as the current logic is inverted (1 is foil out and 0 is foil in) use the uncommented lines.
|
|
122
|
-
foils_in = []
|
|
123
|
-
for foil in foils_pv.keys():
|
|
124
|
-
# if foils_pv[foil][2].get() == 1 and foils_pv[foil][3].get() == 0:
|
|
125
|
-
if foils_pv[foil][2].get() == 0 and foils_pv[foil][3].get() == 1:
|
|
126
|
-
atten_mu_x = float(foils_pv[foil][0] * 1.0e-4) * foils_pv[foil][1]
|
|
127
|
-
foils_in.append(atten_mu_x)
|
|
128
|
-
status = 0
|
|
129
|
-
# elif foils_pv[foil][2].get() == 0 and foils_pv[foil][3].get() == 1:
|
|
130
|
-
elif foils_pv[foil][2].get() == 1 and foils_pv[foil][3].get() == 0:
|
|
131
|
-
status = 0
|
|
132
|
-
else:
|
|
133
|
-
status = 1
|
|
134
|
-
|
|
135
|
-
MU_x = sum(foils_in)
|
|
136
|
-
transmission = 1.0 * (math.exp(-MU_x))
|
|
137
|
-
|
|
138
|
-
return transmission, status
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
def main():
|
|
142
|
-
energy = read_input()["energy"]
|
|
143
|
-
T = read_transmission(energy)
|
|
144
|
-
transmission = round(T[0] * 100, 2)
|
|
145
|
-
foil_status = T[1]
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if __name__ == "__main__":
|
|
149
|
-
main()
|
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""Transmission control for MANACA.
|
|
5
|
-
Attenuator: ABS-300-12-C-DN-DN40 Flanges.
|
|
6
|
-
Foils: #1, 8 um Al;
|
|
7
|
-
#2, 10 um Al;
|
|
8
|
-
#3, 20 um Al;
|
|
9
|
-
#4, 80 um Al;
|
|
10
|
-
#5, 160 um Al;
|
|
11
|
-
#6, 320 um Al;
|
|
12
|
-
#7, 800 um Al;
|
|
13
|
-
#8, 1500 um Al;
|
|
14
|
-
#9, 8 um Ti;
|
|
15
|
-
#10, 10 um Cu
|
|
16
|
-
#11, 5 um Au;
|
|
17
|
-
#12, 25 um Zr.
|
|
18
|
-
Here we use the Beer-Lambert law to calculate the transmission/attenuation: I = I0 * e^-(MU * d)
|
|
19
|
-
were I is the transmitted (final) beam intensity, I0 is the incident (initial) beam intensity,
|
|
20
|
-
MU is the linear attenuation coefficient (cm^-1) and d is the thickness of the foil (cm).
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
|
-
import argparse
|
|
24
|
-
import itertools
|
|
25
|
-
import math
|
|
26
|
-
import time
|
|
27
|
-
|
|
28
|
-
from epics import PV
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def read_input():
|
|
32
|
-
# Read inputs from terminal
|
|
33
|
-
ap = argparse.ArgumentParser()
|
|
34
|
-
ap.add_argument(
|
|
35
|
-
"-e",
|
|
36
|
-
"--energy",
|
|
37
|
-
required=True,
|
|
38
|
-
type=float,
|
|
39
|
-
help="Energy of the x-ray beam [keV]",
|
|
40
|
-
)
|
|
41
|
-
ap.add_argument(
|
|
42
|
-
"-t",
|
|
43
|
-
"--transmission",
|
|
44
|
-
required=True,
|
|
45
|
-
type=float,
|
|
46
|
-
help="Transmission to be set, [%]",
|
|
47
|
-
)
|
|
48
|
-
args = vars(ap.parse_args())
|
|
49
|
-
return args
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def get_transmission(energy, transmission):
|
|
53
|
-
transmission = transmission / 100
|
|
54
|
-
# Expressions (interpolation) for calculations of MU (linear attenuation coefficient [cm^-1]) for each material in function of the beam energy.
|
|
55
|
-
# The data used to obtain the expressions (curve fitting) are from "https://physics.nist.gov/PhysRefData/FFast/html/form.html"
|
|
56
|
-
# This attenuation coefficients can be verified and optimised after experimental validation at the beamline.
|
|
57
|
-
MU_Al = (
|
|
58
|
-
(78657.01011 * math.exp(-energy / 0.65969))
|
|
59
|
-
+ (6406.36151 * math.exp(-energy / 1.63268))
|
|
60
|
-
+ (492.29999 * math.exp(-energy / 4.42554))
|
|
61
|
-
+ (3.2588)
|
|
62
|
-
)
|
|
63
|
-
MU_Ti = (
|
|
64
|
-
(28062.17632 * math.exp(-energy / 1.88062))
|
|
65
|
-
+ (6354120 * math.exp(-energy / 0.49973))
|
|
66
|
-
+ (2257.91488 * math.exp(-energy / 5.28296))
|
|
67
|
-
+ (17.4342)
|
|
68
|
-
)
|
|
69
|
-
MU_Cu = (
|
|
70
|
-
(1147850000 * math.exp(-energy / 0.56933))
|
|
71
|
-
+ (2582.7593 * math.exp(-energy / 8.40671))
|
|
72
|
-
+ (30628.08291 * math.exp(-energy / 2.98937))
|
|
73
|
-
+ (22.4187)
|
|
74
|
-
)
|
|
75
|
-
MU_Au = (42783.04258 * math.exp(-energy / 5.39244)) + (399.59714)
|
|
76
|
-
MU_Zr = (11143.28458 * math.exp(-energy / 5.87029)) + (102.27474)
|
|
77
|
-
MU_EMPTY = 0.0
|
|
78
|
-
# Foils in ABS-attenuator. The dictionary gives the foil position and material in the key (e.g. 'F1_Al', position 1 occupied by an aluminium foil),
|
|
79
|
-
# and the thickness [um] in the value. The list gives the positions and materials, similar to the dictionary, and it is used in the combination.
|
|
80
|
-
foils_dict = {
|
|
81
|
-
"F0_EMPTY": 0,
|
|
82
|
-
"F1_Al": 8,
|
|
83
|
-
"F2_Al": 10,
|
|
84
|
-
"F3_Al": 20,
|
|
85
|
-
"F4_Al": 80,
|
|
86
|
-
"F5_Al": 160,
|
|
87
|
-
"F6_Al": 320,
|
|
88
|
-
"F7_Al": 800,
|
|
89
|
-
"F8_Al": 1500,
|
|
90
|
-
"F9_Ti": 8,
|
|
91
|
-
"F10_Cu": 10,
|
|
92
|
-
"F11_Au": 5,
|
|
93
|
-
"F12_Zr": 25,
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
attenuator_position = [
|
|
97
|
-
"F0_EMPTY",
|
|
98
|
-
"F1_Al",
|
|
99
|
-
"F2_Al",
|
|
100
|
-
"F3_Al",
|
|
101
|
-
"F4_Al",
|
|
102
|
-
"F5_Al",
|
|
103
|
-
"F6_Al",
|
|
104
|
-
"F7_Al",
|
|
105
|
-
"F8_Al",
|
|
106
|
-
"F9_Ti",
|
|
107
|
-
"F10_Cu",
|
|
108
|
-
"F11_Au",
|
|
109
|
-
"F12_Zr",
|
|
110
|
-
]
|
|
111
|
-
# conditions to use only the continuous part of the absorption spectra and not the edge region. It can be optimised after experimental validation.
|
|
112
|
-
if energy < 6.5:
|
|
113
|
-
attenuator_position = attenuator_position[0:9]
|
|
114
|
-
elif 6.5 <= energy < 9.5:
|
|
115
|
-
attenuator_position = attenuator_position[0:10]
|
|
116
|
-
elif 9.5 <= energy < 15.0:
|
|
117
|
-
attenuator_position = attenuator_position[0:11]
|
|
118
|
-
elif 15.0 <= energy < 18.5:
|
|
119
|
-
attenuator_position = attenuator_position[0:12]
|
|
120
|
-
elif energy >= 18.5:
|
|
121
|
-
attenuator_position = attenuator_position[0:13]
|
|
122
|
-
|
|
123
|
-
foils_comb = []
|
|
124
|
-
atten_coef_sum = []
|
|
125
|
-
|
|
126
|
-
# calculate the all possible unique combinations
|
|
127
|
-
for i in range(1, len(attenuator_position) + 1):
|
|
128
|
-
product = itertools.combinations(attenuator_position, i)
|
|
129
|
-
for item in product:
|
|
130
|
-
foils_comb.append(list(item))
|
|
131
|
-
# calculate the product of MU (cm^-1) * thickness (cm) for each material (MU * d)
|
|
132
|
-
# and sum the products to obtain the total (final) attenuation for each possible combination.
|
|
133
|
-
# and put the results (total attenuation) in a list.
|
|
134
|
-
comb_sum = []
|
|
135
|
-
for item in foils_comb:
|
|
136
|
-
comb_tmp = []
|
|
137
|
-
for sub_item in item:
|
|
138
|
-
if "_Al" in sub_item:
|
|
139
|
-
atten_mu_x = float(foils_dict[sub_item] * 1.0e-4) * MU_Al
|
|
140
|
-
comb_tmp.append(atten_mu_x)
|
|
141
|
-
elif "_Ti" in sub_item:
|
|
142
|
-
atten_mu_x = float(foils_dict[sub_item] * 1.0e-4) * MU_Ti
|
|
143
|
-
comb_tmp.append(atten_mu_x)
|
|
144
|
-
elif "_Cu" in sub_item:
|
|
145
|
-
atten_mu_x = float(foils_dict[sub_item] * 1.0e-4) * MU_Cu
|
|
146
|
-
comb_tmp.append(atten_mu_x)
|
|
147
|
-
elif "_Au" in sub_item:
|
|
148
|
-
atten_mu_x = float(foils_dict[sub_item] * 1.0e-4) * MU_Au
|
|
149
|
-
comb_tmp.append(atten_mu_x)
|
|
150
|
-
elif "_Zr" in sub_item:
|
|
151
|
-
atten_mu_x = float(foils_dict[sub_item] * 1.0e-4) * MU_Zr
|
|
152
|
-
comb_tmp.append(atten_mu_x)
|
|
153
|
-
elif "_EMPTY" in sub_item:
|
|
154
|
-
atten_mu_x = float(foils_dict[sub_item] * 1.0e-4) * MU_EMPTY
|
|
155
|
-
comb_tmp.append(atten_mu_x)
|
|
156
|
-
|
|
157
|
-
comb_sum.append(sum(comb_tmp))
|
|
158
|
-
|
|
159
|
-
# create a dictionary to correlate the combinations of foils (value) with the total attenuation (key)
|
|
160
|
-
FOILS = dict(zip(comb_sum, foils_comb))
|
|
161
|
-
# calculate the transmission for each combination using the product calculated before (the keys of FOILS)
|
|
162
|
-
FOILS_T = {1.0 * (math.exp(-k)): v for k, v in FOILS.items()}
|
|
163
|
-
# find the closest transmission that is possible to obtain with the foils on ABS-300.
|
|
164
|
-
closest_transmission = min(
|
|
165
|
-
FOILS_T.keys(), key=lambda k: abs(float(k) - transmission)
|
|
166
|
-
)
|
|
167
|
-
# get the foil combination for the closest transmission found
|
|
168
|
-
filter_combination = FOILS_T[closest_transmission]
|
|
169
|
-
|
|
170
|
-
return transmission, closest_transmission, filter_combination
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
def set_foils(filter_combination):
|
|
174
|
-
# declare a list with available foils and a dictionary with epics PV class (FOIL ACT, FOIL IN, FOIL OUT) for each foil
|
|
175
|
-
attenuator_position = [
|
|
176
|
-
"F1_Al",
|
|
177
|
-
"F2_Al",
|
|
178
|
-
"F3_Al",
|
|
179
|
-
"F4_Al",
|
|
180
|
-
"F5_Al",
|
|
181
|
-
"F6_Al",
|
|
182
|
-
"F7_Al",
|
|
183
|
-
"F8_Al",
|
|
184
|
-
"F9_Ti",
|
|
185
|
-
"F10_Cu",
|
|
186
|
-
"F11_Au",
|
|
187
|
-
"F12_Zr",
|
|
188
|
-
]
|
|
189
|
-
|
|
190
|
-
foils_pv = {
|
|
191
|
-
"F1_Al": (
|
|
192
|
-
PV("MNC:B:RIO01:9474C:bo0"),
|
|
193
|
-
PV("MNC:B:RIO01:9425A:bi11"),
|
|
194
|
-
PV("MNC:B:RIO01:9425A:bi12"),
|
|
195
|
-
),
|
|
196
|
-
"F2_Al": (
|
|
197
|
-
PV("MNC:B:RIO01:9474C:bo1"),
|
|
198
|
-
PV("MNC:B:RIO01:9425A:bi10"),
|
|
199
|
-
PV("MNC:B:RIO01:9425A:bi13"),
|
|
200
|
-
),
|
|
201
|
-
"F3_Al": (
|
|
202
|
-
PV("MNC:B:RIO01:9474C:bo2"),
|
|
203
|
-
PV("MNC:B:RIO01:9425A:bi9"),
|
|
204
|
-
PV("MNC:B:RIO01:9425A:bi14"),
|
|
205
|
-
),
|
|
206
|
-
"F4_Al": (
|
|
207
|
-
PV("MNC:B:RIO01:9474C:bo3"),
|
|
208
|
-
PV("MNC:B:RIO01:9425A:bi8"),
|
|
209
|
-
PV("MNC:B:RIO01:9425A:bi15"),
|
|
210
|
-
),
|
|
211
|
-
"F5_Al": (
|
|
212
|
-
PV("MNC:B:RIO01:9474C:bo4"),
|
|
213
|
-
PV("MNC:B:RIO01:9425A:bi7"),
|
|
214
|
-
PV("MNC:B:RIO01:9425A:bi16"),
|
|
215
|
-
),
|
|
216
|
-
"F6_Al": (
|
|
217
|
-
PV("MNC:B:RIO01:9474C:bo5"),
|
|
218
|
-
PV("MNC:B:RIO01:9425A:bi6"),
|
|
219
|
-
PV("MNC:B:RIO01:9425A:bi17"),
|
|
220
|
-
),
|
|
221
|
-
"F7_Al": (
|
|
222
|
-
PV("MNC:B:RIO01:9474C:bo6"),
|
|
223
|
-
PV("MNC:B:RIO01:9425A:bi5"),
|
|
224
|
-
PV("MNC:B:RIO01:9425A:bi18"),
|
|
225
|
-
),
|
|
226
|
-
"F8_Al": (
|
|
227
|
-
PV("MNC:B:RIO01:9474C:bo7"),
|
|
228
|
-
PV("MNC:B:RIO01:9425A:bi4"),
|
|
229
|
-
PV("MNC:B:RIO01:9425A:bi19"),
|
|
230
|
-
),
|
|
231
|
-
"F9_Ti": (
|
|
232
|
-
PV("MNC:B:RIO01:9474D:bo0"),
|
|
233
|
-
PV("MNC:B:RIO01:9425A:bi3"),
|
|
234
|
-
PV("MNC:B:RIO01:9425A:bi20"),
|
|
235
|
-
),
|
|
236
|
-
"F10_Cu": (
|
|
237
|
-
PV("MNC:B:RIO01:9474D:bo1"),
|
|
238
|
-
PV("MNC:B:RIO01:9425A:bi2"),
|
|
239
|
-
PV("MNC:B:RIO01:9425A:bi21"),
|
|
240
|
-
),
|
|
241
|
-
"F11_Au": (
|
|
242
|
-
PV("MNC:B:RIO01:9474D:bo2"),
|
|
243
|
-
PV("MNC:B:RIO01:9425A:bi1"),
|
|
244
|
-
PV("MNC:B:RIO01:9425A:bi22"),
|
|
245
|
-
),
|
|
246
|
-
"F12_Zr": (
|
|
247
|
-
PV("MNC:B:RIO01:9474D:bo3"),
|
|
248
|
-
PV("MNC:B:RIO01:9425A:bi0"),
|
|
249
|
-
PV("MNC:B:RIO01:9425A:bi23"),
|
|
250
|
-
),
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
# setup the foils: check foil status, put the foils in the 'filter_combination' and remove the others
|
|
254
|
-
|
|
255
|
-
wt = 0.1
|
|
256
|
-
|
|
257
|
-
# the commented lines below works for the attenuator expected logic (0 for foil out and 1 for foil in).
|
|
258
|
-
# as the current logic is inverted (1 is foil out and 0 is foil in) use the uncommented lines.
|
|
259
|
-
|
|
260
|
-
for foil in attenuator_position:
|
|
261
|
-
if foil in filter_combination:
|
|
262
|
-
# if foils_pv[foil][1].get() == 0 and foils_pv[foil][2].get() == 1:
|
|
263
|
-
if foils_pv[foil][1].get() == 1 and foils_pv[foil][2].get() == 0:
|
|
264
|
-
# foils_pv[foil][0].put(1)
|
|
265
|
-
foils_pv[foil][0].put(0)
|
|
266
|
-
status = 0
|
|
267
|
-
time.sleep(wt)
|
|
268
|
-
# elif foils_pv[foil][1].get() == 1 and foils_pv[foil][2].get() == 0:
|
|
269
|
-
elif foils_pv[foil][1].get() == 0 and foils_pv[foil][2].get() == 1:
|
|
270
|
-
status = 0
|
|
271
|
-
elif foils_pv[foil][1].get() == foils_pv[foil][2].get():
|
|
272
|
-
status = 1
|
|
273
|
-
break
|
|
274
|
-
else:
|
|
275
|
-
# if foils_pv[foil][1].get() == 0 and foils_pv[foil][2].get() == 1:
|
|
276
|
-
if foils_pv[foil][1].get() == 1 and foils_pv[foil][2].get() == 0:
|
|
277
|
-
status = 0
|
|
278
|
-
# elif foils_pv[foil][1].get() == 1 and foils_pv[foil][2].get() == 0:
|
|
279
|
-
elif foils_pv[foil][1].get() == 0 and foils_pv[foil][2].get() == 1:
|
|
280
|
-
# foils_pv[foil][0].put(0)
|
|
281
|
-
foils_pv[foil][0].put(1)
|
|
282
|
-
status = 0
|
|
283
|
-
time.sleep(wt)
|
|
284
|
-
elif foils_pv[foil][1].get() == foils_pv[foil][2].get():
|
|
285
|
-
status = 1
|
|
286
|
-
break
|
|
287
|
-
|
|
288
|
-
return status
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
def main():
|
|
292
|
-
energy = read_input()["energy"]
|
|
293
|
-
transmission = read_input()["transmission"]
|
|
294
|
-
transmission_setup = get_transmission(energy, transmission)
|
|
295
|
-
# transmission required by the user
|
|
296
|
-
user_transmission = transmission_setup[0] * 100
|
|
297
|
-
# real transmission got with calculated foil combination
|
|
298
|
-
actual_transmission = round(transmission_setup[1] * 100, 2)
|
|
299
|
-
# calculated foil combination to get the required transmission
|
|
300
|
-
filter_combination = transmission_setup[2]
|
|
301
|
-
# put the foils and check if the they were correctly positioned (status:0 = ok; 1 = fail)
|
|
302
|
-
foil_status = set_foils(filter_combination)
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if __name__ == "__main__":
|
|
306
|
-
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|