def get_data(signal, shot, tree): cn = CN('mds.ipp.ac.cn') cn.openTree(tree, shot) x = cn.get('\\' + signal).copy() t = cn.get('dim_of(' + '\\' + signal + ')').copy() cn.closeAllTrees() t = np.array(t, dtype=np.float64) x = np.array(x, dtype=np.float64) return t, x
def read_EAST_TS(shot): from MDSplus import Connection as CN conn = CN('202.127.204.12') conn.openTree('analysis', shot) R = conn.get('\\' + 'R_coreTS ').copy() Z = conn.get('\\' + 'Z_coreTS ').copy() time = conn.get('dim_of(' + '\\' + 'Te_maxTS' + ')').copy() Te = conn.get('\\' + 'Te_coreTS ').copy() Ne = conn.get('\\' + 'ne_coreTS').copy() conn.closeAllTrees() return R, Z, time, Te, Ne
def data(signal, shot, tree): import sys sys.path.append("D:\\Program Files\\MDSplus\\python") from MDSplus import Connection as CN cn = CN('mds.ipp.ac.cn') cn.openTree(tree, shot) x = cn.get('\\' + signal).copy() t = cn.get('dim_of(' + '\\' + signal + ')').copy() cn.closeAllTrees() t = np.array(t, dtype=np.float64) x = np.array(x, dtype=np.float64) return t, x
def fast_read(sig, shot): from MDSplus import Connection as CN conn = CN('mds.ipp.ac.cn') conn.openTree('east', shot) x = conn.get('\\' + sig).copy() t = conn.get('dim_of(' + '\\' + sig + ')').copy() conn.closeAllTrees() ind = np.argmin(np.abs(t - 0)) t = t[ind:] x = x[ind:] t = np.array(t, dtype=np.float64) x = np.array(x, dtype=np.float64) return t, x
def get_connection(shot, tree='mst'): """Get an MDSplus connection object connected to the appropriate server and having the given tree and shot opened. """ svr = get_server_for_shot(shot) conn, tree_, shot_ = _get_svr_cached(svr) if conn is None: conn = Connection(svr) if tree != tree_ or shot != shot_: try: # This throws an exception if there are no open trees. conn.closeAllTrees() except: pass conn.openTree(tree, shot) _update_svr_cache(svr, conn, tree, shot) return conn