-
Notifications
You must be signed in to change notification settings - Fork 0
/
LaserFluencePseudoMotorController.py
74 lines (61 loc) · 2.89 KB
/
LaserFluencePseudoMotorController.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import numpy as np
from sardana.pool.controller import PseudoMotorController
from sardana.pool.controller import Type, Description, DefaultValue, Access, FGet, FSet, DataAccess, Memorize, Memorized
class LaserFluencePseudoMotorController(PseudoMotorController):
"""A Slit pseudo motor controller for handling gap and offset pseudo
motors. The system uses to real motors sl2t (top slit) and sl2b (bottom
slit)."""
axis_attributes = {'pumpHor': {Type: float, Description: 'beam diameter horizontal FWHM in um', DefaultValue: 0.01, Memorized: Memorize},
'pumpVer': {Type: float, Description: 'beam diameter vertical FWHM in um', DefaultValue: 0.01, Memorized: Memorize},
'refl': {Type: float, Description: 'sample reflectivity', DefaultValue: 0, Memorized: Memorize},
'repRate': {Type: float, Description: 'laser repetition rate', DefaultValue: 3000, Memorized: Memorize},
}
pseudo_motor_roles = ("OutputMotor",)
motor_roles = ("InputMotor",)
def __init__(self, inst, props):
PseudoMotorController.__init__(self, inst, props)
def CalcPhysical(self, axis, pseudo_pos, curr_physical_pos):
fluence = pseudo_pos[axis-1]
trans = 1-(self.refl/100)
power = (fluence*self.repRate/1000*np.pi*self.pumpHor/10000/2*self.pumpVer/10000/2)/trans
return power
def CalcPseudo(self, axis, physical_pos, curr_pseudo_pos):
power = physical_pos[axis-1]
trans = 1-(self.refl/100)
fluence = power*trans/(self.repRate/1000*np.pi*self.pumpHor/10000/2*self.pumpVer/10000/2)
return fluence
def GetAxisExtraPar(self, axis, name):
""" Get Smaract axis particular parameters.
@param axis to get the parameter
@param name of the parameter to retrive
@return the value of the parameter
"""
name = name.lower()
if name == 'pumphor':
result = self.pumpHor
elif name == 'pumpver':
result = self.pumpVer
elif name == 'refl':
result = self.refl
elif name == 'reprate':
result = self.repRate
else:
raise ValueError('There is not %s attribute' % name)
return result
def SetAxisExtraPar(self, axis, name, value):
""" Set Smaract axis particular parameters.
@param axis to set the parameter
@param name of the parameter
@param value to be set
"""
name = name.lower()
if name == 'pumphor':
self.pumpHor = value
elif name == 'pumpver':
self.pumpVer = value
elif name == 'refl':
self.refl = value
elif name == 'reprate':
self.repRate = value
else:
raise ValueError('There is not %s attribute' % name)