# from_emacs was called block_me from_emacs = not hasattr(sys, 'ps1') if from_emacs: print('from emacs') os.environ['PYFUSION_VERBOSE'] = '-1' # keep clutter down import pyfusion pyfusion.VERBOSE = -1 # why doesn't the environ above work? da = DA(filename, load=1, verbose=pyfusion.VERBOSE) if 'info' in da: pprint.pprint(da['info']) if hasattr(da, 'info'): da.info() sys.stdout.flush( ) # works, but not effective in emacs, at least when ! is used. if len(sys.argv) > 2: key = sys.argv[2] elif 'ne18' in da: typ = 'LP' key = 'ne18' elif 'phases' in da: typ = 'FS' key = 'phases' else: raise LookupError('Keys available are: ' + str(list(da))) da.plot(key) plt.show(block=block_me)
from pyfusion.data.DA_datamining import DA da9=DA('LP20160309_42_L57_errest_cov_lpf=9.npz') da99=DA('LP20160309_42_L57_errest_cov_lpf=99.npz') axs=da9.plot('Te',sharey='all') for i in range(len(da99['info']['channels'])): axs[i].plot(da99['t_mid'],da99.masked['Te'][:,i]) ylim(0,60) show()
plt.plot(ECEdata.timebase + dtece, ECEdata.signal/1000,label='ECE_13',color='red', lw=0.3) plt.plot(echdata.timebase - tech, echdata.signal/1000,label='ECH (MW)',color='magenta', lw=0.3) plt.legend() plt.title(da572.name) plt.xlim(-0.01,1) plt.show(0) plt.figure() da57=DA(base + '57.npz') da53=DA(base + '53.npz') ch3=2 plt.plot(dt+da53['t_mid'],da53['Te'][:,ch3], label='Te s'+da53['info']['channels'][ch3][3:]) ch4=1 plt.plot(dt+da53['t_mid'],da53['Te'][:,ch4], label='Te s'+da53['info']['channels'][ch4][3:]) #plt.plot(np.array(time_g), 10*(np.array(gas_g)-3),label='gas valve') plt.legend() plt.title(da53.name) plt.xlim(-0.01,1) plt.show(0) """ gas=np.interp(da532['t_mid'], 0.92+np.array(time_g), gas_g) da532.plot('ne18',select=[0,1,2,3,4,1],sharex='none') plt.ylim(0,3) plt.plot(da532['t_mid'], gas-3) """
from pyfusion.data.DA_datamining import DA from matplotlib import pyplot as plt da9 = DA('LP20160309_42_L57_errest_cov_lpf=9.npz') da99 = DA('LP20160309_42_L57_errest_cov_lpf=99.npz') axs = da9.plot('Te', sharey='all') for i in range(len(da99['info']['channels'])): axs[i].plot(da99['t_mid'], da99.masked['Te'][:, i]) plt.ylim(0, 60) plt.show(0)
neaxis.set_xlim(-.01, 0.4) neaxis.set_ylim(0, neaxis.get_ylim()[1]) plt.xlabel('time after ECH start') plt.show(0) plt.figure(0) da57 = DA('LP/LP20160309_42_L57_2k2.npz') da53 = DA('LP/LP20160309_42_L53_2k2.npz') ch3 = 2 plt.plot(dt + da53['t_mid'], da53.masked['Te'][:, ch3], label='Te s' + da53['info']['channels'][ch3][2:]) ch4 = 1 plt.plot(dt + da53['t_mid'], da53.masked['Te'][:, ch4], label='Te s' + da53['info']['channels'][ch4][2:]) plt.plot(np.array(time_g), 10 * (np.array(gas_g) - 3), label='N2 valve') plt.legend(loc='upper left') plt.title(da53.name) plt.xlim(0, 0.4) plt.xlabel('time after ECH start') plt.show(0) """ """ """ gas=np.interp(da532['t_mid'], 0.92+np.array(time_g), gas_g) da532.plot('ne18',select=[0,1,2,3,4,1],sharex='none') plt.ylim(0,3) plt.plot(da532['t_mid'], gas-3) """
#!/usr/bin/env python # this won't work from ~/bin unless we include pyfusion in PYTHONPATH #import os #print(os.path.dirname(__file__)) import matplotlib.pyplot as plt import sys sys.path.append('/home/bdb112/pyfusion/working/pyfusion/') from pyfusion.data.DA_datamining import DA if len(sys.argv) < 2: print('plot_npz_data "filename" key') else: filename = sys.argv[1] if len(sys.argv) > 2: key = sys.argv[2] else: key = 'ne18' da = DA(filename,load=1) da.plot(key) plt.show(1)