Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CCS
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
Marko Mecina
CCS
Compare revisions
82bfeb74a94392e2500b18b64e68b5255051b8b3 to 26572af30186b84cf613ad266bbc0cf9d7434191
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
mecinam2/ccs
Select target project
No results found
26572af30186b84cf613ad266bbc0cf9d7434191
Select Git revision
Branches
release
workshop
2 results
Swap
Target
mecinam2/ccs
Select target project
mecinam2/ccs
1 result
82bfeb74a94392e2500b18b64e68b5255051b8b3
Select Git revision
Branches
release
workshop
2 results
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
add tutorial script
· 4debee9f
Marko Mecina
authored
11 months ago
4debee9f
invert logic
· 26572af3
Marko Mecina
authored
11 months ago
26572af3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Ccs/packet_config_ATHENA_DE.py
+1
-1
1 addition, 1 deletion
Ccs/packet_config_ATHENA_DE.py
Ccs/scripts/ATHENA/wfi_de_communication.py
+64
-0
64 additions, 0 deletions
Ccs/scripts/ATHENA/wfi_de_communication.py
with
65 additions
and
1 deletion
Ccs/packet_config_ATHENA_DE.py
View file @
26572af3
...
...
@@ -659,7 +659,7 @@ class FpmProcessor:
def
filter_frames
(
objlist
,
empty_frames
=
True
):
if
not
empty_frames
:
if
empty_frames
:
return
[
x
for
x
in
objlist
if
isinstance
(
x
,
EventFrame
)]
else
:
return
[
x
for
x
in
objlist
if
isinstance
(
x
,
EventFrame
)
and
x
.
nevts
>
0
]
...
...
This diff is collapsed.
Click to expand it.
Ccs/scripts/ATHENA/wfi_de_communication.py
0 → 100644
View file @
26572af3
"""
Examples for Athena WFI DE communications
"""
import
communication
as
com
import
packet_config_ATHENA_DE
as
de
import
tools.dataprocessing.athena_de_frame_proc
as
fputils
# set up socket and connect
decon
=
com
.
Connector
(
''
,
12345
,
msgdecoding
=
'
hex
'
)
decon
.
connect
()
# example commands
# test echo interface (0x20)
decon
.
send
(
b
'
\x20\xDE\xAD
'
)
# HK interface 0x33
decon
.
send
(
de
.
HkCmdRead
(
0x1000
))
# get PCM MODE register
decon
.
send
(
de
.
HkCmdWrite
(
0x1000
,
0x0001
))
# set PCM MODE register
# CMD interface 0x34
decon
.
send
(
de
.
CmdWrite
(
0x3C00
,
0x0001
))
# write sequencer register
decon
.
send
(
de
.
CmdWrite
(
0x3C00
,
1
),
rx
=
False
)
# write sequencer register, but don't fetch cmd response from socket
decon
.
send
(
de
.
CmdRead
(
0x3C00
))
# read sequencer register
# SCI interface 0x35
decon
.
send
(
de
.
SciCmd
(
100
))
# set science data output rate
# dump cmd log (decon.log)
logfile
=
'
/path/to/de_cmd.log
'
decon
.
dump_log
(
logfile
)
# automatically log to file
decon
.
setup_storage
(
logfile
)
# run rx thread on socket, received data is put in recvd_data_buf queue
decon
.
start_receiver
()
decon
.
receiver
.
recvd_data_buf
# optionally, add custom TM processing
# define packet parser and event frame processor
ppa
=
de
.
FpmPktParser
(
96
)
# SCI (0x35) packets have 96 bytes by default (plus the interface byte)
ppr
=
de
.
FpmProcessor
()
decon
.
start_receiver
(
pkt_parser_func
=
ppa
,
procfunc
=
ppr
)
# get the frames from the processed data list and view them
fv
=
fputils
.
FrameViewer
(
de
.
filter_frames
(
decon
.
proc_data
,
empty_frames
=
False
))
fv
.
show
(
cmap
=
'
inferno
'
,
interpolation
=
'
none
'
)
# custom TM processing function; must take bytestring as arg *data*, and timestamp kwarg *ts*
def
msg_to_hex_string
(
data
,
ts
=
''
):
try
:
return
'
{}: {}
\n
'
.
format
(
ts
,
data
.
hex
(
'
'
,
1
))
except
Exception
as
err
:
print
(
err
)
return
'
# ERROR #
\n
'
# this logs the received data hex-formatted in outfile
decon
.
start_receiver
(
procfunc
=
msg_to_hex_string
,
outfile
=
'
/path/to/de_rx.log
'
,
ofmode
=
'
w
'
)
# processed data is also collected in
decon
.
receiver
.
proc_data
This diff is collapsed.
Click to expand it.