Script execution

This commit is contained in:
2017-09-12 15:14:31 +02:00
parent 33e9a88c29
commit 166e98d97c

179
script/mytest/notes.py Normal file
View File

@@ -0,0 +1,179 @@
[1] bpm6a.timestamped
AttributeError: 'ch.psi.pshell.epics.ChannelDouble' object has no attribute 'timestamped'
[2] bpm6a.read()
-230.47692307692307
[3] v=bpm6a.read()
[4] type(v)\
class org.python.core.PyFloat
[5] bpm6a.getTimestamp()
1505210031703
[6] bpm6a.takeTimestamped()
-200.3230769230769
[7] v=bpm6a.takeTimestamped()
[8] cache=bpm6a.takeTimestamped()
[9] cache.value
-127.0
[10] cache.timestamp
1505210115708
[11] print "Value:" + str(cache.value) + " - Time:" + time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(cache.timestamp))
Value:-127.0 - Time:49668-03-17 09:01:48
[12] print "Value:" + str(cache.value) + " - Time:" + time.strftime('%H:%M:%S', time.gmtime(cache.timestamp))
Value:-127.0 - Time:09:01:48
[13] print "Value:" + str(cache.value) + " - Time:" + time.strftime('%H:%M:%S.%m', time.gmtime(cache.timestamp))
Value:-127.0 - Time:09:01:48.03
[14] print "Value:" + str(cache.value) + " - Time:" + time.strftime('%H:%M:%S.%m', time.gmtime(cache.timestamp))
Value:-127.0 - Time:09:01:48.03
[15] print "Value:" + str(cache.value) + " - Time:" + time.strftime('%H:%M:%S.%m', time.gmtime(cache.timestamp))
Value:-127.0 - Time:09:01:48.03
[16] print "Value:" + str(cache.value) + " - Time:" + time.strftime('%H:%M:%S.%m', time.gmtime(cache.timestamp))
Value:-127.0 - Time:09:01:48.03
[17] print "Value:" + str(cache.value) + " - Time:" + time.strftime('%H:%M:%S.%m', time.gmtime(cache.timestamp))
Value:-127.0 - Time:09:01:48.03
[18] print "Value:" + str(cache.value) + " - Time:" + time.strftime('%H:%M:%S.%f', time.gmtime(cache.timestamp))
Value:-127.0 - Time:09:01:48.%f
[19] aux = time.gmtime(cache.timestamp)
[20] aux
time.struct_time(tm_year=49668, tm_mon=3, tm_mday=17, tm_hour=9, tm_min=1, tm_sec=48, tm_wday=5, tm_yday=77, tm_isdst=0)
[21] dt = datetime.datetime.fromtimestamp(cache.timestamp)
NameError: name 'datetime' is not defined
[22] import datetime
[23] dt = datetime.datetime.fromtimestamp(cache.timestamp)
ValueError: ('year must be in 1..9999', 49668)
[24] dt = datetime.datetime.fromtimestamp(cache.timestamp/1000.0)
[25] dt
2017-09-12 13:55:15.708
[26] dt = datetime.datetime.fromtimestamp(cache.timestamp/1000.0)
[27] dt = datetime.datetime.fromtimestamp(cache.timestamp/1000.0)
[28] dt = datetime.datetime.fromtimestamp(cache.timestamp/1000.0)
[29] dt = datetime.datetime.fromtimestamp(cache.timestamp/1000.0)
[30] datetime.datetime.fromtimestamp(cache.timestamp/1000.0)
2017-09-12 13:55:15.708
[31] print "Value:" + str(cache.value) + " - Time:" + datetime.datetime.fromtimestamp(cache.timestamp/1000.0)
TypeError: cannot concatenate 'str' and 'datetime' objects
[32] print "Value:" + str(cache.value) + " - Time:" + str(datetime.datetime.fromtimestamp(cache.timestamp/1000.0))
Value:-127.0 - Time:2017-09-12 11:55:15.708000
[33] print "Value:" + str(cache.value) + " - Time:" + str(datetime.datetime.fromtimestamp(cache.timestamp/1000.0))
Value:-127.0 - Time:2017-09-12 11:55:15.708000
[34] for i in range (100):
[35]... bpm6a.waitCacheChange(5000)
[36]... cache = bpm6a.takeTimestamped()
[37]... print "Value:" + str(cache.value) + " - Time:" + str(datetime.datetime.fromtimestamp(cache.timestamp/1000.0))
[38]...
Value:-120.415384615 - Time:2017-09-12 12:12:53.701000
Cannot execute command: Invalid state: Busy
Value:-137.861538462 - Time:2017-09-12 12:12:55.700000
Value:-229.753846154 - Time:2017-09-12 12:12:57.700000
Value:-228.430769231 - Time:2017-09-12 12:12:59.700000
Value:-270.138461538 - Time:2017-09-12 12:13:01.700000
Value:-261.923076923 - Time:2017-09-12 12:13:03.700000
Value:-169.676923077 - Time:2017-09-12 12:13:05.700000
Value:-117.538461538 - Time:2017-09-12 12:13:07.700000
Value:-122.723076923 - Time:2017-09-12 12:13:09.699000
Value:-100.276923077 - Time:2017-09-12 12:13:11.699000
Value:-102.953846154 - Time:2017-09-12 12:13:13.699000
Value:-148.938461538 - Time:2017-09-12 12:13:15.699000
Value:-230.076923077 - Time:2017-09-12 12:13:17.699000
Value:-256.584615385 - Time:2017-09-12 12:13:19.699000
Value:-216.338461538 - Time:2017-09-12 12:13:21.699000
Value:-246.861538462 - Time:2017-09-12 12:13:23.699000
Value:-230.846153846 - Time:2017-09-12 12:13:25.699000
Value:-187.430769231 - Time:2017-09-12 12:13:27.699000
Value:-157.169230769 - Time:2017-09-12 12:13:29.699000
Value:-78.3692307692 - Time:2017-09-12 12:13:31.699000
Value:-108.307692308 - Time:2017-09-12 12:13:33.699000
Value:-108.923076923 - Time:2017-09-12 12:13:35.699000
Value:-113.676923077 - Time:2017-09-12 12:13:37.699000
Value:-110.630769231 - Time:2017-09-12 12:13:39.698000
Value:-187.230769231 - Time:2017-09-12 12:13:41.698000
Value:-237.2 - Time:2017-09-12 12:13:43.698000
Value:-231.907692308 - Time:2017-09-12 12:13:45.698000
Value:-199.723076923 - Time:2017-09-12 12:13:47.697000
Value:-259.246153846 - Time:2017-09-12 12:13:49.698000
Value:-225.123076923 - Time:2017-09-12 12:13:51.697000
Value:-141.4 - Time:2017-09-12 12:13:53.698000
Value:-78.4769230769 - Time:2017-09-12 12:13:55.697000
Value:-113.384615385 - Time:2017-09-12 12:13:57.697000
Value:-103.107692308 - Time:2017-09-12 12:13:59.697000
Value:-112.907692308 - Time:2017-09-12 12:14:01.698000
Value:-204.538461538 - Time:2017-09-12 12:14:03.698000
Value:-253.892307692 - Time:2017-09-12 12:14:05.697000
Value:-227.661538462 - Time:2017-09-12 12:14:07.697000
Value:-221.569230769 - Time:2017-09-12 12:14:09.697000
Value:-139.846153846 - Time:2017-09-12 12:14:11.697000
Value:-92.1230769231 - Time:2017-09-12 12:14:13.697000
Value:-137.2 - Time:2017-09-12 12:14:15.697000
Value:-103.107692308 - Time:2017-09-12 12:14:17.697000
Value:-173.938461538 - Time:2017-09-12 12:14:19.697000
Value:-222.415384615 - Time:2017-09-12 12:14:21.697000
java.lang.InterruptedException: java.lang.InterruptedException
[38] Debug: Unknown
NameError: name 'bpm61' is not defined in Unknown at line number 3
[39] Debug: Unknown
MonitorScan Unknown-1: positioners=[], sensors=[bpm6a], records=5/5
[40] Debug: Unknown
MonitorScan Unknown-2: positioners=[], sensors=[bpm6b], records=5/5
[41] Debug: Unknown
NameError: name 'b5' is not defined in Unknown at line number 6
[42] bpm6a.waitCacheChange(5000)
true
[43] cache = bpm6a.takeTimestamped()
SyntaxError: mismatched input ' ' expecting EOF
[44] cache = bpm6a.takeTimestamped()
[45] print "Value:" + str(cache.value) + " - Time:" + str(datetime.datetime.fromtimestamp(cache.timestamp/1000.0))
Value:-238.492307692 - Time:2017-09-12 12:18:43.705000
[46] print cache.timestamp
1505211523705
[47] print cache.timestamp
1505211523705
[48] print cache.timestamp
1505211523705
[49] cache = bpm6a.takeTimestamped()
[50] print bpm6a.takeTimestamped().timestamp
1505211557703
[51] print bpm6a.takeTimestamped().timestamp
1505211557703
[52] print bpm6a.takeTimestamped().timestamp
1505211557703
[53] print bpm6a.takeTimestamped().timestamp
1505211559704
[54] print bpm6a.takeTimestamped().timestamp
1505211559704
[55] print bpm6a.takeTimestamped().timestamp
1505211579702
[56] Debug: Unknown
[57] print bpm6a.takeTimestamped().timestamp
1505211621701
[58] print bpm6a.takeTimestamped().timestamp
1505211627701
[59] dir(bpm6a)
['CacheReadable', 'CacheReadableArray', 'CacheReadableMatrix', 'CacheReadableNumber', 'CacheableArray', 'CacheableMatrix', 'CacheableNumber', 'DefaultReadonlyRegisterArray', 'DeviceException', 'DeviceInvalidParameterException', 'DeviceStateException', 'DeviceTimeoutException', 'DeviceValueVetoException', 'EpicsRegisterConfig', 'InvalidValueException', 'PROPERTY_CONFIG_PATH', 'ReadAccessException', 'ReadableArray', 'ReadableCalibratedArray', 'ReadableCalibratedMatrix', 'ReadableMatrix', 'ReadableNumber', 'ReadonlyRegisterArray', 'ReadonlyRegisterMatrix', 'ReadonlyRegisterNumber', 'RegisterArray', 'RegisterNumber', 'StateException', 'StopNotConfiguredException', 'TimeoutException', 'WritableArray', 'WritableNumber', 'WriteAccessException', '__class__', '__copy__', '__deepcopy__', '__delattr__', '__doc__', '__ensure_finalizer__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__subclasshook__', '__unicode__', 'accessType', 'addListener', 'age', 'assertInitialized', 'assertNotInitialized', 'assertState', 'assertStateNot', 'assertValidValue', 'blockingWrite', 'cache', 'channelName', 'children', 'childrenValues', 'class', 'close', 'closed', 'components', 'config', 'configFileName', 'equals', 'forcedRead', 'getAccessType', 'getAge', 'getCache', 'getChannelName', 'getChild', 'getChildren', 'getChildrenValues', 'getClass', 'getComponent', 'getComponents', 'getConfig', 'getConfigFileName', 'getConfigPath', 'getListeners', 'getMaximumSize', 'getName', 'getParent', 'getPolling', 'getPrecision', 'getShortClassName', 'getState', 'getTimestamp', 'getTriggers', 'getValue', 'hashCode', 'initialize', 'initialized', 'isBlockingWrite', 'isChild', 'isClosed', 'isForcedRead', 'isInitialized', 'isMonitored', 'isPolled', 'isPollingBackground', 'isReady', 'isSimulated', 'isTrustedMonitor', 'isTrustedWrite', 'isValidValue', 'listeners', 'maximumSize', 'monitored', 'name', 'notify', 'notifyAll', 'parent', 'polled', 'polling', 'pollingBackground', 'precision', 'read', 'readAsync', 'ready', 'removeAllListeners', 'removeListener', 'request', 'resetCache', 'setAccessType', 'setBlockingWrite', 'setForcedRead', 'setMonitored', 'setPolling', 'setPrecision', 'setSimulated', 'setTriggers', 'setTrustedMonitor', 'setTrustedWrite', 'simulated', 'state', 'take', 'takeAsNumber', 'takeTimestamped', 'timestamp', 'toString', 'triggers', 'trustedMonitor', 'trustedWrite', 'update', 'updateAsync', 'value', 'wait', 'waitCacheChange', 'waitReady', 'waitState', 'waitStateNot', 'waitValue', 'waitValueChange', 'waitValueInRange', 'waitValueNot', 'write', 'writeAsync']
[60] help(get_exec_pars)
get_exec_pars()
Returns script execution parameters.
Returns:
ExecutionContext object. Fields:
name (str): execution name - {name} tag.
type (str): execution type - {type} tag.
path (str): output data root.
open (bool): true if the output data root has been opened.
layout (str): data output layout. If None then using the configuration.
persist (bool): auto save scan data option.
flush (bool): flush file on each record.
index (int): current scan index.
group (str): data group currently used for scan data storage.
if no ongoing scan return "/" if within a script, or else None if a console command.
scanPath (str): dataset or group corresponding to current scan.
scan (Scan): reference to current scan, if any
source (CommandSource): return the source of the script or command.
args (obj): return the arguments for the script.
background (bool): return False if executing in main interpreter thread .
aborted (bool): True if execution has been aborted
[61] Debug: Unknown
[62] Debug: TestTimestampTable.py
TypeError: org.python.proxies.__builtin__$MonitorScan$22(): 3rd arg can't be coerced to int in TestTimestampTable.py at line number 12
[63] Debug: TestTimestampTable.py
[64] Run: TestTimestampTable.py
[65] Run: TestTimestampTable.py