SCRIPTS TRANSP basicΒΆ

# -*-Python-*-
# Created by grierson at 26 Sep 2017  18:40

"""
This script is a basic access to TRANSP data in MDSplus

"""

# Set the TRANSP shot 163303Z01
shot = 1633032601

# Get the MDSplus tree
mds = OMFITmds(server='DIII-D', shot=shot, treename='transp')

# Get a time history variable
tr_pcur = OMFITtranspData(mds, 'PCUR')
# Extract the time axis and the data
pcur_time = tr_pcur['DIM_OF'][0]
pcur_data = tr_pcur['DATA']

# Get a profile variable
tr_ne = OMFITtranspData(mds, 'NE')
# Extract the radius axis, time axis and the data
ne_x = tr_ne['DIM_OF'][0][0, :]
ne_time = tr_ne['DIM_OF'][1][:, 0]
ne_data = tr_ne['DATA']

# Plot using the default plotting methods
figure()
tr_pcur.plot()

figure()
tr_ne.plot()

# Now use the numbers to plot profiles in time
fig, ax = plt.subplots()
plotc(ne_x, ne_data.T, ax=ax)
cmap = None
nm = matplotlib.colors.Normalize(ne_time.min(), ne_time.max())
sm = matplotlib.cm.ScalarMappable(cmap=cmap, norm=nm)
sm.set_array(ne_time)
colors = sm.cmap(sm.norm(ne_time))
cb = fig.colorbar(sm, ax=ax, use_gridspec=True)
cb.set_label('Time (s)')

# Now use the numbers to plot history at multiple radii
fig, ax = plt.subplots()
plotc(ne_time, ne_data, ax=ax)
cmap = None
nm = matplotlib.colors.Normalize(ne_x.min(), ne_x.max())
sm = matplotlib.cm.ScalarMappable(cmap=cmap, norm=nm)
sm.set_array(ne_x)
colors = sm.cmap(sm.norm(ne_x))
cb = fig.colorbar(sm, ax=ax, use_gridspec=True)
cb.set_label('X')