default color map
This commit is contained in:
parent
21fb68d81b
commit
26c0fc4aae
@ -94,7 +94,7 @@ def plot_chi2(ax, s, contrast, freqs, chi2, fcutoff, vmax):
|
|||||||
if vmax is None:
|
if vmax is None:
|
||||||
vmax = np.quantile(1e-3*chi2, 0.99)
|
vmax = np.quantile(1e-3*chi2, 0.99)
|
||||||
pc = ax.pcolormesh(freqs, freqs, 1e-3*chi2, vmin=0, vmax=vmax,
|
pc = ax.pcolormesh(freqs, freqs, 1e-3*chi2, vmin=0, vmax=vmax,
|
||||||
cmap='viridis', rasterized=True, zorder=10)
|
rasterized=True, zorder=10)
|
||||||
ax.set_xlim(0, fcutoff)
|
ax.set_xlim(0, fcutoff)
|
||||||
ax.set_ylim(0, fcutoff)
|
ax.set_ylim(0, fcutoff)
|
||||||
df = 100 if fcutoff == 300 else 50
|
df = 100 if fcutoff == 300 else 50
|
||||||
@ -220,3 +220,4 @@ if __name__ == '__main__':
|
|||||||
fig.tag(axs, xoffs=-3, yoffs=2)
|
fig.tag(axs, xoffs=-3, yoffs=2)
|
||||||
|
|
||||||
fig.savefig()
|
fig.savefig()
|
||||||
|
print()
|
||||||
|
@ -274,3 +274,4 @@ if __name__ == '__main__':
|
|||||||
fig.common_yticks(axs[2, :])
|
fig.common_yticks(axs[2, :])
|
||||||
fig.tag(xoffs=-3.5, yoffs=2)
|
fig.tag(xoffs=-3.5, yoffs=2)
|
||||||
fig.savefig()
|
fig.savefig()
|
||||||
|
print()
|
||||||
|
73
lifsuscept.py
Normal file
73
lifsuscept.py
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
from matplotlib import rc
|
||||||
|
|
||||||
|
from threefish.defaults import default_figsize, default_settings
|
||||||
|
from threefish.load import save_visualization
|
||||||
|
from threefish.plot.plotstyle import plot_style
|
||||||
|
from threefish.plot.tags import tag2
|
||||||
|
from threefish.RAM.calc_analytics import calc_nonlin_analytic_values
|
||||||
|
from threefish.RAM.reformat_matrix import convert_csv_str_to_float
|
||||||
|
|
||||||
|
rc('text', usetex=True)
|
||||||
|
|
||||||
|
|
||||||
|
def plot_chi2():
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
default_settings() # ts=13, ls=13, fs=13, lw = 0.7
|
||||||
|
plot_style()
|
||||||
|
default_figsize(column=2, length=2.5)
|
||||||
|
fig, ax = plt.subplots(1, 2)
|
||||||
|
plt.subplots_adjust(bottom=0.2, wspace=0.35, left=0.1, right=0.92)
|
||||||
|
|
||||||
|
###################################################
|
||||||
|
transfer_values, suscept_values = calc_nonlin_analytic_values()
|
||||||
|
|
||||||
|
###################################################
|
||||||
|
# plot transfer function, panel A
|
||||||
|
transfer_values = transfer_values.astype(complex)
|
||||||
|
ax[0].plot(transfer_values.index, np.abs(transfer_values['transfer']),
|
||||||
|
color='black')
|
||||||
|
ax[0].set_xlabel(r'$f$')
|
||||||
|
ax[0].set_ylabel(r'$|\chi_{1}(f)|$')
|
||||||
|
ax[0].set_xlim(0, transfer_values.index[-1])
|
||||||
|
ylim = ax[0].get_ylim()
|
||||||
|
ax[0].set_ylim(0, ylim[-1])
|
||||||
|
|
||||||
|
###################################################
|
||||||
|
# plot matrix, panel B
|
||||||
|
suscept_values.columns = suscept_values.index
|
||||||
|
new_keys, stack_plot = convert_csv_str_to_float(suscept_values)
|
||||||
|
prss = np.abs(stack_plot)
|
||||||
|
vmax = np.quantile(prss, 0.994)
|
||||||
|
ten = 10**np.floor(np.log10(vmax))
|
||||||
|
for fac, delta in zip([1, 2, 3, 4, 6, 8, 10],
|
||||||
|
[0.5, 1, 1, 2, 3, 4, 5]):
|
||||||
|
if fac*ten >= vmax:
|
||||||
|
vmax = fac*ten
|
||||||
|
ten *= delta
|
||||||
|
break
|
||||||
|
pc = ax[1].pcolormesh(new_keys, new_keys, prss, rasterized=True,
|
||||||
|
cmap='viridis', vmin=0, vmax=vmax)
|
||||||
|
ax[1].set_aspect('equal')
|
||||||
|
cax = ax[1].inset_axes([1.04, 0, 0.05, 1])
|
||||||
|
cax.set_spines_outward('lrbt', 0)
|
||||||
|
fig.colorbar(pc, cax=cax, label=r'$|\chi_2(f_1, f_2)|$')
|
||||||
|
cax.set_yticks_delta(50)
|
||||||
|
ax[1].set_xlabel(r'$f_{1}$')
|
||||||
|
ax[1].set_ylabel(r'$f_{2}$')
|
||||||
|
ax[1].set_xlim(0, 1)
|
||||||
|
ax[1].set_ylim(0, 1)
|
||||||
|
ax[1].set_xticks_delta(0.2)
|
||||||
|
ax[1].set_xticks_delta(0.2)
|
||||||
|
tag2(axes=ax, xoffs=[-0.5, -5.5], yoffs=1.7) # ax_ams[3],
|
||||||
|
save_visualization()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
plot_chi2()
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ def plot_chi2(ax, s, data_file):
|
|||||||
ten *= delta
|
ten *= delta
|
||||||
break
|
break
|
||||||
pc = ax.pcolormesh(freqs, freqs, prss, vmin=0, vmax=vmax,
|
pc = ax.pcolormesh(freqs, freqs, prss, vmin=0, vmax=vmax,
|
||||||
cmap='viridis', rasterized=True)
|
rasterized=True)
|
||||||
if 'noise_frac' in data:
|
if 'noise_frac' in data:
|
||||||
ax.set_title('$c$=0\\,\\%', fontsize='medium')
|
ax.set_title('$c$=0\\,\\%', fontsize='medium')
|
||||||
else:
|
else:
|
||||||
@ -182,3 +182,4 @@ if __name__ == '__main__':
|
|||||||
fig.common_yticks(axs[5, :])
|
fig.common_yticks(axs[5, :])
|
||||||
fig.tag(axs, xoffs=-4.5, yoffs=1.8)
|
fig.tag(axs, xoffs=-4.5, yoffs=1.8)
|
||||||
fig.savefig()
|
fig.savefig()
|
||||||
|
print()
|
||||||
|
@ -47,7 +47,7 @@ def plot_chi2(ax, s, data_file):
|
|||||||
ten *= delta
|
ten *= delta
|
||||||
break
|
break
|
||||||
pc = ax.pcolormesh(freqs, freqs, prss, vmin=0, vmax=vmax,
|
pc = ax.pcolormesh(freqs, freqs, prss, vmin=0, vmax=vmax,
|
||||||
cmap='viridis', rasterized=True)
|
rasterized=True)
|
||||||
ns = f'$N={n}$' if n <= 100 else f'$N=10^{np.log10(n):.0f}$'
|
ns = f'$N={n}$' if n <= 100 else f'$N=10^{np.log10(n):.0f}$'
|
||||||
if 'noise_frac' in data:
|
if 'noise_frac' in data:
|
||||||
ax.set_title(f'$c$=0\\,\\%, {ns}', fontsize='medium')
|
ax.set_title(f'$c$=0\\,\\%, {ns}', fontsize='medium')
|
||||||
@ -197,3 +197,4 @@ if __name__ == '__main__':
|
|||||||
fig.tag(axs, xoffs=-4.5, yoffs=1.8)
|
fig.tag(axs, xoffs=-4.5, yoffs=1.8)
|
||||||
axs[1, 0].set_visible(False)
|
axs[1, 0].set_visible(False)
|
||||||
fig.savefig()
|
fig.savefig()
|
||||||
|
print()
|
||||||
|
@ -46,7 +46,7 @@ def plot_chi2(ax, s, data_file):
|
|||||||
ten *= delta
|
ten *= delta
|
||||||
break
|
break
|
||||||
pc = ax.pcolormesh(freqs, freqs, prss, vmin=0, vmax=vmax,
|
pc = ax.pcolormesh(freqs, freqs, prss, vmin=0, vmax=vmax,
|
||||||
cmap='viridis', rasterized=True)
|
rasterized=True)
|
||||||
ax.set_title(f'$N=10^{np.log10(n):.0f}$', fontsize='medium')
|
ax.set_title(f'$N=10^{np.log10(n):.0f}$', fontsize='medium')
|
||||||
ax.set_xlim(0, 300)
|
ax.set_xlim(0, 300)
|
||||||
ax.set_ylim(0, 300)
|
ax.set_ylim(0, 300)
|
||||||
@ -164,3 +164,5 @@ if __name__ == '__main__':
|
|||||||
fig.common_yticks(axs[-1, :4])
|
fig.common_yticks(axs[-1, :4])
|
||||||
fig.tag(axs, xoffs=-2.5, yoffs=1.8)
|
fig.tag(axs, xoffs=-2.5, yoffs=1.8)
|
||||||
fig.savefig()
|
fig.savefig()
|
||||||
|
print()
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ def plot_style():
|
|||||||
pt.colormap('YR', cmcolors, cmvalues)
|
pt.colormap('YR', cmcolors, cmvalues)
|
||||||
cycle_colors = ['blue', 'red', 'orange', 'lightgreen', 'magenta',
|
cycle_colors = ['blue', 'red', 'orange', 'lightgreen', 'magenta',
|
||||||
'yellow', 'cyan', 'pink']
|
'yellow', 'cyan', 'pink']
|
||||||
pt.colors_params(palette, cycle_colors, 'RdYlBu')
|
pt.colors_params(palette, cycle_colors, 'viridis')
|
||||||
pt.figure_params(palette['white'], format='pdf', compression=6,
|
pt.figure_params(palette['white'], format='pdf', compression=6,
|
||||||
fonttype=3, stripfonts=True)
|
fonttype=3, stripfonts=True)
|
||||||
pt.labels_params('{label} [{unit}]', labelsize='medium', labelpad=6)
|
pt.labels_params('{label} [{unit}]', labelsize='medium', labelpad=6)
|
||||||
|
@ -160,7 +160,7 @@ def plot_chi2(ax, s, contrast, freqs, chi2, fcutoff, vmax):
|
|||||||
if vmax is None:
|
if vmax is None:
|
||||||
vmax = np.quantile(1e-3*chi2, 0.99)
|
vmax = np.quantile(1e-3*chi2, 0.99)
|
||||||
pc = ax.pcolormesh(freqs, freqs, 1e-3*chi2, vmin=0, vmax=vmax,
|
pc = ax.pcolormesh(freqs, freqs, 1e-3*chi2, vmin=0, vmax=vmax,
|
||||||
cmap='viridis', rasterized=True, zorder=10)
|
rasterized=True, zorder=10)
|
||||||
ax.set_xlim(0, fcutoff)
|
ax.set_xlim(0, fcutoff)
|
||||||
ax.set_ylim(0, fcutoff)
|
ax.set_ylim(0, fcutoff)
|
||||||
df = 100 if fcutoff == 300 else 50
|
df = 100 if fcutoff == 300 else 50
|
||||||
@ -272,3 +272,4 @@ if __name__ == '__main__':
|
|||||||
fig.tag(axs, xoffs=-3, yoffs=2)
|
fig.tag(axs, xoffs=-3, yoffs=2)
|
||||||
|
|
||||||
fig.savefig()
|
fig.savefig()
|
||||||
|
print()
|
||||||
|
Loading…
Reference in New Issue
Block a user