bit of doctring and fix on test_center
This commit is contained in:
@@ -23,15 +23,20 @@ NGC1068snr[NGC1068["POL_DEG_ERR"].data > 0.0] = (
|
||||
)
|
||||
|
||||
NGC1068centconf, NGC1068center = CenterConf(NGC1068conf > 0.99, NGC1068["POL_ANG"].data, NGC1068["POL_ANG_ERR"].data)
|
||||
NGC1068pos = WCS(NGC1068[0].header).pixel_to_world(*NGC1068center)
|
||||
|
||||
figngc, axngc = plt.subplots(1, 2, layout="tight", figsize=(18,9), subplot_kw=dict(projection=WCS(NGC1068[0].header)))
|
||||
figngc, axngc = plt.subplots(1, 2, layout="tight", figsize=(18, 9), subplot_kw=dict(projection=WCS(NGC1068[0].header)), sharex=True, sharey=True)
|
||||
|
||||
axngc[0].set(xlabel="RA", ylabel="DEC", title="NGC1069 intensity map with SNR and confidence contours")
|
||||
imngc = axngc[0].imshow(NGC1068["I_STOKES"].data * NGC1068["I_STOKES"].header["PHOTFLAM"], norm=LogNorm(), cmap="inferno")
|
||||
vmin, vmax = (
|
||||
0.5 * np.median(NGC1068["I_STOKES"].data[NGC1068mask]) * NGC1068[0].header["PHOTFLAM"],
|
||||
np.max(NGC1068["I_STOKES"].data[NGC1068mask]) * NGC1068[0].header["PHOTFLAM"],
|
||||
)
|
||||
imngc = axngc[0].imshow(NGC1068["I_STOKES"].data * NGC1068["I_STOKES"].header["PHOTFLAM"], norm=LogNorm(vmin, vmax), cmap="inferno")
|
||||
ngcsnrcont = axngc[0].contour(NGC1068snr, levelssnr, colors="b")
|
||||
ngcconfcont = axngc[0].contour(NGC1068conf, levelsconf, colors="r")
|
||||
ngcconfcenter = axngc[0].plot(*np.unravel_index(np.argmax(NGC1068centconf), NGC1068centconf.shape)[::-1], "k+", label="Best confidence for center")
|
||||
ngcconfcentcont = axngc[0].contour(NGC1068centconf, 1.-levelsconf, colors="k")
|
||||
ngcconfcenter = axngc[0].plot(*NGC1068center, marker="+",color="gray", label="Best confidence for center: {0}".format(NGC1068pos.to_string('hmsdms')))
|
||||
ngcconfcentcont = axngc[0].contour(NGC1068centconf, [0.01], colors="gray")
|
||||
handles, labels = axngc[0].get_legend_handles_labels()
|
||||
labels.append("SNR contours")
|
||||
handles.append(Rectangle((0, 0), 1, 1, fill=False, ec=ngcsnrcont.collections[0].get_edgecolor()[0]))
|
||||
@@ -43,14 +48,14 @@ axngc[0].legend(handles=handles, labels=labels)
|
||||
|
||||
axngc[1].set(xlabel="RA", ylabel="DEC", title="Location of the nucleus confidence map")
|
||||
ngccent = axngc[1].imshow(NGC1068centconf, vmin=0.0, cmap="inferno")
|
||||
ngccentcont = axngc[1].contour(NGC1068centconf, 1.-levelsconf, colors="grey")
|
||||
ngccentcenter = axngc[1].plot(*np.unravel_index(np.argmax(NGC1068centconf), NGC1068centconf.shape)[::-1], "k+", label="Best confidence for center")
|
||||
ngccentcont = axngc[1].contour(NGC1068centconf, [0.01], colors="gray")
|
||||
ngccentcenter = axngc[1].plot(*NGC1068center, marker="+",color="gray", label="Best confidence for center: {0}".format(NGC1068pos.to_string('hmsdms')))
|
||||
handles, labels = axngc[1].get_legend_handles_labels()
|
||||
labels.append("CONF99 contour")
|
||||
handles.append(Rectangle((0, 0), 1, 1, fill=False, ec=ngccentcont.collections[0].get_edgecolor()[0]))
|
||||
axngc[1].legend(handles=handles, labels=labels)
|
||||
|
||||
figngc.savefig("NGC1068_center.pdf",dpi=150,facecolor="None")
|
||||
figngc.savefig("NGC1068_center.pdf", dpi=150, facecolor="None")
|
||||
|
||||
###################################################################################################
|
||||
|
||||
@@ -68,16 +73,21 @@ MRK463Esnr[MRK463E["POL_DEG_ERR"].data > 0.0] = (
|
||||
)
|
||||
|
||||
MRK463Ecentconf, MRK463Ecenter = CenterConf(MRK463Econf > 0.99, MRK463E["POL_ANG"].data, MRK463E["POL_ANG_ERR"].data)
|
||||
MRK463Epos = WCS(MRK463E[0].header).pixel_to_world(*MRK463Ecenter)
|
||||
|
||||
figmrk, axmrk = plt.subplots(1, 2, layout="tight", figsize=(18,9), subplot_kw=dict(projection=WCS(MRK463E[0].header)))
|
||||
figmrk, axmrk = plt.subplots(1, 2, layout="tight", figsize=(18, 9), subplot_kw=dict(projection=WCS(MRK463E[0].header)), sharex=True, sharey=True)
|
||||
|
||||
axmrk[0].set(xlabel="RA", ylabel="DEC", title="NGC1069 intensity map with SNR and confidence contours")
|
||||
immrk = axmrk[0].imshow(MRK463E["I_STOKES"].data * MRK463E["I_STOKES"].header["PHOTFLAM"], norm=LogNorm(), cmap="inferno")
|
||||
vmin, vmax = (
|
||||
0.5 * np.median(MRK463E["I_STOKES"].data[MRK463Emask]) * MRK463E[0].header["PHOTFLAM"],
|
||||
np.max(MRK463E["I_STOKES"].data[MRK463Emask]) * MRK463E[0].header["PHOTFLAM"],
|
||||
)
|
||||
immrk = axmrk[0].imshow(MRK463E["I_STOKES"].data * MRK463E["I_STOKES"].header["PHOTFLAM"], norm=LogNorm(vmin, vmax), cmap="inferno")
|
||||
mrksnrcont = axmrk[0].contour(MRK463Esnr, levelssnr, colors="b")
|
||||
mrkconfcont = axmrk[0].contour(MRK463Econf, levelsconf, colors="r")
|
||||
mrkconfcenter = axmrk[0].plot(*np.unravel_index(np.argmax(MRK463Ecentconf), MRK463Ecentconf.shape)[::-1], "k+", label="Best confidence for center")
|
||||
mrkconfcentcont = axmrk[0].contour(MRK463Ecentconf, 1.-levelsconf, colors="k")
|
||||
handles, labels = axmrk[1].get_legend_handles_labels()
|
||||
mrkconfcenter = axmrk[0].plot(*MRK463Ecenter, marker="+",color="gray", label="Best confidence for center: {0}".format(MRK463Epos.to_string('hmsdms')))
|
||||
mrkconfcentcont = axmrk[0].contour(MRK463Ecentconf, [0.01], colors="gray")
|
||||
handles, labels = axmrk[0].get_legend_handles_labels()
|
||||
labels.append("SNR contours")
|
||||
handles.append(Rectangle((0, 0), 1, 1, fill=False, ec=mrksnrcont.collections[0].get_edgecolor()[0]))
|
||||
labels.append("CONF99 contour")
|
||||
@@ -88,12 +98,12 @@ axmrk[0].legend(handles=handles, labels=labels)
|
||||
|
||||
axmrk[1].set(xlabel="RA", ylabel="DEC", title="Location of the nucleus confidence map")
|
||||
mrkcent = axmrk[1].imshow(MRK463Ecentconf, vmin=0.0, cmap="inferno")
|
||||
mrkcentcont = axmrk[1].contour(MRK463Ecentconf, 1.-levelsconf, colors="grey")
|
||||
mrkcentcenter = axmrk[1].plot(*np.unravel_index(np.argmax(MRK463Ecentconf), MRK463Ecentconf.shape)[::-1], "k+", label="Best confidence for center")
|
||||
mrkcentcont = axmrk[1].contour(MRK463Ecentconf, [0.01], colors="gray")
|
||||
mrkcentcenter = axmrk[1].plot(*MRK463Ecenter, marker="+",color="gray", label="Best confidence for center: {0}".format(MRK463Epos.to_string('hmsdms')))
|
||||
handles, labels = axmrk[1].get_legend_handles_labels()
|
||||
labels.append("CONF99 contour")
|
||||
handles.append(Rectangle((0, 0), 1, 1, fill=False, ec=mrkcentcont.collections[0].get_edgecolor()[0]))
|
||||
axmrk[1].legend(handles=handles, labels=labels)
|
||||
|
||||
figmrk.savefig("MRK463E_center.pdf",dpi=150,facecolor="None")
|
||||
figmrk.savefig("MRK463E_center.pdf", dpi=150, facecolor="None")
|
||||
plt.show()
|
||||
|
||||
Reference in New Issue
Block a user