Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bliss
bliss
Commits
f9993140
Commit
f9993140
authored
Jul 16, 2021
by
Matias Guijarro
Browse files
Merge branch 'pepu_info' into 'master'
Pepu info + load_config_from_file See merge request
!3876
parents
af0c9a30
30dce25f
Pipeline
#50652
passed with stages
in 115 minutes and 48 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bliss/comm/tcp.py
View file @
f9993140
...
...
@@ -476,7 +476,7 @@ class Command:
return
f
"
{
self
.
__class__
.
__name__
}
[
{
self
.
_host
}
:
{
self
.
_port
}
]"
def
__info__
(
self
):
info_str
=
"TCP COMMAND: host={self._host} port={self._port}
\n
"
info_str
=
f
"TCP COMMAND: host=
{
self
.
_host
}
port=
{
self
.
_port
}
\n
"
return
info_str
@
property
...
...
bliss/controllers/motors/icepap/comm.py
View file @
f9993140
...
...
@@ -82,10 +82,10 @@ def _command(cnx, cmd, data=None, pre_cmd=None, timeout=None):
if
ioex
.
errno
==
113
:
_msg
=
f
"IOError no
{
ioex
.
errno
}
:
{
errno
.
errorcode
[
ioex
.
errno
]
}
"
_msg
+=
f
"
\n
message=
{
os
.
strerror
(
ioex
.
errno
)
}
"
_msg
+=
f
"
\n
Please check that
icepap
controller '
{
cnx
.
_host
}
' is ON"
_msg
+=
f
"
\n
Please check that controller '
{
cnx
.
_host
}
' is ON"
else
:
_msg
=
f
"IOError no
{
ioex
.
errno
}
:
{
ioex
.
strerror
}
"
_msg
+=
f
"
\n
Cannot communicate with
icepap
controller: '
{
cnx
.
_host
}
'"
_msg
+=
f
"
\n
Cannot communicate with controller: '
{
cnx
.
_host
}
'"
raise
CommunicationError
(
_msg
)
from
ioex
...
...
bliss/controllers/pepu.py
View file @
f9993140
...
...
@@ -17,7 +17,6 @@ import numpy
from
bliss.comm.util
import
get_comm
,
TCP
from
bliss.controllers.motors.icepap
import
_command
,
_ackcommand
from
bliss.controllers.counter
import
CounterController
from
bliss.common.counter
import
Counter
...
...
@@ -317,14 +316,6 @@ class BaseChannel(object):
def
pepu
(
self
):
return
self
.
_pepu
()
# Counter shortcut
@
property
def
counters
(
self
):
from
bliss.scanning.acquisition.pepu
import
PepuCounter
return
PepuCounter
(
self
)
class
BaseChannelINOUT
(
BaseChannel
):
...
...
@@ -539,6 +530,9 @@ class PEPU(CounterController):
dance_info
=
DeviceAttr
(
"DINFO"
,
str
,
None
)
config
=
DeviceConfigAttr
()
config_file_name
=
None
_last_loaded_config_file_name
=
None
def
__init__
(
self
,
name
,
config
,
master_controller
=
None
):
super
().
__init__
(
name
,
master_controller
=
master_controller
)
...
...
@@ -551,6 +545,8 @@ class PEPU(CounterController):
url
=
"command://"
+
url
config
[
"tcp"
][
"url"
]
=
url
self
.
config_file_name
=
config
.
get
(
"config_file"
,
None
)
self
.
conn
=
get_comm
(
config
,
TCP
,
eol
=
"
\n
"
)
self
.
in_channels
=
dict
([(
i
,
ChannelIN
(
self
,
i
))
for
i
in
self
.
IN_CHANNELS
])
...
...
@@ -629,6 +625,23 @@ class PEPU(CounterController):
def
raw_write_read
(
self
,
message
,
data
=
None
):
return
_ackcommand
(
self
.
conn
,
message
,
data
=
data
)
def
load_config_from_file
(
self
,
file_name
=
None
):
"""
Load PEPU config from file (file name taken from YML config or
passed as argument)
"""
if
file_name
is
None
and
self
.
config_file_name
is
None
:
raise
ValueError
(
"No config file name specified"
)
if
file_name
is
None
:
file_to_load
=
self
.
config_file_name
else
:
file_to_load
=
file_name
with
open
(
file_to_load
,
mode
=
"r"
)
as
config_file
:
self
.
config
=
config_file
.
read
()
self
.
_last_loaded_config_file_name
=
file_to_load
def
reboot
(
self
):
self
.
raw_write
(
"REBOOT"
)
self
.
conn
.
close
()
...
...
@@ -685,7 +698,16 @@ class PEPU(CounterController):
return
self
.
raw_write_read
(
cmd
)
def
__info__
(
self
):
return
"{0}(name={1!r})"
.
format
(
type
(
self
).
__name__
,
self
.
name
)
info_str
=
f
"
{
type
(
self
).
__name__
}
(name=
{
self
.
name
}
)
\n
"
if
self
.
_last_loaded_config_file_name
is
not
None
:
info_str
+=
(
f
"Last config file loaded =
{
self
.
_last_loaded_config_file_name
}
\n
"
)
info_str
+=
f
"
{
self
.
conn
.
__info__
()
}
\n
"
return
info_str
class
PepuCounter
(
Counter
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment