For image subtraction the package has a module called propersubtract
, which implements a main diff
function.
In [1]:
from copy import copy
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from scipy import stats
%matplotlib inline
In [2]:
from astropy.visualization import LinearStretch, LogStretch
from astropy.visualization import ZScaleInterval, MinMaxInterval
from astropy.visualization import ImageNormalize
In [3]:
import os
plots_path = './plots_properimage/secondimage'
if not os.path.exists(plots_path):
os.makedirs(plots_path)
In [4]:
palette = copy(plt.cm.gray)
palette.set_bad('r', 1.0)
#palette.set_under('r', 1.0)
#palette.set_over('r', 1.0)
In [5]:
import properimage.single_image as si
import properimage.propersubtract as ps
In [6]:
import pandas as pd
In [6]:
import pandas as pd
transients = pd.read_csv('/home/bruno/Data/RBpipeline/output_docker/QkvBW7sYuL7AsXz5dMgSuP/cats/transient.list',
names=['code', 'x', 'y', 'mag'], sep=' ').dropna()
plt.hist(transients['mag'].values)
Out[6]:
In [8]:
ref_path = './../../../data/ref.fits.fz'
new_path = './../../../data/new.fits.fz'
To get the subtraction we need to run this function by using both paths for example:
In [9]:
from astropy.io.fits import getdata
plt.figure(figsize=(16, 8))
plt.subplot(121)
ref = getdata(ref_path)
norm = ImageNormalize(ref, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.imshow(ref, cmap=plt.cm.gray, norm=norm, interpolation='none')
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tick_params(labelsize=16)
#plt.colorbar(orientation='horizontal')
#plt.grid()
plt.subplot(122)
ref = getdata(new_path)
norm = ImageNormalize(ref, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.imshow(ref, cmap=plt.cm.gray, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
#plt.grid()
#plt.colorbar(orientation='horizontal')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'pair_of_images.png'))
In [10]:
result = ps.diff(ref=ref_path, new=new_path, smooth_psf=False, fitted_psf=True,
align=False, iterative=False, beta=False, shift=False)
The result is a list of numpy arrays.
The arrays are in order: D, P, Scorr, mask
In [11]:
D = result[0]
P = result[1]
Scorr = result[2]
mask = result[3]
In [12]:
norm = ImageNormalize(D.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(D.real, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
plt.grid()
#plt.colorbar(orientation='horizontal', shrink=0.6).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'diff1.png'))
In [13]:
norm = ImageNormalize(P, interval=MinMaxInterval(),
stretch=LogStretch())
xc, yc = np.where(P==P.max())
xc, yc = np.round(xc[0]), np.round(yc[0])
P2 = np.roll(P, (-xc, -yc), axis=[0,1])
P2 = np.roll(P2, (10, 10), axis=[0,1])[0:21, 0:21]
plt.imshow(P2, norm=norm,
cmap=palette, interpolation='none',
origin='lower')
plt.tick_params(labelsize=16)
plt.colorbar().ax.tick_params(labelsize=13)
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'psf_diff1.png'))
In [14]:
norm = ImageNormalize(Scorr.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(Scorr, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
#plt.colorbar(orientation='horizontal', shrink=0.7).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'scorr_diff1.png'))
In [15]:
plt.figure(figsize=(8, 3))
dimg = np.ma.MaskedArray(D.real, mask=mask).filled(0).flatten()
plt.subplot(121)
plt.hist(dimg, log=True, bins=100, histtype='step', label='D', color='k')
#plt.xlim(-10, 10)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(dimg))
#print(stats.skewtest(dimg))
plt.subplot(122)
simage = np.ma.MaskedArray(Scorr.real, mask=mask).filled(0).flatten()
plt.hist(simage/np.std(simage), log=True, bins=100, histtype='step', label=r'$S_{corr}$', color='k')
#plt.xlim(-4, 4)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(simage))
#print(stats.skewtest(simage))
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'hists_diff1.png'))
This is related to the quantities derived in Zackay et al. works. $S_{corr} = P_D \otimes D$
In [16]:
reload(ps)
Out[16]:
In [17]:
D, P, Scorr, mask = ps.diff(ref=ref_path, new=new_path, align=False,
beta=True, iterative=False, shift=False )
The result is a list of numpy arrays.
The arrays are in order: D, P, Scorr, mask
In [18]:
norm = ImageNormalize(D.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(D.real, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
plt.grid()
#plt.colorbar(orientation='horizontal', shrink=0.6).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'diff_beta.png'))
In [19]:
norm = ImageNormalize(P, interval=MinMaxInterval(),
stretch=LogStretch())
xc, yc = np.where(P==P.max())
xc, yc = np.round(xc[0]), np.round(yc[0])
P2 = np.roll(P, (-xc, -yc), axis=[0,1])
P2 = np.roll(P2, (10, 10), axis=[0,1])[0:21, 0:21]
plt.imshow(P2, norm=norm,
cmap=palette, interpolation='none',
origin='lower')
plt.tick_params(labelsize=16)
plt.colorbar().ax.tick_params(labelsize=13)
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'psf_diff_beta.png'))
In [20]:
norm = ImageNormalize(Scorr.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(Scorr, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
#plt.colorbar(orientation='horizontal', shrink=0.7).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'scorr_diff_beta.png'))
In [21]:
plt.figure(figsize=(8, 3))
dimg = np.ma.MaskedArray(D.real, mask=mask).filled(0).flatten()
plt.subplot(121)
plt.hist(dimg, log=True, bins=100, histtype='step', label='D', color='k')
#plt.xlim(-10, 10)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(dimg))
#print(stats.skewtest(dimg))
plt.subplot(122)
simage = np.ma.MaskedArray(Scorr.real, mask=mask).filled(0).flatten()
plt.hist(simage/np.std(simage), log=True, bins=100, histtype='step', label=r'$S_{corr}$', color='k')
#plt.xlim(-4, 4)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(simage))
#print(stats.skewtest(simage))
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'hists_diff_beta.png'))
We have the option of using the iterative methods without beta
In [22]:
reload(ps)
Out[22]:
In [23]:
D, P, Scorr, mask = ps.diff(ref=ref_path, new=new_path, align=False, beta=True, iterative=True, shift=False)
The result is a list of numpy arrays.
The arrays are in order: D, P, Scorr, mask
In [24]:
norm = ImageNormalize(D.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(D.real, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
plt.grid()
#plt.colorbar(orientation='horizontal', shrink=0.6).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'diff_beta_iter.png'))
In [25]:
norm = ImageNormalize(P, interval=MinMaxInterval(),
stretch=LogStretch())
xc, yc = np.where(P==P.max())
xc, yc = np.round(xc[0]), np.round(yc[0])
P2 = np.roll(P, (-xc, -yc), axis=[0,1])
P2 = np.roll(P2, (10, 10), axis=[0,1])[0:21, 0:21]
plt.imshow(P2, norm=norm,
cmap=palette, interpolation='none',
origin='lower')
plt.tick_params(labelsize=16)
plt.colorbar().ax.tick_params(labelsize=13)
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'psf_diff_beta_iter.png'))
In [26]:
norm = ImageNormalize(Scorr.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(Scorr, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
#plt.colorbar(orientation='horizontal', shrink=0.7).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'scorr_diff_beta_iter.png'))
In [27]:
plt.figure(figsize=(8, 3))
dimg = np.ma.MaskedArray(D.real, mask=mask).filled(0).flatten()
plt.subplot(121)
plt.hist(dimg, log=True, bins=100, histtype='step', label='D', color='k')
#plt.xlim(-10, 10)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(dimg))
#print(stats.skewtest(dimg))
plt.subplot(122)
simage = np.ma.MaskedArray(Scorr.real, mask=mask).filled(0).flatten()
plt.hist(simage/np.std(simage), log=True, bins=100, histtype='step', label=r'$S_{corr}$', color='k')
#plt.xlim(-4, 4)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(simage))
#print(stats.skewtest(simage))
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'hists_diff_beta_iter.png'))
We have the option of using the iterative methods without beta
In [28]:
reload(ps)
Out[28]:
In [29]:
D, P, Scorr, mask = ps.diff(ref=ref_path, new=new_path, smooth_psf=False, fitted_psf=True,
align=False, iterative=False, beta=True, shift=True)
The result is a list of numpy arrays.
The arrays are in order: D, P, Scorr, mask
In [30]:
norm = ImageNormalize(D.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(D.real, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
plt.grid()
#plt.colorbar(orientation='horizontal', shrink=0.6).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'diff_beta_shift.png'))
In [31]:
norm = ImageNormalize(P, interval=MinMaxInterval(),
stretch=LogStretch())
xc, yc = np.where(P==P.max())
xc, yc = np.round(xc[0]), np.round(yc[0])
P2 = np.roll(P, (-xc, -yc), axis=[0,1])
P2 = np.roll(P2, (10, 10), axis=[0,1])[0:21, 0:21]
plt.imshow(P2, norm=norm,
cmap=palette, interpolation='none',
origin='lower')
plt.tick_params(labelsize=16)
plt.colorbar().ax.tick_params(labelsize=13)
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'psf_diff_beta_shift.png'))
In [32]:
norm = ImageNormalize(Scorr.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(Scorr, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
#plt.colorbar(orientation='horizontal', shrink=0.7).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'scorr_diff_beta_shift.png'))
In [33]:
plt.figure(figsize=(8, 3))
dimg = np.ma.MaskedArray(D.real, mask=mask).filled(0).flatten()
plt.subplot(121)
plt.hist(dimg, log=True, bins=100, histtype='step', label='D', color='k')
#plt.xlim(-10, 10)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(dimg))
#print(stats.skewtest(dimg))
plt.subplot(122)
simage = np.ma.MaskedArray(Scorr.real, mask=mask).filled(0).flatten()
plt.hist(simage/np.std(simage), log=True, bins=100, histtype='step', label=r'$S_{corr}$', color='k')
#plt.xlim(-4, 4)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(simage))
#print(stats.skewtest(simage))
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'hists_diff_beta_shift.png'))
In [34]:
reload(ps)
Out[34]:
In [35]:
D, P, Scorr, mask = ps.diff(ref=ref_path, new=new_path, smooth_psf=False, fitted_psf=True,
align=False, iterative=False, beta=False, shift=True)
The result is a list of numpy arrays.
The arrays are in order: D, P, Scorr, mask
In [36]:
norm = ImageNormalize(D.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(D.real, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
plt.grid()
#plt.colorbar(orientation='horizontal', shrink=0.6).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'diff_shift.png'))
In [37]:
norm = ImageNormalize(P, interval=MinMaxInterval(),
stretch=LogStretch())
xc, yc = np.where(P==P.max())
xc, yc = np.round(xc[0]), np.round(yc[0])
P2 = np.roll(P, (-xc, -yc), axis=[0,1])
P2 = np.roll(P2, (10, 10), axis=[0,1])[0:21, 0:21]
plt.imshow(P2, norm=norm,
cmap=palette, interpolation='none',
origin='lower')
plt.tick_params(labelsize=16)
plt.colorbar().ax.tick_params(labelsize=13)
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'psf_diff_shift.png'))
In [38]:
norm = ImageNormalize(Scorr.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(Scorr, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
#plt.colorbar(orientation='horizontal', shrink=0.7).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'scorr_diff_shift.png'))
In [39]:
plt.figure(figsize=(8, 3))
dimg = np.ma.MaskedArray(D.real, mask=mask).filled(0).flatten()
plt.subplot(121)
plt.hist(dimg, log=True, bins=100, histtype='step', label='D', color='k')
#plt.xlim(-10, 10)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(dimg))
#print(stats.skewtest(dimg))
plt.subplot(122)
simage = np.ma.MaskedArray(Scorr.real, mask=mask).filled(0).flatten()
plt.hist(simage/np.std(simage), log=True, bins=100, histtype='step', label=r'$S_{corr}$', color='k')
#plt.xlim(-4, 4)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(simage))
#print(stats.skewtest(simage))
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'hists_diff_shift.png'))
In [40]:
reload(ps)
Out[40]:
In [41]:
D, P, Scorr, mask = ps.diff(ref=ref_path, new=new_path, smooth_psf=False, fitted_psf=False,
align=False, iterative=False, beta=True, shift=True)
The result is a list of numpy arrays.
The arrays are in order: D, P, Scorr, mask
In [42]:
norm = ImageNormalize(D.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(D.real, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
plt.grid()
#plt.colorbar(orientation='horizontal', shrink=0.6).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'diff_beta_shift_kl.png'))
In [43]:
norm = ImageNormalize(P, interval=MinMaxInterval(),
stretch=LogStretch())
xc, yc = np.where(P==P.max())
xc, yc = np.round(xc[0]), np.round(yc[0])
P2 = np.roll(P, (-xc, -yc), axis=[0,1])
P2 = np.roll(P2, (10, 10), axis=[0,1])[0:21, 0:21]
plt.imshow(P2, norm=norm,
cmap=palette, interpolation='none',
origin='lower')
plt.tick_params(labelsize=16)
plt.colorbar().ax.tick_params(labelsize=13)
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'psf_diff_beta_shift_kl.png'))
In [44]:
norm = ImageNormalize(Scorr.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(8, 8))
plt.imshow(np.ma.MaskedArray(Scorr, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
#plt.colorbar(orientation='horizontal', shrink=0.7).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'scorr_diff_beta_shift_kl.png'))
In [45]:
plt.figure(figsize=(8, 3))
dimg = np.ma.MaskedArray(D.real, mask=mask).filled(0).flatten()
plt.subplot(121)
plt.hist(dimg, log=True, bins=100, histtype='step', label='D', color='k')
#plt.xlim(-10, 10)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(dimg))
#print(stats.skewtest(dimg))
plt.subplot(122)
simage = np.ma.MaskedArray(Scorr.real, mask=mask).filled(0).flatten()
plt.hist(simage/np.std(simage), log=True, bins=100, histtype='step', label=r'$S_{corr}$', color='k')
#plt.xlim(-4, 4)
plt.tick_params(labelsize=14)
plt.tick_params(size=8)
plt.legend(fontsize=14)
#plt.show()
#print(stats.skew(simage))
#print(stats.skewtest(simage))
plt.tight_layout()
plt.savefig(os.path.join(plots_path, 'hists_diff_beta_shift_kl.png'))
In [50]:
from properimage import utils
In [51]:
catlow = pd.DataFrame(utils.find_S_local_maxima(Scorr.real, threshold=2.5), columns=['x', 'y', 'signif'])
cathig = pd.DataFrame(utils.find_S_local_maxima(Scorr.real, threshold=10, neighborhood_size=9), columns=['x', 'y', 'signif'])
In [52]:
cat = pd.concat([catlow, cathig]).drop_duplicates()
In [53]:
len(cat)
Out[53]:
In [54]:
cat = pd.DataFrame(cat, columns=['x', 'y', 'signif'])
In [55]:
ids = utils.matching(transients, cat, radius=1.8)
In [56]:
cat.columns
Out[56]:
In [57]:
transients.columns
Out[57]:
In [58]:
cat['tx'] = -1
cat['ty'] = -1
cat['masterindex'] = -1
cat['tmag'] = -1
for irow, row in cat.iterrows():
if ids[irow]>-1:
tt = transients.iloc[transients.masterindex.values == ids[irow]]
cat.loc[irow, 'tx'] = tt['x'].values[0]
cat.loc[irow, 'ty'] = tt['y'].values[0]
cat.loc[irow, 'masterindex'] = tt['masterindex'].values[0]
cat.loc[irow, 'tmag'] = tt['mag'].values[0]
In [59]:
bins=np.arange(14, 24, 0.5)
plt.hist(cat['tmag'], bins=bins, histtype='step', label='Detectados')
plt.hist(transients['mag'], bins=bins, histtype='step', label='Simulados')
plt.legend(loc='best')
plt.xlim(14, 24)
plt.ylim(0, 30)
Out[59]:
In [60]:
norm = ImageNormalize(Scorr.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(10, 9))
plt.imshow(np.ma.MaskedArray(Scorr.real, mask=mask),
cmap=palette, norm=norm, interpolation='none')
plt.tick_params(labelsize=16)
plt.colorbar(orientation='horizontal', shrink=0.7).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
plt.scatter(cat['tx'], cat['ty'], s=1000/cat['tmag'], facecolor='b', edgecolors='none')
plt.tight_layout()
#plt.savefig(os.path.join(plots_path, 'scorr_diff_beta_shift_kl.png'))
In [61]:
sstd = np.std(Scorr.real)
In [62]:
norm = ImageNormalize(Scorr.real, interval=ZScaleInterval(),
stretch=LinearStretch())
plt.figure(figsize=(10, 9))
plt.imshow(np.ma.MaskedArray(Scorr.real, mask=mask)>1.5*sstd,
cmap='Blues', interpolation='none')
plt.tick_params(labelsize=16)
#plt.colorbar(orientation='horizontal', shrink=0.7).ax.tick_params(labelsize=16)
plt.scatter(transients['x'], transients['y'], s=1200/transients['mag'], facecolor='none', edgecolors='r')
#plt.scatter(cat['tx'], cat['ty'], s=1000/cat['tmag'], facecolor='b', edgecolors='none')
plt.tight_layout()
#plt.savefig(os.path.join(plots_path, 'scorr_diff_beta_shift_kl.png'))
In [ ]: