Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
test-save-gof-rm
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs
util
sequencer
test-save-gof-rm
Commits
891b649e
Commit
891b649e
authored
3 years ago
by
Giulio Gaio
Browse files
Options
Downloads
Patches
Plain Diff
First release
parent
226309e8
No related branches found
Branches containing commit
Tags
1.0.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+19
-0
19 additions, 0 deletions
Makefile
src/TestSaveGofRm.py
+72
-0
72 additions, 0 deletions
src/TestSaveGofRm.py
with
91 additions
and
0 deletions
Makefile
0 → 100644
+
19
−
0
View file @
891b649e
NAME
=
test-save-gof-rm-cli
MAIN
=
TestSaveGofRm.py
DIRNAME
=
$(
NAME:-cli
=
)
MODNAME
=
$(
MAIN:.py
=
)
PY_FILES
+=
$(
wildcard src/
*
.py
)
default
:
bin ${PY_FILES}
@
cp
${
PY_FILES
}
bin/
${
DIRNAME
}
@
echo
"#!/usr/bin/env python
\n
import sys
\n
sys.path.append(sys.path[0]+'/
${
DIRNAME
}
')
\n
from
${
MODNAME
}
import main
\n
if __name__ == '__main__':
\n
main()
\n
"
>
bin/
${
NAME
}
@
chmod
+x bin/
${
NAME
}
bin/
${
DIRNAME
}
/
${
MAIN
}
bin
:
@
test
-d
$@
||
mkdir
-p
$@
/
${
DIRNAME
}
clean
:
@
rm
-fr
bin/ src/
*
~
.PHONY
:
clean
This diff is collapsed.
Click to expand it.
src/TestSaveGofRm.py
0 → 100755
+
72
−
0
View file @
891b649e
#!/usr/bin/python3
#
# This script stores the image of a camera in a sequencer
#
# Usage:
# save-image [sequencer device] [ccd device] [image attribute]
#
# Example:
# save-image.py seq/save/mscrccd_ref_20gev_b1.1 sr/diagnostics/ccd_srpm.01 Image8
#
from
tango
import
*
import
time
,
datetime
import
sys
,
os
def
main
():
try
:
# connect to devices
gof_dev
=
DeviceProxy
(
'
ecgofmasa5/gmbf/0
'
)
dcct
=
DeviceProxy
(
'
sr/diagnostics/dcct_s4
'
)
# get date
today
=
datetime
.
date
.
today
()
# get time
obj_now
=
datetime
.
datetime
.
now
()
# format date-time
date_save
=
today
.
strftime
(
"
%Y-%m-%d
"
)
+
'
-
'
+
str
(
obj_now
.
hour
)
+
'
-
'
+
str
(
obj_now
.
minute
)
+
'
-
'
+
str
(
obj_now
.
second
)
# get machine energy
energy
=
"
{:.0f}Gev
"
.
format
(
dcct
.
Energy
*
10
)
filename
=
"
resp_mat_direct_horver_
"
+
energy
+
"
_
"
+
date_save
+
"
.mat
"
path
=
"
/runtime/site/ecgofmasa5/etc/
"
# full path filename
path_filename
=
path
+
filename
# store the response matrix in the gof master filesystem
gof_dev
.
command_inout
(
"
StoreRmGof
"
,
path_filename
)
# connect to database
db
=
Database
()
# get current rm file
rm_file
=
db
.
get_property
(
"
Gof
"
,
"
RespMatrixFile
"
)
rm_file_list
=
rm_file
[
'
RespMatrixFile
'
]
# get back rm file list
bck_rm_files
=
db
.
get_property
(
"
Gof
"
,
"
RespMatrixFileBck
"
)
bck_rm_files_list
=
bck_rm_files
[
"
RespMatrixFileBck
"
]
# append current rm file as the last element of the backup list
bck_rm_files_list
.
append
(
rm_file_list
[
0
])
# create a dictionary and store it in the backup list
bck_rm_files_list_new
=
{
"
RespMatrixFileBck
"
:
bck_rm_files_list
}
db
.
put_property
(
"
Gof
"
,
bck_rm_files_list_new
)
# store the new response matrix as the default response matrix
rm_files_list_new
=
{
"
RespMatrixFile
"
:[
path_filename
]}
db
.
put_property
(
"
Gof
"
,
rm_files_list_new
)
except
:
print
(
"
Error saving gof default response matrix
"
)
sys
.
exit
(
1
)
sys
.
exit
(
0
)
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
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