Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
beamlinetools_old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
HZB
Bluesky
beamlines_endstations
MySpot
source
beamlinetools_old
Commits
1ba3da70
Commit
1ba3da70
authored
1 year ago
by
Simone Vadilonga
Browse files
Options
Downloads
Patches
Plain Diff
add dcm mode choice
parent
ae738bbd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beamlinetools/devices/dcm_mySpot.py
+24
-12
24 additions, 12 deletions
beamlinetools/devices/dcm_mySpot.py
with
24 additions
and
12 deletions
beamlinetools/devices/dcm_mySpot.py
+
24
−
12
View file @
1ba3da70
...
...
@@ -48,6 +48,7 @@ class DCMmySpotNew(PseudoPositioner):
# otherspseudo_pos.height
mono_type
=
'
Si111
'
mode
=
"
all_motors
"
# The pseudo positioner axes:
energy
=
Cpt
(
PseudoSingle
)
...
...
@@ -85,21 +86,32 @@ class DCMmySpotNew(PseudoPositioner):
def
_setup_move
(
self
,
*
args
):
self
.
set_mono_type
()
super
().
_setup_move
(
*
args
)
def
_calc_real_motor_pos
(
self
,
pseudo_pos
):
if
self
.
mode
==
"
all_motors
"
:
bragg_angle
=
np
.
rad2deg
(
np
.
arcsin
(
self
.
hc_over_e
/
(
2
*
mono_table
[
self
.
mono_type
][
"
monod
"
]
*
pseudo_pos
.
energy
)))
cr2latr_value
=
-
1
*
pseudo_pos
.
height
/
(
2
*
np
.
sin
(
np
.
deg2rad
(
bragg_angle
)))
cr2vetr_value
=
pseudo_pos
.
height
/
(
2
*
np
.
cos
(
np
.
deg2rad
(
bragg_angle
)))
+
mono_table
[
self
.
mono_type
][
'
c1height
'
]
+
mono_table
[
self
.
mono_type
][
'
cr2vetrCorr
'
]
*
cr2latr_value
elif
self
.
mode
==
"
exafs_mode
"
:
bragg_angle
=
np
.
rad2deg
(
np
.
arcsin
(
self
.
hc_over_e
/
(
2
*
mono_table
[
self
.
mono_type
][
"
monod
"
]
*
pseudo_pos
.
energy
)))
cr2latr_value
=
self
.
cr2latr
.
user_readback
.
get
()
# not changed
cr2vetr_value
=
pseudo_pos
.
height
/
(
2
*
np
.
cos
(
np
.
deg2rad
(
bragg_angle
)))
+
mono_table
[
self
.
mono_type
][
'
c1height
'
]
+
mono_table
[
self
.
mono_type
][
'
cr2vetrCorr
'
]
*
cr2latr_value
elif
self
.
mode
==
"
channelcut
"
:
bragg_angle
=
np
.
rad2deg
(
np
.
arcsin
(
self
.
hc_over_e
/
(
2
*
mono_table
[
self
.
mono_type
][
"
monod
"
]
*
pseudo_pos
.
energy
)))
cr2latr_value
=
self
.
cr2latr
.
user_readback
.
get
()
# not changed
cr2vetr_value
=
self
.
cr2vetr
.
user_readback
.
get
()
# not changed
else
:
raise
ValueError
(
f
"
The mode
{
self
.
mode
}
is not allowd. Use only all_motors, exafs_mode or channelcut
"
)
return
bragg_angle
,
cr2latr_value
,
cr2vetr_value
@pseudo_position_argument
def
forward
(
self
,
pseudo_pos
):
bragg_angle
,
cr2latr_value
,
cr2vetr_value
=
self
.
_calc_real_motor_pos
(
pseudo_pos
)
'''
Run a forward (pseudo -> real) calculation
'''
bragg_angle
=
np
.
rad2deg
(
np
.
arcsin
(
self
.
hc_over_e
/
(
2
*
mono_table
[
self
.
mono_type
][
"
monod
"
]
*
pseudo_pos
.
energy
)))
wavelength
=
self
.
hc_over_e
/
pseudo_pos
.
energy
# print(f"bragg {bragg_angle}")
# print(f"pseudo_pos.height {pseudo_pos.height}")
# print(f"pseudo_pos.energy {pseudo_pos.energy}")position
# print(f'mono_table[self.mono_type]["monod"] {mono_table[self.mono_type]["monod"]}')
cr2latr_value
=
-
1
*
pseudo_pos
.
height
/
(
2
*
np
.
sin
(
np
.
deg2rad
(
bragg_angle
)))
return
self
.
RealPosition
(
cr2latr
=
cr2latr_value
,
monobr
=
bragg_angle
,
cr2vetr
=
pseudo_pos
.
height
/
(
2
*
np
.
cos
(
np
.
deg2rad
(
bragg_angle
)))
+
mono_table
[
self
.
mono_type
][
'
c1height
'
]
+
mono_table
[
self
.
mono_type
][
'
cr2vetrCorr
'
]
*
cr2latr_value
,
return
self
.
RealPosition
(
monobr
=
bragg_angle
,
cr2vetr
=
cr2vetr_value
,
cr2latr
=
cr2latr_value
,
)
@real_position_argument
...
...
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