Update scripts and plugins to 2.0

This commit is contained in:
2025-08-04 12:38:24 +02:00
parent b45d3b4202
commit b631d4c589
44 changed files with 347 additions and 350 deletions
+9 -9
View File
@@ -33,12 +33,12 @@ class DataLayout( ch.psi.pshell.data.LayoutTable):
data_file = time.strftime('%Y%m%d_%H%M') + '_' + get_exec_pars().name + '_' + str(get_exec_pars().count).zfill(4)
print "Opened data file: " + get_exec_pars().path + "/" + data_file
return data_file
get_context().dataManager.setLayout(DataLayout())
get_data_manager.setLayout(DataLayout())
"""
#Reading Energy Scan configuration file
def getPars(element):
f = open(get_context().setup.getConfigPath() + '/energy_scan.properties')
f = open(Setup.getConfigPath() + '/energy_scan.properties')
try:
for line in f:
tokens = line.split("=")
@@ -157,7 +157,7 @@ def convert_file(input_file_name, output_file_name, pol = None):
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + CADC4 + s + CADC5 + s + MCurr + s + time + s + MAGX + s + MAGZ + s + str(pol) + s + EXPT + s + normtey + s + normdiode + line_sep)
except:
traceback.print_exc()
os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
os.rename(input_file_name, Setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
def plot_file(file_name, title = None):
"""
@@ -171,7 +171,7 @@ def elog(title, message, attachments = [], author = None, category = "Info", dom
Add entry to ELOG.
"""
if author is None:
author = "pshell" #get_context().user.name
author = "pshell" #Context.getUserName()
typ = "pshell"
entry = ""
@@ -196,7 +196,7 @@ def elog(title, message, attachments = [], author = None, category = "Info", dom
raise Exception(err)
print out
def get_plot_snapshots(title = None, file_type = "png", temp_path = get_context().setup.getContextPath()):
def get_plot_snapshots(title = None, file_type = "png", temp_path = Setup.getContextPath()):
"""
Returns list with file names of plots snapshots from a plotting context.
"""
@@ -214,12 +214,12 @@ def get_plot_snapshots(title = None, file_type = "png", temp_path = get_context(
# Controller state listener
###################################################################################################
#class Listener(ControllerListener):
# def onControllerStateChanged(self, state, former):
#class Listener(InterpreterListener):
# def onStateChanged(self, state, former):
# global FILENAME
# if former == State.Busy:
# FILENAME = None
#get_context().addListener(Listener()) #Old listeners are cleande in startup
#get_interpreter().addListener(Listener()) #Old listeners are cleande in startup
###################################################################################################
@@ -444,7 +444,7 @@ def otf(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, n
"""
if name is None:
name = get_exec_pars().name
folder = get_context().setup.expandPath("{year}_{month}/{date}");
folder = Setup.expandPath("{year}_{month}/{date}");
run("EnergyScan", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":alpha})
def hyst_cont(field, init_field, final_field, ramp_speed, energies):