⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Leginon
All Projects
Leginon
Overview
Activity
Roadmap
Issues
News
Documents
Wiki
Forums
Files
Download (797 Bytes)
Krios Leginon Preferences
ยป tem_classname_change.py
Anchi Cheng
, 04/18/2014 02:17 PM
#!/usr/bin/env python
import
sys
from
sinedon
import
dbupgrade
from
leginon
import
leginondata
'''
Change Tecnai instrument class name to Krios on specified hostname
'''
l
=
dbupgrade
.
DBUpgradeTools
(
'leginondata'
)
hostname
=
raw_input
(
'Enter the hostname as known by Leginon to be changed
\n
'
)
instruments
=
leginondata
.
InstrumentData
(
name
=
'Tecnai'
,
hostname
=
hostname
).
query
()
if
not
instruments
:
print
'Error: No Tecnai instrument associated with the hostname'
sys
.
exit
()
if
len
(
instruments
)
>
1
:
print
'Error: Too many Tecnai instrument associated with the hostname'
sys
.
exit
()
raw_input
(
'Change TEM instrument class name on %s. Enter to proceed'
%
(
hostname
,))
q
=
"update InstrumentData set `name` = 'Krios' where `InstrumentData`.DEF_id = %d"
%
instruments
[
0
].
dbid
l
.
executeQuery
(
q
)
(1-1/1)
Loading...