add kwargs handling in overplot

This commit is contained in:
Thibault Barnouin
2022-05-25 11:31:18 +02:00
parent fb679706ab
commit 30ea3db89d
4 changed files with 17 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 KiB

After

Width:  |  Height:  |  Size: 589 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 570 KiB

After

Width:  |  Height:  |  Size: 571 KiB

View File

@@ -386,7 +386,7 @@ class align_maps(object):
"""
Class to interactively align maps with different WCS.
"""
def __init__(self, map1, other_map):
def __init__(self, map1, other_map, **kwargs):
self.aligned = False
self.map = map1
self.other_map = other_map
@@ -449,7 +449,13 @@ class align_maps(object):
self.ax2.set_facecolor('k')
vmin, vmax = 0., np.max(other_data[other_data > 0.]*other_convert)
im2 = self.ax2.imshow(other_data*other_convert, norm=LogNorm(), aspect='auto', cmap='inferno', alpha=1.)
for key, value in [["cmap",[["cmap","inferno"]]], ["norm",[["vmin",vmin],["vmax",vmax]]]]:
try:
test = kwargs[key]
except KeyError:
for key_i, val_i in value:
kwargs[key_i] = val_i
im2 = self.ax2.imshow(other_data*other_convert, aspect='auto', **kwargs)
fontprops = fm.FontProperties(size=16)
px_size = self.wcs_other.wcs.get_cdelt()[0]*3600.
@@ -662,7 +668,13 @@ class overplot_pol(align_maps):
#Display "other" intensity map
vmin, vmax = 0., np.max(other_data[other_data > 0.]*other_convert)
im = self.ax.imshow(other_data*other_convert, transform=self.ax.get_transform(self.wcs_other), cmap='inferno', alpha=1., **kwargs)
for key, value in [["cmap",[["cmap","inferno"]]], ["norm",[["vmin",vmin],["vmax",vmax]]]]:
try:
test = kwargs[key]
except KeyError:
for key_i, val_i in value:
kwargs[key_i] = val_i
im = self.ax.imshow(other_data*other_convert, transform=self.ax.get_transform(self.wcs_other), alpha=1., **kwargs)
cbar_ax = self.fig2.add_axes([0.95, 0.12, 0.01, 0.75])
cbar = plt.colorbar(im, cax=cbar_ax, label=r"$F_{\lambda}$ [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]")

View File

@@ -41,5 +41,5 @@ E.plot(levels=levels357GHz, SNRp_cut=3.0, SNRi_cut=80.0, savename='../plots/IC50
F = overplot_pol(Stokes_UV, Stokes_S2)
F.plot(SNRp_cut=3.0, SNRi_cut=80.0, savename='../plots/IC5063_x3nl030/S2_overplot_forced.png', norm=LogNorm(vmin=5e-20,vmax=5e-18))
G = overplot_pol(Stokes_UV, Stokes_IR)
G.plot(SNRp_cut=3.0, SNRi_cut=80.0, savename='../plots/IC5063_x3nl030/IR_overplot_forced.png', norm=LogNorm(vmin=1e-17,vmax=5e-15))
G = overplot_pol(Stokes_UV, Stokes_IR, norm=LogNorm(vmin=1e-17,vmax=5e-15), cmap='inferno_r')
G.plot(SNRp_cut=3.0, SNRi_cut=80.0, savename='../plots/IC5063_x3nl030/IR_overplot_forced.png', norm=LogNorm(vmin=1e-17,vmax=5e-15), cmap='inferno_r')