Closedown
This commit is contained in:
@@ -25,7 +25,7 @@ cur_iteration = 0
|
||||
Scienta.acquisitionMode = Scienta.AcquisitionMode.Swept
|
||||
ret=[]
|
||||
|
||||
set_context(open = True)
|
||||
set_exec_pars(open = True)
|
||||
|
||||
#Global arguments
|
||||
Scienta.passEnergy = pass_energy
|
||||
@@ -39,7 +39,7 @@ spectrum_series = plots[0].getSeries(0)
|
||||
def plot_cur_spectrum():
|
||||
global spectrum_series
|
||||
try:
|
||||
while context.state.running:
|
||||
while get_context().state.running:
|
||||
y = Scienta.spectrum.take(100)
|
||||
x = Scienta.spectrumX
|
||||
spectrum_series.setData(x, y)
|
||||
|
||||
@@ -5,7 +5,7 @@ set_adc_averaging()
|
||||
|
||||
#ascan((ManipulatorPhi, ManipulatorTheta, Scienta.centerEnergy), (Counts, Scienta.image), (-1,-1,50), (1,1,70), (5,5,1), relative = True, zigzag = True, before_read=before_readout, after_read = after_readout)
|
||||
|
||||
set_context(name = "test")
|
||||
set_exec_pars(name = "test")
|
||||
|
||||
class PseudoDevice(Writable):
|
||||
def write(self, val):
|
||||
|
||||
@@ -14,7 +14,7 @@ if Scienta.acquisitionMode != Scienta.AcquisitionMode.Swept:
|
||||
ret=[]
|
||||
|
||||
|
||||
set_context(open = True)
|
||||
set_exec_pars(open = True)
|
||||
|
||||
#Global arguments
|
||||
Scienta.passEnergy = pass_energy
|
||||
@@ -28,7 +28,7 @@ spectrum_series = plots[0].getSeries(0)
|
||||
def plot_cur_spectrum():
|
||||
global spectrum_series
|
||||
try:
|
||||
while context.state.running:
|
||||
while get_context().state.running:
|
||||
y = Scienta.spectrum.take(100)
|
||||
x = Scienta.spectrumX
|
||||
spectrum_series.setData(x, y)
|
||||
|
||||
@@ -202,14 +202,14 @@ def print_diag():
|
||||
|
||||
def create_diag_datasets(parent = None):
|
||||
if parent is None:
|
||||
parent = get_context().group
|
||||
parent = get_exec_pars().group
|
||||
group = parent + "attrs/"
|
||||
for f in diag_channels:
|
||||
create_dataset(group+get_diag_name(f) , 's' if (type(f) is ch.psi.pshell.epics.ChannelString) else 'd')
|
||||
|
||||
def append_diag_datasets(parent = None):
|
||||
if parent is None:
|
||||
parent = get_context().group
|
||||
parent = get_exec_pars().group
|
||||
group = parent + "attrs/"
|
||||
for f in diag_channels:
|
||||
x = f.read()
|
||||
@@ -241,7 +241,7 @@ def before_readout():
|
||||
|
||||
|
||||
def after_readout(rec):
|
||||
if get_context().persist:
|
||||
if get_exec_pars().persist:
|
||||
if rec.index == 0:
|
||||
create_diag_datasets()
|
||||
append_diag_datasets()
|
||||
@@ -273,7 +273,7 @@ def adjust_sensors():
|
||||
SENSORS=[SENSORS.pop(SENSORS.index(dev))] + SENSORS
|
||||
if "Scienta.dataMatrix" in SENSORS or Scienta.dataMatrix in SENSORS:
|
||||
print "Not ACC"
|
||||
set_context(accumulate = False)
|
||||
set_exec_pars(accumulate = False)
|
||||
|
||||
#Device aliases for data files
|
||||
set_device_alias(Scienta.dataMatrix, "ScientaImage")
|
||||
@@ -328,7 +328,7 @@ def elog(title, message, attachments = [], author = None, category = "Info", dom
|
||||
Add entry to ELOG.
|
||||
"""
|
||||
if author is None:
|
||||
author = "pshell" #context.getUser().name
|
||||
author = "pshell" #get_context().getUser().name
|
||||
typ = "pshell"
|
||||
entry = ""
|
||||
|
||||
@@ -353,7 +353,7 @@ def elog(title, message, attachments = [], author = None, category = "Info", dom
|
||||
raise Exception(err)
|
||||
print out
|
||||
|
||||
def get_plot_snapshots(title = None, file_type = "jpg", temp_path = context.setup.getContextPath()):
|
||||
def get_plot_snapshots(title = None, file_type = "jpg", temp_path = get_context().setup.getContextPath()):
|
||||
"""
|
||||
Returns list with file names of plots snapshots from a plotting context.
|
||||
"""
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
if context.state == State.Ready:
|
||||
if get_context().state == State.Ready:
|
||||
print "Testing..."
|
||||
if not Scienta.state.isInitialized():
|
||||
print "Try initialize Scienta..."
|
||||
try:
|
||||
context.evalLine("Scienta.initialize()")
|
||||
get_context().evalLine("Scienta.initialize()")
|
||||
print "Scienta reinit ok"
|
||||
except:
|
||||
print "Scienta reinit failure"
|
||||
@@ -17,7 +17,7 @@ if context.state == State.Ready:
|
||||
if i >= retries-1:
|
||||
print "Scienta timeout, try initialize..."
|
||||
try:
|
||||
context.evalLine("Scienta.initialize()")
|
||||
get_context().evalLine("Scienta.initialize()")
|
||||
print "Scienta reinit ok"
|
||||
except:
|
||||
print "Scienta reinit failure"
|
||||
|
||||
Reference in New Issue
Block a user