reduce NGC1068 for comparison with Kishimoto's pipeline
This commit is contained in:
@@ -1703,12 +1703,14 @@ class pol_map(object):
|
||||
ax.add_artist(self.north_dir)
|
||||
|
||||
def display(self, fig=None, ax=None):
|
||||
norm = None
|
||||
if self.display_selection is None:
|
||||
self.display_selection = "total_flux"
|
||||
|
||||
if self.display_selection.lower() in ['total_flux']:
|
||||
self.data = self.I*self.convert_flux
|
||||
vmin, vmax = 0., np.max(self.data[self.data > 0.])
|
||||
vmin, vmax = np.min(self.data[self.cut])/10., np.max(self.data[self.data > 0.])
|
||||
norm = LogNorm(vmin, vmax)
|
||||
label = r"$F_{\lambda}$ [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]"
|
||||
elif self.display_selection.lower() in ['pol_flux']:
|
||||
self.data = self.I*self.convert_flux*self.P
|
||||
@@ -1738,12 +1740,18 @@ class pol_map(object):
|
||||
ax = self.ax
|
||||
if hasattr(self, 'im'):
|
||||
self.im.remove()
|
||||
self.im = ax.imshow(self.data, vmin=vmin, vmax=vmax, aspect='equal', cmap='inferno')
|
||||
if not norm is None:
|
||||
self.im = ax.imshow(self.data, norm=norm, aspect='equal', cmap='inferno')
|
||||
else:
|
||||
self.im = ax.imshow(self.data, vmin=vmin, vmax=vmax, aspect='equal', cmap='inferno')
|
||||
self.cbar = plt.colorbar(self.im, cax=self.cbar_ax, label=label)
|
||||
fig.canvas.draw_idle()
|
||||
return self.im
|
||||
else:
|
||||
im = ax.imshow(self.data, vmin=vmin, vmax=vmax, aspect='equal', cmap='inferno')
|
||||
if not norm is None:
|
||||
im = ax.imshow(self.data, norm=norm, aspect='equal', cmap='inferno')
|
||||
else:
|
||||
im = ax.imshow(self.data, vmin=vmin, vmax=vmax, aspect='equal', cmap='inferno')
|
||||
ax.set_xlim(0,self.data.shape[1])
|
||||
ax.set_ylim(0,self.data.shape[0])
|
||||
plt.colorbar(im, pad=0.025, aspect=80, label=label)
|
||||
|
||||
@@ -1475,24 +1475,23 @@ def rotate_Stokes(I_stokes, Q_stokes, U_stokes, Stokes_cov, data_mask, headers,
|
||||
new_U_stokes = np.zeros(shape)
|
||||
new_Stokes_cov = np.zeros((*Stokes_cov.shape[:-2],*shape))
|
||||
|
||||
for i in range(shape[0]):
|
||||
for j in range(shape[1]):
|
||||
new_I_stokes[i,j], new_Q_stokes[i,j], new_U_stokes[i,j] = np.dot(mrot, np.array([I_stokes[i,j], Q_stokes[i,j], U_stokes[i,j]])).T
|
||||
new_Stokes_cov[:,:,i,j] = np.dot(mrot, np.dot(Stokes_cov[:,:,i,j], mrot.T))
|
||||
|
||||
#Rotate original images using scipy.ndimage.rotate
|
||||
new_I_stokes = sc_rotate(new_I_stokes, ang, order=1, reshape=False, cval=0.)
|
||||
new_Q_stokes = sc_rotate(new_Q_stokes, ang, order=1, reshape=False, cval=0.)
|
||||
new_U_stokes = sc_rotate(new_U_stokes, ang, order=1, reshape=False, cval=0.)
|
||||
new_I_stokes = sc_rotate(I_stokes, ang, order=1, reshape=False, cval=0.)
|
||||
new_Q_stokes = sc_rotate(Q_stokes, ang, order=1, reshape=False, cval=0.)
|
||||
new_U_stokes = sc_rotate(U_stokes, ang, order=1, reshape=False, cval=0.)
|
||||
new_data_mask = sc_rotate(data_mask.astype(float)*10., ang, order=1, reshape=False, cval=0.)
|
||||
new_data_mask[new_data_mask < 2] = 0.
|
||||
new_data_mask = new_data_mask.astype(bool)
|
||||
for i in range(3):
|
||||
for j in range(3):
|
||||
new_Stokes_cov[i,j] = sc_rotate(new_Stokes_cov[i,j], ang, order=1,
|
||||
reshape=False, cval=0.)
|
||||
new_Stokes_cov[i,j] = sc_rotate(Stokes_cov[i,j], ang, order=1, reshape=False, cval=0.)
|
||||
new_Stokes_cov[i,i] = np.abs(new_Stokes_cov[i,i])
|
||||
|
||||
for i in range(shape[0]):
|
||||
for j in range(shape[1]):
|
||||
new_I_stokes[i,j], new_Q_stokes[i,j], new_U_stokes[i,j] = np.dot(mrot, np.array([new_I_stokes[i,j], new_Q_stokes[i,j], new_U_stokes[i,j]])).T
|
||||
new_Stokes_cov[:,:,i,j] = np.dot(mrot, np.dot(new_Stokes_cov[:,:,i,j], mrot.T))
|
||||
|
||||
#Update headers to new angle
|
||||
new_headers = []
|
||||
mrot = np.array([[np.cos(-alpha), -np.sin(-alpha)],
|
||||
|
||||
Reference in New Issue
Block a user