Commit 4c8e66db authored by Maxime Rey's avatar Maxime Rey
Browse files

Bugfix: correct normalisation for the PDFs in 'plot_phase_diag'.

parent c5af5f3a
......@@ -385,23 +385,23 @@ def plot_phase_diag(genpath, folders, timesteps, var_str='H', cgm_gas=False, no_
phase_diag_gauss = <= 0, phase_diag_gauss)
plt.contour(phase_diag_gauss.T,levels=levels,origin='lower',norm=LogNorm(vmin=vmin,vmax=vmax),colors='k', extent=extent)
if plot_PDF:
if plot_PDF: # Adds T and nH PDFs on the sides of the plot.
perc_min, perc_max = 15.9, 84.1
nrm = 2e8 # Handpicked normalisation factor to get a nicer plot. Otherwise density has to be used...
# Adds T and nH PDFs on the sides of the plot.
if plot_PDF!='fast':
PDF_T = np.median(PDF_Tall, axis=0) / nrm
PDF_nH = np.median(PDF_nHall, axis=0) / nrm
PDF_T /= nrm
PDF_nH /= nrm
PDF_T = np.median(PDF_Tall , axis=0)
PDF_nH = np.median(PDF_nHall, axis=0)
if folder==folders[0]: # Normalise the first folder max PDF to 1 for nicer plots...
nrm1 = PDF_T.max()
nrm2 = PDF_nH.max()
PDF_T /= nrm1
PDF_nH /= nrm2
shift_T , xaxis_T = -min(PDF_T )+np.log10(xlims[0]), ( Tbin_edges[:-1]+ Tbin_edges[1:])*0.5
shift_nH, xaxis_nH = -min(PDF_nH)+np.log10(ylims[0]), (nHbin_edges[:-1]+nHbin_edges[1:])*0.5
ax.plot(PDF_T+shift_T, xaxis_T, '-k')
ax.plot(xaxis_nH, PDF_nH+shift_nH, '-k')
if plot_PDF!='fast':
ax.fill_betweenx(xaxis_T,np.percentile(PDF_Tall,perc_min, axis=0)/nrm+shift_T, np.percentile(PDF_Tall,perc_max, axis=0)/nrm+shift_T, color='k', alpha=0.25)
ax.fill_between(xaxis_nH,np.percentile(PDF_nHall,perc_min, axis=0)/nrm+shift_nH, np.percentile(PDF_nHall,perc_max, axis=0)/nrm+shift_nH, color='k', alpha=0.25)
ax.fill_betweenx(xaxis_T,np.percentile(PDF_Tall ,perc_min, axis=0)/nrm1+shift_T , np.percentile(PDF_Tall ,perc_max, axis=0)/nrm1+shift_T , color='k', alpha=0.25)
ax.fill_between(xaxis_nH,np.percentile(PDF_nHall,perc_min, axis=0)/nrm2+shift_nH, np.percentile(PDF_nHall,perc_max, axis=0)/nrm2+shift_nH, color='k', alpha=0.25)
# if (var_str=='HI') or (var_str=='MgII') or (var_str=='CIV') or (var_str=='OVI'):
# Adds two temperature split chosen for ouflows.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment