Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
beamlinetools_1
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_1
Commits
0fbf15df
Commit
0fbf15df
authored
1 year ago
by
Simone Vadilonga
Browse files
Options
Downloads
Patches
Plain Diff
timeout connection None and mca derived signals first test
parent
7c44a986
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beamlinetools/BEAMLINE_CONFIG/beamline.py
+15
-13
15 additions, 13 deletions
beamlinetools/BEAMLINE_CONFIG/beamline.py
beamlinetools/devices/mca.py
+22
-7
22 additions, 7 deletions
beamlinetools/devices/mca.py
with
37 additions
and
20 deletions
beamlinetools/BEAMLINE_CONFIG/beamline.py
+
15
−
13
View file @
0fbf15df
# Workarounds/patches
from
ophyd.signal
import
EpicsSignalBase
EpicsSignalBase
.
set_defaults
(
timeout
=
200
)
EpicsSignalBase
.
set_defaults
(
connection_timeout
=
None
,
timeout
=
200
)
from
bessyii_devices.ring
import
Ring
...
...
@@ -38,12 +38,12 @@ from beamlinetools.devices.mca_old import xMap
# next_injection.wait_for_connection()
# Keithleys
#
print('Connecting to Amperometers')
#
ks = 'K64851MF102L:'
#
kth00 = keithley6485(ks + '12', name='myspot_keithley0', read_attrs=['readback'], labels={'detectors'})
#
kth00.wait_for_connection()
#
kth01 = keithley6485(ks + '14', name='myspot_keithley1', read_attrs=['readback'], labels={'detectors'})
#
kth01.wait_for_connection()
print
(
'
Connecting to Amperometers
'
)
ks
=
'
K64851MF102L:
'
kth00
=
keithley6485
(
ks
+
'
12
'
,
name
=
'
myspot_keithley0
'
,
read_attrs
=
[
'
readback
'
],
labels
=
{
'
detectors
'
})
kth00
.
wait_for_connection
()
kth01
=
keithley6485
(
ks
+
'
14
'
,
name
=
'
myspot_keithley1
'
,
read_attrs
=
[
'
readback
'
],
labels
=
{
'
detectors
'
})
kth01
.
wait_for_connection
()
# motors
# print('Connecting to motors')
...
...
@@ -53,10 +53,10 @@ from beamlinetools.devices.mca_old import xMap
# mz.wait_for_connection()
# Monochromator
print
(
'
Connecting to DCM
'
)
dcm
=
DCMmySpot
(
"
DCM1OS2L:
"
,
name
=
'
dcm
'
)
dcm
.
wait_for_connection
()
dcm
.
p
.
set_mono_type
()
#
print('Connecting to DCM')
#
dcm = DCMmySpot("DCM1OS2L:", name='dcm')
#
dcm.wait_for_connection()
#
dcm.p.set_mono_type()
# Apertures
# print('Connecting to Slit3')
...
...
@@ -76,6 +76,8 @@ mca_old.wait_for_connection()
from
beamlinetools.devices.mca
import
MyEpicsMCA
mca
=
MyEpicsMCA
(
'
dxpXMAP:
'
,
name
=
"
mca
"
)
from
beamlinetools.devices.mca
import
ExafsDet
from
beamlinetools.devices.mca
import
ExafsDet
,
DivideByArgs
ex_det
=
ExafsDet
(
mca
.
ch1
.
roi0
.
count
,
lt
=
mca
.
ch1
.
lifetime
,
name
=
"
ex_det
"
)
div_det1
=
DivideByArgs
(
mca
.
ch1
.
roi0
.
count
,
[
mca
.
ch1
.
lifetime
],
name
=
"
div_det1
"
)
div_det2
=
DivideByArgs
(
mca
.
ch1
.
roi0
.
count
,
[
mca
.
ch1
.
lifetime
,
kth00
.
readback
],
name
=
"
div_det2
"
)
div_det2l
=
DivideByArgs
(
mca
.
ch1
.
roi0
.
count
,
[
mca
.
ch1
.
lifetime
,
kth00
.
readback
],
log
=
True
,
name
=
"
div_det2l
"
)
This diff is collapsed.
Click to expand it.
beamlinetools/devices/mca.py
+
22
−
7
View file @
0fbf15df
...
...
@@ -71,7 +71,7 @@ class Channel(Device):
lifetime
=
Cpt
(
EpicsSignalRO
,
'
.ELTM
'
,
kind
=
'
config
'
)
realtime
=
Cpt
(
EpicsSignalRO
,
'
.ERTM
'
,
kind
=
'
config
'
)
deadtime
=
Cpt
(
EpicsSignalRO
,
'
.IDTIM
'
,
kind
=
'
config
'
)
class
MyEpicsMCA
(
Device
):
...
...
@@ -158,17 +158,32 @@ class ExafsDet(DerivedSignal):
# 1 signal divided by another one
# 1 signal divided by 2 other signals
# natural log of (1 signal divided by another one)
class
ExafsDetBK
(
DerivedSignal
):
def
__init__
(
self
,
derived_from
,
*
,
lt
=
None
,
write_access
=
None
,
name
=
None
,
parent
=
None
,
**
kwargs
):
self
.
lt
=
lt
import
numpy
as
np
class
DivideByArgs
(
DerivedSignal
):
def
__init__
(
self
,
derived_from
,
divisors
,
log
=
False
,
write_access
=
None
,
name
=
None
,
parent
=
None
,
**
kwargs
):
if
divisors
.
__class__
is
not
list
:
raise
ValueError
(
f
"
divisors should be a list, while it is a
{
type
(
divisors
)
}
"
)
if
len
(
divisors
)
==
0
:
raise
ValueError
(
f
"
The divisors list should contain at least one element
"
)
self
.
_divisors
=
divisors
if
log
.
__class__
is
not
bool
:
raise
ValueError
(
f
"
log should be a bool, while it is a
{
type
(
log
)
}
"
)
self
.
_log
=
log
super
().
__init__
(
derived_from
,
write_access
=
None
,
name
=
None
,
parent
=
None
,
**
kwargs
)
def
inverse
(
self
,
value
):
"""
Compute original signal value -> derived signal value
"""
value
=
value
/
self
.
lt
.
get
()
divisor
=
1
for
div
in
self
.
_divisors
:
divisor
*=
div
.
get
()
value
=
value
/
divisor
if
self
.
_log
:
value
=
np
.
log
(
value
)
return
value
def
forward
(
self
,
value
):
"""
Compute derived signal value -> original signal value
"""
return
value
\ No newline at end of file
return
value
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