Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iexcode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
29id
iexcode
Commits
353c7ee5
Commit
353c7ee5
authored
2 years ago
by
29iduser
Browse files
Options
Downloads
Patches
Plain Diff
debug
parent
5bc9af95
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
iexcode/instruments/kappa_angle_calcs.py
+6
-6
6 additions, 6 deletions
iexcode/instruments/kappa_angle_calcs.py
iexcode/macros/hkl_iex.py
+52
-39
52 additions, 39 deletions
iexcode/macros/hkl_iex.py
requirements.txt
+6
-8
6 additions, 8 deletions
requirements.txt
with
64 additions
and
53 deletions
iexcode/instruments/kappa_angle_calcs.py
+
6
−
6
View file @
353c7ee5
...
...
@@ -74,10 +74,10 @@ def _euler_to_kappa(e_theta,e_chi,e_phi,**kwargs):
kth
,
kap
,
kphi
=
0
,
0
,
0
else
:
k_ang
=
k_arm
*
pi_deg
delta
=
np
.
asin
(
-
np
.
tan
(
e_chi
*
pi_deg
/
2.0
)
/
np
.
tan
(
k_ang
)
)
delta
=
np
.
a
rc
sin
(
-
np
.
tan
(
e_chi
*
pi_deg
/
2.0
)
/
np
.
tan
(
k_ang
)
)
k_theta
=
e_theta
*
pi_deg
-
delta
k_kappa
=
2.0
*
np
.
asin
(
np
.
sin
(
e_chi
*
pi_deg
/
2.0
)
/
np
.
sin
(
k_ang
))
k_kappa
=
2.0
*
np
.
a
rc
sin
(
np
.
sin
(
e_chi
*
pi_deg
/
2.0
)
/
np
.
sin
(
k_ang
))
k_phi
=
e_phi
*
pi_deg
-
delta
kth
=
np
.
round_
(
k_theta
/
pi_deg
)
-
(
57.045
-
kth_offset
)
...
...
@@ -98,7 +98,7 @@ def _kappa_to_euler(k_theta,k_kappa,k_phi,**kwargs):
k_ang
=
k_arm
*
pi_deg
delta
=
np
.
atan
(
np
.
tan
(
k_kappa
*
pi_deg
/
2.0
)
*
np
.
cos
(
k_ang
)
)
e_theta
=
k_theta
*
pi_deg
-
delta
e_chi
=
2.0
*
np
.
asin
(
np
.
sin
(
k_kappa
*
pi_deg
/
2.0
)
*
np
.
sin
(
k_ang
)
)
e_chi
=
2.0
*
np
.
a
rc
sin
(
np
.
sin
(
k_kappa
*
pi_deg
/
2.0
)
*
np
.
sin
(
k_ang
)
)
e_phi
=
k_phi
*
pi_deg
-
delta
theta
=
np
.
round_
(
e_theta
/
pi_deg
,
3
)
+
(
57.045
-
kth_offset
)
...
...
@@ -159,9 +159,9 @@ def EtoK(e_theta,e_chi,e_phi,k_arm=50):
else
:
print
((
"
Calculating Kappa angles using kth0 =
"
+
str
(
kth_offset
)))
k_ang
=
k_arm
*
conv
delta
=
np
.
asin
(
-
np
.
tan
(
e_chi
*
conv
/
2.0
)
/
np
.
tan
(
k_ang
)
)
delta
=
np
.
a
rc
sin
(
-
np
.
tan
(
e_chi
*
conv
/
2.0
)
/
np
.
tan
(
k_ang
)
)
k_theta
=
e_theta
*
conv
-
delta
k_kappa
=
2.0
*
np
.
asin
(
np
.
sin
(
e_chi
*
conv
/
2.0
)
/
np
.
sin
(
k_ang
))
k_kappa
=
2.0
*
np
.
a
rc
sin
(
np
.
sin
(
e_chi
*
conv
/
2.0
)
/
np
.
sin
(
k_ang
))
k_phi
=
e_phi
*
conv
-
delta
#print k_theta, k_kappa,k_phi
kth
=
rounder
(
k_theta
)
-
(
57.045
-
kth_offset
)
...
...
@@ -180,7 +180,7 @@ def KtoE(k_theta,k_kappa,k_phi,k_arm=50):
k_ang
=
k_arm
*
conv
delta
=
np
.
atan
(
np
.
tan
(
k_kappa
*
conv
/
2.0
)
*
np
.
cos
(
k_ang
)
)
e_theta
=
k_theta
*
conv
-
delta
e_chi
=
2.0
*
np
.
asin
(
np
.
sin
(
k_kappa
*
conv
/
2.0
)
*
np
.
sin
(
k_ang
)
)
e_chi
=
2.0
*
np
.
a
rc
sin
(
np
.
sin
(
k_kappa
*
conv
/
2.0
)
*
np
.
sin
(
k_ang
)
)
e_phi
=
k_phi
*
conv
-
delta
#print round(e_theta,1),round(e_phi,1),round(e_chi,1)
theta
=
rounder
(
e_theta
)
+
(
57.045
-
kth_offset
)
...
...
This diff is collapsed.
Click to expand it.
iexcode/macros/hkl.py
→
iexcode/macros/hkl
_iex
.py
+
52
−
39
View file @
353c7ee5
...
...
@@ -38,6 +38,58 @@ from iexcode.instruments.VLS_PGM import mono_scan_pvs
import
collections
import
pyRestTable
# define the 4-circle, based on expecting motor PVs
class
FourCircleDiffractometer
(
SimulatedE4CV
):
pass
# create the 4-circle diffractometer object
fourc
=
FourCircleDiffractometer
(
''
,
name
=
"
fourc
"
)
select_diffractometer
(
fourc
)
# What the available modes with this diffractometer?
print
(
f
"
\n
{
fourc
.
name
}
modes:
{
fourc
.
engine
.
modes
}
"
)
# Define motors RBVs:
"""
kappa_motor_dict = _kappa_motor_dictionary()
tth_rbv = EpicsSignalRO(kappa_motor_dict[
'
tth
'
][0], name=
"
tth_rbv
"
)
omega_rbv = EpicsSignalRO(kappa_motor_dict[
'
th
'
][0], name=
"
omega_rbv
"
)
chi_rbv = EpicsSignalRO(kappa_motor_dict[
'
chi
'
][0], name=
"
chi_rbv
"
)
phi_rbv = EpicsSignalRO(kappa_motor_dict[
'
phi
'
][0], name=
"
phi_rbv
"
)
kth_rbv = EpicsSignalRO(kappa_motor_dict[
'
kth
'
][0], name=
"
kth_rbv
"
)
kap_rbv = EpicsSignalRO(kappa_motor_dict[
'
kap
'
][0], name=
"
kap_rbv
"
)
kphi_rbv =EpicsSignalRO(kappa_motor_dict[
'
kphi
'
][0], name=
"
phi_rbv
"
)
"""
print
(
'
We are here
'
)
tth_rbv
=
EpicsSignalRO
(
'
29idKappa:m9.RBV
'
,
name
=
"
tth_rbv
"
)
omega_rbv
=
EpicsSignalRO
(
'
29idKappa:Euler_ThetaRBV
'
,
name
=
"
omega_rbv
"
)
chi_rbv
=
EpicsSignalRO
(
'
29idKappa:Euler_ChiRBV
'
,
name
=
"
chi_rbv
"
)
phi_rbv
=
EpicsSignalRO
(
'
29idKappa:Euler_PhiRBV
'
,
name
=
"
phi_rbv
"
)
kth_rbv
=
EpicsSignalRO
(
'
29idKappa:m8.RBV
'
,
name
=
"
kth_rbv
"
)
kap_rbv
=
EpicsSignalRO
(
'
29idKappa:m7.RBV
'
,
name
=
"
kap_rbv
"
)
kphi_rbv
=
EpicsSignalRO
(
'
29idKappa:m1.RBV
'
,
name
=
"
tth_rbv
"
)
# SPEC equivalent of setmode.
# The planned experiment could use contant phi
fourc
.
calc
.
engine
.
mode
=
"
constant_phi
"
print
(
f
"
\n
selected mode:
{
fourc
.
calc
.
engine
.
mode
}
\n
"
)
# Setup cut point / soft limits:
diffractometer_constraints
=
{
# axis: Constraint(lo_limit, hi_limit, value, fit)
"
omega
"
:
Constraint
(
-
20
,
150
,
0
,
True
),
"
chi
"
:
Constraint
(
-
30
,
100
,
0
,
True
),
# "phi": Constraint(0, 0, 0, False),
"
tth
"
:
Constraint
(
0
,
180
,
0
,
True
),
}
fourc
.
apply_constraints
(
diffractometer_constraints
)
fourc
.
show_constraints
()
print
(
'
\n
WARNING: wavelength set to {:.3f} A = {:.2f} eV
'
.
format
(
fourc
.
calc
.
wavelength
,
fourc
.
calc
.
energy
*
1e3
))
def
hkl_detNum
(
hkl
):
"""
returns the detector number for hkl =
'
h
'
,
'
k
'
,
'
l
'
...
...
@@ -107,45 +159,6 @@ def UB_update_wavelength():
UB_put
(
'
UBenergy
'
,
Lambda2eV
(
fourc
.
calc
.
wavelength
))
UB_put
(
'
UBlambda
'
,
fourc
.
calc
.
wavelength
)
# define the 4-circle, based on expecting motor PVs
class
FourCircleDiffractometer
(
SimulatedE4CV
):
pass
# create the 4-circle diffractometer object
fourc
=
FourCircleDiffractometer
(
''
,
name
=
"
fourc
"
)
select_diffractometer
(
fourc
)
# What the available modes with this diffractometer?
print
(
f
"
\n
{
fourc
.
name
}
modes:
{
fourc
.
engine
.
modes
}
"
)
# Define motors RBVs:
kappa_motor_dict
=
_kappa_motor_dictionary
()
tth_rbv
=
EpicsSignalRO
(
kappa_motor_dict
[
'
tth
'
][
0
],
name
=
"
tth_rbv
"
)
omega_rbv
=
EpicsSignalRO
(
kappa_motor_dict
[
'
th
'
][
0
],
name
=
"
omega_rbv
"
)
chi_rbv
=
EpicsSignalRO
(
kappa_motor_dict
[
'
chi
'
][
0
],
name
=
"
chi_rbv
"
)
phi_rbv
=
EpicsSignalRO
(
kappa_motor_dict
[
'
phi
'
][
0
],
name
=
"
phi_rbv
"
)
kth_rbv
=
EpicsSignalRO
(
kappa_motor_dict
[
'
kth
'
][
0
],
name
=
"
kth_rbv
"
)
kap_rbv
=
EpicsSignalRO
(
kappa_motor_dict
[
'
kap
'
][
0
],
name
=
"
kap_rbv
"
)
kphi_rbv
=
EpicsSignalRO
(
kappa_motor_dict
[
'
kphi
'
][
0
],
name
=
"
phi_rbv
"
)
# SPEC equivalent of setmode.
# The planned experiment could use contant phi
fourc
.
calc
.
engine
.
mode
=
"
constant_phi
"
print
(
f
"
\n
selected mode:
{
fourc
.
calc
.
engine
.
mode
}
\n
"
)
# Setup cut point / soft limits:
diffractometer_constraints
=
{
# axis: Constraint(lo_limit, hi_limit, value, fit)
"
omega
"
:
Constraint
(
-
20
,
150
,
0
,
True
),
"
chi
"
:
Constraint
(
-
30
,
100
,
0
,
True
),
# "phi": Constraint(0, 0, 0, False),
"
tth
"
:
Constraint
(
0
,
180
,
0
,
True
),
}
fourc
.
apply_constraints
(
diffractometer_constraints
)
fourc
.
show_constraints
()
print
(
'
\n
WARNING: wavelength set to {:.3f} A = {:.2f} eV
'
.
format
(
fourc
.
calc
.
wavelength
,
fourc
.
calc
.
energy
*
1e3
))
UB_update_wavelength
()
...
...
This diff is collapsed.
Click to expand it.
requirements.txt
+
6
−
8
View file @
353c7ee5
matplotlib
numpy
scipy
#
matplotlib
#
numpy
#
scipy
h5py
#
h5py
netCDF4
pyepics
#
pyepics
playsound
iexplot
#
iexplot
#pygobject
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment