small improvments to overplot_pol
This commit is contained in:
@@ -1599,7 +1599,7 @@ class overplot_pol(align_maps):
|
|||||||
|
|
||||||
def overplot(
|
def overplot(
|
||||||
self,
|
self,
|
||||||
levels=None,
|
levels="Default",
|
||||||
P_cut=0.99,
|
P_cut=0.99,
|
||||||
SNRi_cut=1.0,
|
SNRi_cut=1.0,
|
||||||
step_vec=1,
|
step_vec=1,
|
||||||
@@ -1668,9 +1668,7 @@ class overplot_pol(align_maps):
|
|||||||
["linewidth", [["linewidth", 0.3 * self.px_scale]]],
|
["linewidth", [["linewidth", 0.3 * self.px_scale]]],
|
||||||
]:
|
]:
|
||||||
try:
|
try:
|
||||||
test = kwargs[key]
|
_ = kwargs[key]
|
||||||
if isinstance(test, LogNorm):
|
|
||||||
kwargs[key] = LogNorm(vmin, vmax)
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
for key_i, val_i in value:
|
for key_i, val_i in value:
|
||||||
kwargs[key_i] = val_i
|
kwargs[key_i] = val_i
|
||||||
@@ -1703,7 +1701,7 @@ class overplot_pol(align_maps):
|
|||||||
else:
|
else:
|
||||||
self.ax_overplot.set_facecolor("white")
|
self.ax_overplot.set_facecolor("white")
|
||||||
font_color = "black"
|
font_color = "black"
|
||||||
if hasattr(kwargs, "norm"):
|
if "norm" in kwargs.keys():
|
||||||
self.im = self.ax_overplot.imshow(
|
self.im = self.ax_overplot.imshow(
|
||||||
other_data * self.other_convert,
|
other_data * self.other_convert,
|
||||||
alpha=1.0,
|
alpha=1.0,
|
||||||
@@ -1766,9 +1764,10 @@ class overplot_pol(align_maps):
|
|||||||
|
|
||||||
# Display Stokes as contours
|
# Display Stokes as contours
|
||||||
disptypestr = ""
|
disptypestr = ""
|
||||||
|
if levels is not None:
|
||||||
if disptype.lower() == "p":
|
if disptype.lower() == "p":
|
||||||
disptypestr = "polarization degree"
|
disptypestr = "polarization degree"
|
||||||
if levels is None:
|
if levels == "Default":
|
||||||
levels = np.array([2.0, 5.0, 10.0, 20.0, 90.0]) / 100.0 * np.max(pol[stkI > 0.0])
|
levels = np.array([2.0, 5.0, 10.0, 20.0, 90.0]) / 100.0 * np.max(pol[stkI > 0.0])
|
||||||
cont_stk = self.ax_overplot.contour(
|
cont_stk = self.ax_overplot.contour(
|
||||||
pol * 100.0,
|
pol * 100.0,
|
||||||
@@ -1777,9 +1776,9 @@ class overplot_pol(align_maps):
|
|||||||
alpha=0.75,
|
alpha=0.75,
|
||||||
transform=self.ax_overplot.get_transform(self.wcs_UV),
|
transform=self.ax_overplot.get_transform(self.wcs_UV),
|
||||||
)
|
)
|
||||||
if disptype.lower() == "pf":
|
elif disptype.lower() == "pf":
|
||||||
disptypestr = "polarized flux"
|
disptypestr = "polarized flux"
|
||||||
if levels is None:
|
if levels == "Default":
|
||||||
levels = np.array([2.0, 5.0, 10.0, 20.0, 90.0]) / 100.0 * np.max(stkI[stkI > 0.0] * pol[stkI > 0.0]) * self.map_convert
|
levels = np.array([2.0, 5.0, 10.0, 20.0, 90.0]) / 100.0 * np.max(stkI[stkI > 0.0] * pol[stkI > 0.0]) * self.map_convert
|
||||||
cont_stk = self.ax_overplot.contour(
|
cont_stk = self.ax_overplot.contour(
|
||||||
stkI * pol * self.map_convert,
|
stkI * pol * self.map_convert,
|
||||||
@@ -1788,9 +1787,9 @@ class overplot_pol(align_maps):
|
|||||||
alpha=0.75,
|
alpha=0.75,
|
||||||
transform=self.ax_overplot.get_transform(self.wcs_UV),
|
transform=self.ax_overplot.get_transform(self.wcs_UV),
|
||||||
)
|
)
|
||||||
if disptype.lower() == "snri":
|
elif disptype.lower() == "snri":
|
||||||
disptypestr = "Stokes I signal-to-noise"
|
disptypestr = "Stokes I signal-to-noise"
|
||||||
if levels is None:
|
if levels == "Default":
|
||||||
levels = np.array([2.0, 5.0, 10.0, 20.0, 90.0]) / 100.0 * np.max(SNRi[stk_cov[0, 0] > 0.0])
|
levels = np.array([2.0, 5.0, 10.0, 20.0, 90.0]) / 100.0 * np.max(SNRi[stk_cov[0, 0] > 0.0])
|
||||||
cont_stk = self.ax_overplot.contour(
|
cont_stk = self.ax_overplot.contour(
|
||||||
SNRi,
|
SNRi,
|
||||||
@@ -1801,7 +1800,7 @@ class overplot_pol(align_maps):
|
|||||||
)
|
)
|
||||||
else: # default to intensity contours
|
else: # default to intensity contours
|
||||||
disptypestr = "Stokes I"
|
disptypestr = "Stokes I"
|
||||||
if levels is None:
|
if levels == "Default":
|
||||||
levels = np.array([2.0, 5.0, 10.0, 20.0, 90.0]) / 100.0 * np.max(stkI[stkI > 0.0]) * self.map_convert
|
levels = np.array([2.0, 5.0, 10.0, 20.0, 90.0]) / 100.0 * np.max(stkI[stkI > 0.0]) * self.map_convert
|
||||||
cont_stk = self.ax_overplot.contour(
|
cont_stk = self.ax_overplot.contour(
|
||||||
stkI * self.map_convert,
|
stkI * self.map_convert,
|
||||||
@@ -1881,8 +1880,10 @@ class overplot_pol(align_maps):
|
|||||||
handles[np.argmax([li == "{0:s} polarization map".format(self.map_observer) for li in labels])] = FancyArrowPatch(
|
handles[np.argmax([li == "{0:s} polarization map".format(self.map_observer) for li in labels])] = FancyArrowPatch(
|
||||||
(0, 0), (0, 1), arrowstyle="-", fc="w", ec="k", lw=2
|
(0, 0), (0, 1), arrowstyle="-", fc="w", ec="k", lw=2
|
||||||
)
|
)
|
||||||
|
if disptypestr != "":
|
||||||
labels.append("{0:s} {1:s} contour".format(self.map_observer, disptypestr))
|
labels.append("{0:s} {1:s} contour".format(self.map_observer, disptypestr))
|
||||||
handles.append(Rectangle((0, 0), 1, 1, fill=False, ec=cont_stk.get_edgecolor()[0]))
|
handles.append(Rectangle((0, 0), 1, 1, fill=False, ec=cont_stk.get_edgecolor()[0]))
|
||||||
|
disptypestr += " contours"
|
||||||
self.legend = self.ax_overplot.legend(
|
self.legend = self.ax_overplot.legend(
|
||||||
handles=handles,
|
handles=handles,
|
||||||
labels=labels,
|
labels=labels,
|
||||||
@@ -1893,7 +1894,7 @@ class overplot_pol(align_maps):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.fig_overplot.suptitle(
|
self.fig_overplot.suptitle(
|
||||||
"{0:s} observation from {1:s} overplotted with {2:s} contours from {3:s}".format(obj, self.other_observer, vecstr + disptypestr, self.map_observer),
|
"{0:s} observation from {1:s} overplotted with {2:s} from {3:s}".format(obj, self.other_observer, vecstr + disptypestr, self.map_observer),
|
||||||
wrap=True,
|
wrap=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user