Skip to content

Commit 621be49

Browse files
committed
Scripts/summaryPlots: fine tuning output plots, params, limits, etc.
1 parent 2626cc2 commit 621be49

1 file changed

Lines changed: 34 additions & 12 deletions

File tree

Scripts/summaryPlots.py

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ def get_energy_index(self, targ_en):
150150

151151
def add_flux_plot(self, species='Hydrogen', energy=10, target=None,
152152
maxz=1.0, minz=1e-15, add_cbar=True, loc=111,
153-
add_tstamp=True, labelsize=15, title='auto'):
153+
add_tstamp=True, labelsize=15, title='auto',
154+
drop_ghost=False):
154155
'''
155156
'''
156157
from matplotlib.colors import LogNorm
@@ -172,8 +173,12 @@ def add_flux_plot(self, species='Hydrogen', energy=10, target=None,
172173
# Set up grid centered on gridpoints.
173174
T_deg = 15*tb.bin_center_to_edges(self['MLTGrid'][:-1])
174175
T_rad = np.deg2rad(T_deg) - np.pi/2 # offset is for compat. with adjust_dialplot
175-
R = tb.bin_center_to_edges(self['RadialGrid'])
176-
p = self[var][alp_idx, en_idx, :-1, :]
176+
if not drop_ghost:
177+
R = tb.bin_center_to_edges(self['RadialGrid'])
178+
p = self[var][alp_idx, en_idx, :-1, :]
179+
else:
180+
R = tb.bin_center_to_edges(self['RadialGrid'][1:])
181+
p = self[var][alp_idx, en_idx, :-1, 1:]
177182
ax.grid(False) # as of mpl 3.5 grid must be turned off before calling pcolormesh
178183
pcol = ax.pcolormesh(T_rad, R, p.T, norm=LogNorm(vmin=minz, vmax=maxz),
179184
cmap=get_cmap('inferno'))
@@ -263,16 +268,28 @@ def plot_pressure(options):
263268
opt_ten = spt.Ticktock(options.endTime).UTC[0]
264269
if (ftime <= opt_ten) and (ftime >= opt_tst):
265270
pressf = ram.PressureFile(pcfn)
271+
# get all total pressures for plot
266272
plotlist = [key for key in pressf if key.startswith('tot')]
273+
# hold back Helium for summaries
274+
plotlist = [key for key in plotlist if not key.endswith('He')]
267275
# Convenience plotting routines in spacepy currently assume a log-transform
268276
# but this is not useful for anisotropy. When control for that is added to
269277
# spacepy we can do this more easily...
270-
# plotlist = [key for key in pressf if (key.startswith('tot') or key.startswith('ani'))]
278+
# plotlist = [key for key in pressf if (key.startswith('tot')
279+
# or key.startswith('ani'))]
271280
for pl in plotlist:
281+
if pl == 'tote':
282+
# electron pressure is ~10% so shift range 1 order lower
283+
minz = 1e-1
284+
maxz = 1e2
285+
else:
286+
minz = 1
287+
maxz = 1e3
272288
# TODO: maybe make combined plots, look at axis limits, etc.
273289
title = '{}'.format(pressf[pl].attrs['label'])
274290
tstamp = '{}'.format(ftime.isoformat()[:19])
275-
fig, ax, cm, _ = pressf.add_pcol_press(var=pl, add_cbar=True, title=title)
291+
fig, ax, cm, _ = pressf.add_pcol_press(var=pl, add_cbar=True, title=title,
292+
minz=minz, maxz=maxz)
276293
outfn = os.path.join(options.outdir, fmain + f'_{pl}.png')
277294
plt.figtext(0.05, 0.95, tstamp, fontsize=11)
278295
plt.savefig(outfn, dpi=200)
@@ -292,17 +309,22 @@ def plot_flux(options):
292309
opt_ten = spt.Ticktock(options.endTime).UTC[0]
293310
if (ftime <= opt_ten) and (ftime >= opt_tst):
294311
fluxf = Flux2DFile(flfn)
295-
plotlist = ['Hydrogen', 'OxygenP1']
312+
plotlist = ['Hydrogen', 'OxygenP1', 'Electron']
296313
splims = {'Hydrogen': [5e2, 1e7],
297314
'HeliumP1': [5e1, 1e7],
298-
'OxygenP1': [5e0, 5e6]}
299-
enlist = [0.1, 1] # plot energies in keV
315+
'OxygenP1': [5e0, 5e6],
316+
'Electron': [1e2, 1e7]}
317+
enlist = [1, 10, 30] # plot energies in keV
300318
for pl, enval in it.product(plotlist, enlist):
301319
# TODO: maybe make combined plots, look at axis limits, etc.
302-
fig, ax, cm, _ = fluxf.add_flux_plot(species=pl, add_cbar=True,
303-
energy=enval,
304-
minz=splims[pl][0],
305-
maxz=splims[pl][1])
320+
fpdict = {'species': pl, 'add_cbar': True, 'energy': enval,
321+
'minz': splims[pl][0], 'maxz': splims[pl][1]}
322+
if pl == 'Electron':
323+
fpdict['drop_ghost'] = True
324+
if enval < 5:
325+
fpdict['minz'] = 1e3
326+
fpdict['maxz'] = 1e8
327+
fig, ax, cm, _ = fluxf.add_flux_plot(**fpdict)
306328
outfn = os.path.join(options.outdir, fmain + f'_{pl}_E{enval:0.2f}.png')
307329
plt.savefig(outfn, dpi=200)
308330
plt.close()

0 commit comments

Comments
 (0)