def _dim(time, t0): if len(time): t0 = _mds.Int64(t0) time = _mds.Int64Array(time) if t0 == 0: unit = 'ns' else: time = _mds.Float64(time - t0) * 1E-9 unit = 's' wind = _mds.Window(time[0], time[time.shape[0] - 1], t0) dim = _mds.Dimension(wind, time) dim.setUnits(unit) return dim else: return _mds.EmptyData()
#!/usr/bin/python3 import MDSplus import time import math import numpy as np currTime = 0. shot = 1 idx = 0 while (True): time.sleep(0.1) currTime = idx * 0.1 idx = idx + 1 currVal1 = math.sin(currTime * 0.1) print(currTime) MDSplus.Event.stream( shot, 'MEASURE', MDSplus.Int64Array(np.repeat(int(time.time() * 1000), 5)), MDSplus.Float32Array(np.repeat(currVal1, 5)))