diff --git a/config/config.properties b/config/config.properties index c18d5748..fd9bb3a7 100644 --- a/config/config.properties +++ b/config/config.properties @@ -1,10 +1,11 @@ -#Tue Apr 21 17:56:54 CEST 2015 +#Tue Jun 23 15:08:06 CEST 2015 autoSaveScanData=false createSessionFiles=false dataFile={data}/{year}_{month}/{date}/{date}_{time}_{context} dataFilesCreation=true dataPath={data}/{year}_{month}/{date}/{date}_{time}_{context} dataProvider=default +dataScanFlushRecords=false dataScanStrategy=default devicePoolFile={config}/devices.properties deviceUpdateStrategyFile={config}/update.properties diff --git a/devices/phi.properties b/devices/phi.properties index 76096b03..e3c26b94 100644 --- a/devices/phi.properties +++ b/devices/phi.properties @@ -1,6 +1,9 @@ -#Wed Mar 18 09:07:35 CET 2015 +#Tue Jun 23 15:08:08 CEST 2015 accessType=ReadWrite defaultSpeed=1.0 +estbilizationDelay=0 +hasEnable=false +homingType=None maxSpeed=100.0 maxValue=NaN minSpeed=0.001 diff --git a/devices/theta.properties b/devices/theta.properties index 1dc0c1dd..e3c26b94 100644 --- a/devices/theta.properties +++ b/devices/theta.properties @@ -1,12 +1,15 @@ -#Tue Mar 03 17:49:13 CET 2015 +#Tue Jun 23 15:08:08 CEST 2015 accessType=ReadWrite defaultSpeed=1.0 +estbilizationDelay=0 +hasEnable=false +homingType=None +maxSpeed=100.0 +maxValue=NaN minSpeed=0.001 -scale=1.0 -resolution=NaN +minValue=NaN offset=0.0 precision=4 -maxValue=NaN -minValue=NaN +resolution=NaN +scale=1.0 unit=null -maxSpeed=100.0 diff --git a/devices/tilt.properties b/devices/tilt.properties index 1dc0c1dd..e3c26b94 100644 --- a/devices/tilt.properties +++ b/devices/tilt.properties @@ -1,12 +1,15 @@ -#Tue Mar 03 17:49:13 CET 2015 +#Tue Jun 23 15:08:08 CEST 2015 accessType=ReadWrite defaultSpeed=1.0 +estbilizationDelay=0 +hasEnable=false +homingType=None +maxSpeed=100.0 +maxValue=NaN minSpeed=0.001 -scale=1.0 -resolution=NaN +minValue=NaN offset=0.0 precision=4 -maxValue=NaN -minValue=NaN +resolution=NaN +scale=1.0 unit=null -maxSpeed=100.0 diff --git a/devices/x.properties b/devices/x.properties index 1dc0c1dd..e3c26b94 100644 --- a/devices/x.properties +++ b/devices/x.properties @@ -1,12 +1,15 @@ -#Tue Mar 03 17:49:13 CET 2015 +#Tue Jun 23 15:08:08 CEST 2015 accessType=ReadWrite defaultSpeed=1.0 +estbilizationDelay=0 +hasEnable=false +homingType=None +maxSpeed=100.0 +maxValue=NaN minSpeed=0.001 -scale=1.0 -resolution=NaN +minValue=NaN offset=0.0 precision=4 -maxValue=NaN -minValue=NaN +resolution=NaN +scale=1.0 unit=null -maxSpeed=100.0 diff --git a/devices/y.properties b/devices/y.properties index 1dc0c1dd..e3c26b94 100644 --- a/devices/y.properties +++ b/devices/y.properties @@ -1,12 +1,15 @@ -#Tue Mar 03 17:49:13 CET 2015 +#Tue Jun 23 15:08:08 CEST 2015 accessType=ReadWrite defaultSpeed=1.0 +estbilizationDelay=0 +hasEnable=false +homingType=None +maxSpeed=100.0 +maxValue=NaN minSpeed=0.001 -scale=1.0 -resolution=NaN +minValue=NaN offset=0.0 precision=4 -maxValue=NaN -minValue=NaN +resolution=NaN +scale=1.0 unit=null -maxSpeed=100.0 diff --git a/devices/z.properties b/devices/z.properties index 1dc0c1dd..e3c26b94 100644 --- a/devices/z.properties +++ b/devices/z.properties @@ -1,12 +1,15 @@ -#Tue Mar 03 17:49:13 CET 2015 +#Tue Jun 23 15:08:08 CEST 2015 accessType=ReadWrite defaultSpeed=1.0 +estbilizationDelay=0 +hasEnable=false +homingType=None +maxSpeed=100.0 +maxValue=NaN minSpeed=0.001 -scale=1.0 -resolution=NaN +minValue=NaN offset=0.0 precision=4 -maxValue=NaN -minValue=NaN +resolution=NaN +scale=1.0 unit=null -maxSpeed=100.0 diff --git a/script/local.py b/script/local.py deleted file mode 100644 index 81434ed9..00000000 --- a/script/local.py +++ /dev/null @@ -1,2 +0,0 @@ -#scienta.data.monitored=True -#startBackgroudTask("back",1.0) \ No newline at end of file diff --git a/script/startup.py b/script/startup.py deleted file mode 100644 index bc3ff813..00000000 --- a/script/startup.py +++ /dev/null @@ -1,339 +0,0 @@ -import sys -import time -import math -from array import array -from java.lang.reflect import Array as JavaArray - -import java.lang.Class as Class -import org.python.core.PyArray as PyArray -import ch.psi.pshell.dev.MotorGroupBase.MoveMode as MoveMode -import jarray - -import ch.psi.pshell.scan.LineScan -import ch.psi.pshell.scan.AreaScan -import ch.psi.pshell.scan.VectorScan -import ch.psi.pshell.dev.Readable as Readable - -import ch.psi.pshell.epics.Epics as Epics -import ch.psi.pshell.epics.EpicsScan as EpicsScan - - -def onScanBeforeReadout(scan): - try: - if (scan.before_read!=None): - scan.before_read() - except AttributeError: - pass - -def onScanAfterReadout(scan): - try: - if (scan.after_read!=None): - scan.after_read() - except AttributeError: - pass - -class LineScan(ch.psi.pshell.scan.LineScan): - def onBeforeReadout(self): - onScanBeforeReadout(self) - - def onAfterReadout(self): - onScanAfterReadout(self) - -class AreaScan(ch.psi.pshell.scan.AreaScan): - def onBeforeReadout(self): - onScanBeforeReadout(self) - - def onAfterReadout(self): - onScanAfterReadout(self) - -class VectorScan(ch.psi.pshell.scan.VectorScan): - def onBeforeReadout(self): - onScanBeforeReadout(self) - - def onAfterReadout(self): - onScanAfterReadout(self) - -def sleep(sec): - time.sleep(sec) - -def toList(obj): - if isinstance(obj,tuple): - return list(obj) - if not isinstance(obj,list): - return [obj,] - return obj - - -def toArray(obj): - if isinstance(obj,PyArray): - return obj - if isinstance(obj,tuple) or isinstance(obj,list): - if len(obj)>0 and (isinstance(obj[0],tuple) or isinstance(obj[0],list)): - ret = JavaArray.newInstance(Class.forName("[D"),len(obj)) - for i in range(len(obj)): - ret[i]=toArray(obj[i]) - return ret - return jarray.array(obj,'d') - return obj - - -def lscan(writables, readables, start, end, steps, latency=0.0, plot=None, before_read=None, after_read=None): - """Line Scan: positioners change together, linearly from start to end positions. - - Args: - writables(list of Writable): Positioners set on each step. - readables(list of Readable): Sensors to be sampled on each step. - start(list of float): start positions of writables. - end(list of float): final positions of writables. - steps(int): number of scan steps. - latency(float, optional): sleep time in each step before readout, defaults to 0.0. - plot(str, optional): plotting context name. - before_read (function): callback on each step, before each readout. - after_read (function): callback on each step, after each readout. - - Returns: - ArrayList of ScanRecord objects. - - """ - latency_ms=int(latency*1000) - writables=toList(writables) - readables=toList(readables) - start=toList(start) - end=toList(end) - scan = LineScan(writables,readables, start, end , steps,latency_ms, controller) - scan.before_read=before_read - scan.after_read=after_read - scan.setPlotName(plot) - scan.start() - return scan.getResult() - -def vscan(writables, readables, vector, latency=0.0, plot=None, before_read=None, after_read=None): - """Vector Scan: positioners change following values provided in a vector. - - Args: - writables(list of Writable): Positioners set on each step. - readables(list of Readable): Sensors to be sampled on each step. - vector(list of list of float): table of positioner values. - latency(float, optional): sleep time in each step before readout, defaults to 0.0. - plot(str, optional): plotting context name. - before_read (function): callback on each step, before each readout. - after_read (function): callback on each step, after each readout. - - Returns: - ArrayList of ScanRecord objects. - - """ - latency_ms=int(latency*1000) - writables=toList(writables) - readables=toList(readables) - scan = VectorScan(writables,readables, vector, latency_ms, controller) - scan.before_read=before_read - scan.after_read=after_read - scan.setPlotName(plot) - scan.start() - return scan.getResult() - -def ascan(writables, readables, start, end, steps, latency=0.0, plot=None, before_read=None, after_read=None): - """Area Scan: multi-dimentional scan, each positioner is a dimention. - - Args: - writables(list of Writable): Positioners set on each step. - readables(list of Readable): Sensors to be sampled on each step. - start(list of float): start positions of writables. - end(list of float): final positions of writables. - steps(list of int): number of scan steps for each positioner. - latency(float, optional): sleep time in each step before readout, defaults to 0.0. - plot(str, optional): plotting context name. - before_read (function): callback on each step, before each readout. - after_read (function): callback on each step, after each readout. - - Returns: - ArrayList of ScanRecord objects. - - """ - latency_ms=int(latency*1000) - writables=toList(writables) - readables=toList(readables) - start=toList(start) - end=toList(end) - scan = AreaScan(writables,readables, start, end , steps,latency_ms, controller) - scan.before_read=before_read - scan.after_read=after_read - scan.setPlotName(plot) - scan.start() - return scan.getResult() - -def tscan(readables, points, interval, plot=None, before_read=None, after_read=None): - """Time Scan: sensors are sampled in fixed time intervals. - - Args: - readables(list of Readable): Sensors to be sampled on each step. - points(int): number of samples. - interval(float): time interval between readouts. - plot(str, optional): plotting context name. - before_read (function): callback on each step, before each readout. - after_read (function): callback on each step, after each readout. - - Returns: - ArrayList of ScanRecord objects. - - """ - latency_ms=int(interval*1000) - writables=[] - readables=toList(readables) - start=[0,] - end=[points,] - steps=points - scan = LineScan(writables,readables, start, end , steps,latency_ms, controller) - scan.before_read=before_read - scan.after_read=after_read - scan.setPlotName(plot) - scan.start() - return scan.getResult() - -def escan(name, plot=None): - """Epics Scan: execute an Epics Scan Record. - - Args: - name(str): Name of scan record. - plot(str, optional): plotting context name. - - Returns: - ArrayList of ScanRecord objects. - - """ - scan = EpicsScan(name, controller) - scan.setPlotName(plot) - scan.start() - return scan.getResult() - - - -class ListReader(Readable): - def __init__(self,list, plot): - self.counter=0 - self.list=list - def getName(self): - return None - def read(self): - if (self.counter>=len(self.list)): - return None; - ret = self.list[self.counter] - self.counter=self.counter+1 - return ret - - -def plot(data, plot=None): - data = toArray(data) - controller.plot(toArray(data),plot) - -def saveData(path, data): - data = toArray(data) - controller.dataManager.setData(path,data) - - -def loadData(path): - slice = controller.dataManager.getData(path) - return slice.sliceData - -def createData(path, type, unsigned=False, dimensions=None): - type = Class.forName(channel_types.get(type,type)) - controller.dataManager.createDataArray(path, type, unsigned, dimensions) - -def saveDataItem(path, data, index=None): - data = toArray(data) - if index is None: - controller.dataManager.appendItem(path, data) - else: - controller.dataManager.setItem(path, data, index) - -def setDataAttr(path, name, value, unsigned = False): - controller.dataManager.setAttribute(path,name, value, unsigned) - -def currentDataGroup(): - return controller.dataManager.getCurrentGroup() - - - -channel_types = { - 'b': "java.lang.Byte", - 'i': "java.lang.Short", - 'l': "java.lang.Integer", - 'd': "java.lang.Double", - 's': "java.lang.String", - - 'b,': "[B", - 'i,': "[S", - 'l,': "[I", - 'd,': "[D", - 's,': "[Ljava.lang.String;", -} - -array_types = { - int: "i", - long: "l", - float:"d", - str:Class.forName("java.lang.String"), -} - -def caget(name, type='d', size=None): - """Reads an Epics PV. - - Args: - name(str): PV name - type(str, optional): type of PV, defaults 'd'. - Scalar values: 'b', 'i', 'l', 'd', 's'. - Array: values: 'b,', 'i,', 'l,', 'd,', 's,'. - """ - if (size==None): - return Epics.get(name, Class.forName(channel_types.get(type,type))) - else: - return Epics.get(name, Class.forName(channel_types.get(type,type)),size) - -def adjustPutVal(value): - if isinstance(value,tuple): - value = list(value) - if isinstance(value,list): - array = PyArray(array_types.get(type(value[0]),'d')) - array.fromlist(value) - value=array - return value - -def caput(name, value): - """Writes to an Epics PV. - - Args: - name(str): PV name - value(scalar, string or array): new PV value. - """ - value=adjustPutVal(value) - return Epics.put(name, value) - -def caputq(name, value): - """Writes to an Epics PV and does not wait. - - Args: - name(str): PV name - value(scalar, string or array): new PV value. - """ - value=adjustPutVal(value) - return Epics.putq(name, value) - -def log(log): - """Writes log to data file. - - Args: - log(str): Log string - - """ - controller.getDataManager().addLog(str(log)) - -def startTask(script, interval): - interval_ms=int(interval*1000) - controller.getTaskManager().create(script,interval_ms) - controller.getTaskManager().start(script) - -def stopTask(script, interval): - controller.getTaskManager().remove(script) - -execfile(controller.setup.getScriptPath()+"/local.py") \ No newline at end of file