diff --git a/bin/psss_panel b/bin/psss_panel index 5149265..e01a609 100755 --- a/bin/psss_panel +++ b/bin/psss_panel @@ -18,7 +18,7 @@ esac done /opt/gfa/pshell/pshell \ - -version=v1_17 \ + -version=v1_17 -last \ -py3 \ -m=${PKG} \ -z \ diff --git a/bin/psss_panel_editor b/bin/psss_panel_editor index 703c6fa..d27b66e 100755 --- a/bin/psss_panel_editor +++ b/bin/psss_panel_editor @@ -19,7 +19,7 @@ done /opt/gfa/pshell/pshell \ - -version=v1_17 \ + -version=v1_17 -last \ -z \ -py3 \ -nbcf=true \ diff --git a/devices/cam_server.properties b/devices/cam_server.properties index 7f7cedb..9a7b024 100755 --- a/devices/cam_server.properties +++ b/devices/cam_server.properties @@ -1,4 +1,4 @@ -#Mon Jan 17 16:00:40 CET 2022 +#Tue Sep 06 10:38:23 CEST 2022 spatialCalOffsetY=-50.02549719530852 spatialCalOffsetX=-50.01953888237593 colormapLogarithmic=false diff --git a/devices/energy_machine.properties b/devices/energy_machine.properties index 93da1d9..5fd8e9e 100644 --- a/devices/energy_machine.properties +++ b/devices/energy_machine.properties @@ -1,9 +1,10 @@ -#Mon Mar 07 12:12:49 CET 2022 +#Fri Jun 17 06:58:23 CEST 2022 +minValue=0.0 +unit=eV offset=0.0 maxValue=20000.0 precision=3 -scale=1000.0 -resolution=NaN -minValue=0.0 -unit=eV sign_bit=0 +scale=1000.0 +description=null +resolution=NaN diff --git a/devices/histo_center.properties b/devices/histo_center.properties index dfccc99..b701f9c 100755 --- a/devices/histo_center.properties +++ b/devices/histo_center.properties @@ -1,6 +1,7 @@ -#Tue Jun 15 11:03:15 CEST 2021 +#Fri Jun 17 06:58:23 CEST 2022 bins=1000 min=11400.0 max=11200.0 precision=-1 +description=null numberOfSamples=10000 diff --git a/devices/histo_fwhm.properties b/devices/histo_fwhm.properties index da35091..374fafd 100755 --- a/devices/histo_fwhm.properties +++ b/devices/histo_fwhm.properties @@ -1,6 +1,7 @@ -#Fri Apr 30 07:45:13 CEST 2021 +#Fri Jun 17 06:58:23 CEST 2022 bins=1000 min=0.0 max=40.0 precision=-1 +description=null numberOfSamples=10000 diff --git a/devices/psss_center_average.properties b/devices/psss_center_average.properties index 6a20991..189691e 100755 --- a/devices/psss_center_average.properties +++ b/devices/psss_center_average.properties @@ -1,4 +1,5 @@ -#Mon May 03 09:21:35 CEST 2021 +#Fri Jun 17 06:58:23 CEST 2022 measures=10 precision=-1 +description=null interval=-1 diff --git a/devices/psss_fwhm_average.properties b/devices/psss_fwhm_average.properties index 6aeec64..189691e 100755 --- a/devices/psss_fwhm_average.properties +++ b/devices/psss_fwhm_average.properties @@ -1,4 +1,5 @@ -#Mon May 03 09:21:52 CEST 2021 +#Fri Jun 17 06:58:23 CEST 2022 measures=10 precision=-1 +description=null interval=-1 diff --git a/devices/psss_spectrum_y_average.properties b/devices/psss_spectrum_y_average.properties index 2c2e72a..c7a2b94 100755 --- a/devices/psss_spectrum_y_average.properties +++ b/devices/psss_spectrum_y_average.properties @@ -1,5 +1,6 @@ -#Mon May 03 09:15:04 CEST 2021 +#Fri Jun 17 06:58:23 CEST 2022 measures=10 precision=-1 +description=null interval=-1 integrate=false diff --git a/script/Lib/builtin_classes.py b/script/Lib/builtin_classes.py index 9408d6f..642f804 100644 --- a/script/Lib/builtin_classes.py +++ b/script/Lib/builtin_classes.py @@ -51,6 +51,8 @@ import ch.psi.pshell.data.LayoutTable as LayoutTable import ch.psi.pshell.data.LayoutFDA as LayoutFDA import ch.psi.pshell.data.LayoutSF as LayoutSF +import ch.psi.pshell.device.Camera as Camera +import ch.psi.pshell.device.CameraBase as CameraBase import ch.psi.pshell.device.Device as Device import ch.psi.pshell.device.DeviceBase as DeviceBase import ch.psi.pshell.device.GenericDevice as GenericDevice @@ -89,6 +91,8 @@ import ch.psi.pshell.device.Readable.ReadableArray as ReadableArray import ch.psi.pshell.device.Readable.ReadableMatrix as ReadableMatrix import ch.psi.pshell.device.Readable.ReadableCalibratedArray as ReadableCalibratedArray import ch.psi.pshell.device.Readable.ReadableCalibratedMatrix as ReadableCalibratedMatrix +import ch.psi.pshell.device.ArrayRegisterStats as ArrayRegisterStats +import ch.psi.pshell.device.DescStatsDouble as DescStatsDouble import ch.psi.pshell.device.ArrayCalibration as ArrayCalibration import ch.psi.pshell.device.MatrixCalibration as MatrixCalibration import ch.psi.pshell.device.Writable as Writable @@ -261,6 +265,8 @@ from javax.swing.SwingUtilities import invokeLater, invokeAndWait import org.jfree.ui.RectangleAnchor as RectangleAnchor import org.jfree.ui.TextAnchor as TextAnchor +import ch.psi.pshell.xscan.ProcessorXScan as ProcessorXScan + def string_to_obj(o): if is_string(o): @@ -414,6 +420,20 @@ class ManualScan (ch.psi.pshell.scan.ManualScan): else: return self._dimensions +def getHardwareScanClass(config): + cls = Class.forName(config["class"]) + class HardwareScan(cls): + def __init__(self, config, writable, readables, start, end, stepSize, passes, zigzag): + cls.__init__(self, config, writable, readables, start, end, stepSize, passes, zigzag) + def onAfterReadout(self, record): + __after_readout(self, record) + def onBeforePass(self, num_pass): + __before_pass(self, num_pass) + def onAfterPass(self, num_pass): + __after_pass(self, num_pass) + return HardwareScan + + class BinarySearch(ch.psi.pshell.scan.BinarySearch): def onBeforeReadout(self, pos): __before_readout(self, pos) def onAfterReadout(self, rec): __after_readout(self, rec) diff --git a/script/Lib/builtin_functions.py b/script/Lib/builtin_functions.py index d51e798..436ce73 100644 --- a/script/Lib/builtin_functions.py +++ b/script/Lib/builtin_functions.py @@ -275,23 +275,48 @@ def hscan(config, writable, readables, start, end, steps, passes=1, zigzag=False Returns: ScanResult. """ - cls = Class.forName(config["class"]) - class HardwareScan(cls): - def __init__(self, config, writable, readables, start, end, stepSize, passes, zigzag): - cls.__init__(self, config, writable, readables, start, end, stepSize, passes, zigzag) - def onAfterReadout(self, record): - __after_readout(self, record) - def onBeforePass(self, num_pass): - __before_pass(self, num_pass) - def onAfterPass(self, num_pass): - __after_pass(self, num_pass) - readables=to_list(string_to_obj(readables)) - scan = HardwareScan(config, writable,readables, start, end , steps, int(passes), zigzag) + cls = getHardwareScanClass(config) + scan = cls(config, writable,readables, start, end , steps, int(passes), zigzag) processScanPars(scan, pars) scan.start() return scan.getResult() +def oscan(ioc, prefix, writable, readables, start, end, steps, integration_time, additional_backlash=0, passes=1, zigzag=False, **pars): + """OTF scan based on crlogic + + Args: + ioc(string): Crlogic ioc + prefix(string): Crlogic prefix + writable(Writable): A cslogic positioner + readables(list of Readable): List of crlogic sensors + start(float): start positions of writable. + end(float): final positions of writables. + steps(int or float): number of scan steps (int) or step size (float). + passes(int, optional): number of passes + integration_time(float) + additional_backlash(float, optional) + pars(keyworded variable length arguments, optional): scan optional named arguments: + - title(str, optional): plotting window name. + - after_read (function(record, scan), optional): callback on each step, after sampling. + - before_pass (function(pass_num, scan), optional): callback before each scan pass execution. + - after_pass (function(pass_num, scan), optional): callback after each scan pass execution. + - abort_on_error (bool, optional): if true then aborts scan in sensor failures. Default is false. + - monitors (list of Device, optional): device values are saved on every change event during the scan. + - snaps (list of Readable, optional): snapshot device values are saved before the scan. + - meta (dict, optional): scan metadata. + + Returns: + ScanResult. + """ + config = {} + config["class"] = "ch.psi.pshell.crlogic.CrlogicScan" + config["ioc"] = ioc + config["prefix"] = prefix + config["integrationTime"] = integration_time + config["additionalBacklash"] = additional_backlash + return hscan(config, writable, readables, start, end, steps, **pars) + def bscan(stream, records, timeout = None, passes=1, **pars): """BS Scan: records all values in a beam synchronous stream. @@ -417,6 +442,18 @@ def escan(name, **pars): return scan.getResult() +def xscan(file_name, arguments={}): + """ Run FDA's XScan (devined in XML file) + + Args: + file_name(string): Name of the file (relative to XScan base folder) + arguments(dict): map of of XScan variables + E.g: in a linear positioner {"idXXXX.start":0.0, "idXXXX.end":5.0, "idXXXX.step_size":0.1}) + + """ + ProcessorXScan().execute(file_name,arguments) + + def bsearch(writables, readable, start, end, steps, maximum = True, strategy = "Normal", latency=0.0, relative=False, **pars): """Binary search: searches writables in a binary search fashion to find a local maximum for the readable. @@ -680,8 +717,9 @@ def create_dataset(path, type, unsigned=False, dimensions=None, features=None): Args: path(str): Path to dataset relative to the current persistence context root. - type(str): array type 'b' = byte, 'h' = short, 'i' = int, 'l' = long, 'f' = float, - 'd' = double, 'c' = char, 's' = String, 'z'=bool, 'o' = Object + type(str or class or Readable): array type 'b' = byte, 'h' = short, 'i' = int, 'l' = long, 'f' = float, + 'd' = double, 'c' = char, 's' = String, 'z'=bool, 'o' = Object + if Readable then create a dataset appropriete for store readable data unsigned(boolean, optional) dimensions(tuple of int, optional): a 0 value means variable length in that dimension. features(dictionary, optional): storage features for the dataset, format specific. @@ -693,7 +731,11 @@ def create_dataset(path, type, unsigned=False, dimensions=None, features=None): Returns: None """ - get_context().dataManager.createDataset(path, ScriptUtils.getType(type), unsigned, dimensions, features) + if isinstance (type,Readable): + get_context().dataManager.createDataset(path, type,dimensions, features) + else: + cls = ScriptUtils.getType(type) if is_string(type) else type + get_context().dataManager.createDataset(path, cls, unsigned, dimensions, features) def create_table(path, names, types=None, lengths=None, features=None): """Create an empty table (dataset of compound type) within the current persistence context. diff --git a/script/Lib/startup_c.py b/script/Lib/startup_c.py index c3ae10e..13a7dd6 100644 --- a/script/Lib/startup_c.py +++ b/script/Lib/startup_c.py @@ -467,6 +467,7 @@ from javax.swing import SwingUtilities from org.jfree.ui import RectangleAnchor as RectangleAnchor from org.jfree.ui import TextAnchor as TextAnchor +from ch.psi.pshell.xscan import ProcessorXScan as ProcessorXScan def string_to_obj(o): if is_string(o): @@ -1391,6 +1392,17 @@ def escan(name, **pars): scan.start() return scan.getResult() +def xscan(file_name, arguments={}): + """ Run FDA's XScan (devined in XML file) + + Args: + file_name(string): Name of the file (relative to XScan base folder) + arguments(dict): map of of XScan variables + E.g: in a linear positioner {"idXXXX.start":0.0, "idXXXX.end":5.0, "idXXXX.step_size":0.1}) + + """ + ProcessorXScan().startExecute(file_name,arguments) + def bsearch(writables, readable, start, end, steps, maximum = True, strategy = "Normal", latency=0.0, relative=False, **pars): """Binary search: searches writables in a binary search fashion to find a local maximum for the readable. @@ -1655,7 +1667,7 @@ def create_dataset(path, type, unsigned=False, dimensions=None, features=None): Args: path(str): Path to dataset relative to the current persistence context root. - type(str): array type 'b' = byte, 'h' = short, 'i' = int, 'l' = long, 'f' = float, + type(str or Readable): array type 'b' = byte, 'h' = short, 'i' = int, 'l' = long, 'f' = float, 'd' = double, 'c' = char, 's' = String, 'z'=bool, 'o' = Object unsigned(boolean, optional) dimensions(tuple of int, optional): a 0 value means variable length in that dimension. @@ -1668,7 +1680,10 @@ def create_dataset(path, type, unsigned=False, dimensions=None, features=None): Returns: None """ - get_context().getDataManager().createDataset(path, ScriptUtils.getType(type), unsigned, dimensions, features) + if "read" in (dir(type)): #If is Readable + get_context().getDataManager().createDataset(path, type,dimensions, features) + else: + get_context().getDataManager().createDataset(path, ScriptUtils.getType(type), unsigned, dimensions, features) def create_table(path, names, types=None, lengths=None, features=None): """Create an empty table (dataset of compound type) within the current persistence context.