-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathi06.py
78 lines (65 loc) · 2.57 KB
/
i06.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
75
76
77
78
from startup._common_imports import * # @UnusedWildImport
from diffcalc.gdasupport.minigda.scannable import ScannableMotionWithScannableFieldsBase # @UnusedImport
from diffcalc.hkl.you.geometry import YouGeometry, YouPosition
from diffcalc.settings import NUNAME
from diffcalc.hardware import setrange
from diffcalc.hkl.you.calc import SMALL
if not GDA:
import startup._demo
else:
# import __main__ # @UnresolvedImport
from __main__ import dd2th,ddth,dummychi,energy # @UnresolvedImport
LOCAL_MANUAL = "http://confluence.diamond.ac.uk/pages/viewpage.action?pageId=31853413"
# Diffcalc i06-1
# ======== ===
# delta dd2th
# eta ddth
# chi dummy
# phi 0
class ThreeCircleI06(YouGeometry):
"""For a diffractometer with theta two-theta geometry:
delta, eta
"""
def __init__(self, beamline_axes_transform=None):
YouGeometry.__init__(self, 'threec', {'mu': 0, NUNAME: 0, 'phi': 0}, beamline_axes_transform)
def physical_angles_to_internal_position(self, physical_angle_tuple):
# mu, delta, nu, eta, chi, phi
delta_phys, eta_phys, chi_phys = physical_angle_tuple
return YouPosition(0, delta_phys, 0, eta_phys, chi_phys, 0, 'DEG')
def internal_position_to_physical_angles(self, internal_position):
clone_position = internal_position.clone()
clone_position.changeToDegrees()
_, delta_phys, _, eta_phys, chi_phys, _ = clone_position.totuple()
return delta_phys, eta_phys, chi_phys
### Create dummy scannables ###
if GDA:
print "!!! Starting LIVE diffcalc with delta(dd2th), eta(ddth), chi(dummy) and denergy."
_threec = ScannableGroup('_threec', (dd2th, ddth, dummychi))
delta = _threec.dd2th
eta = _threec.ddth
en=energy
# if float(en.getPosition()) == 0: # no energy value - dummy mode
# en(800)
else:
delta = Dummy('delta')
eta = Dummy('eta')
chi = Dummy('chi')
_threec = ScannableGroup('_threec', (delta, eta, chi))
en = Dummy('en')
en(800)
en.level = 3
### Configure and import diffcalc objects ###
ESMTGKeV = 0.001
settings.hardware = ScannableHardwareAdapter(_threec, en, ESMTGKeV)
settings.geometry = ThreeCircleI06() # @UndefinedVariable
settings.energy_scannable = en
settings.axes_scannable_group= _threec
settings.energy_scannable_multiplier_to_get_KeV = ESMTGKeV
if not GDA:
setrange('chi', 90 - SMALL, 90 + SMALL)
from diffcalc.gdasupport.you import * # @UnusedWildImport
if GDA:
print "Running in GDA --- aliasing commands"
alias_commands(globals())
# Load the last ub calculation used
lastub()