In [16]:
%matplotlib inline
from kbmodpy import kbmod as kb
import numpy as np
import matplotlib.pyplot as plt
In [17]:
p = kb.psf(1.5)
use_regions = False
stamp_size = 10
imcount = 15
image_dim = 2000
noise = 10
object_flux = 150.0
object_x = 100.7
object_y = 150.3
object_xv = 50
object_yv = 35
imlist = []
for i in range(imcount):
imlist.append(kb.layered_image(
"t"+str(i), 1000, 1000, noise, noise*noise, i/imcount))
In [18]:
for im in imlist:
im.add_object(object_x+im.get_time()*object_xv, object_y+im.get_time()*object_yv, object_flux, p)
In [19]:
stack = kb.image_stack(imlist)
del imlist
In [20]:
search = kb.stack_search(stack, p)
del stack
search.set_debug(True)
In [21]:
if use_regions:
results = search.region_search(55, 30, 15, 9.0, 10)
else:
search.gpu( 80, 80, 0.2, 1.0, 50, 75, 10 )
results = search.get_results(0, 10)
In [22]:
results
Out[22]:
In [23]:
stamps = search.sci_stamps(results[0], stamp_size)
In [24]:
fig = plt.figure(figsize=(20, 100))
set_on = 1
plot_count = len(stamps)
print ('Starting at %i' % int((set_on - 1)*plot_count))
for i in range((set_on-1)*plot_count,set_on*plot_count):
fig.add_subplot(25,4,i-(set_on-1)*plot_count+1)
plt.imshow(stamps[i], #cmap=plt.cm.Greys_r,
interpolation=None)
plt.colorbar()
In [25]:
psis, phis = search.lightcurve(results[0])
In [26]:
psis, phis
Out[26]:
In [27]:
#plt.figure(figsize=[12,12])
###imlist[0].convolve(p)
#plt.imshow(imlist[0].science())
#plt.gca().invert_yaxis()
#plt.colorbar()
In [31]:
stacked = np.sum(np.array(s) for s in stamps)
plt.figure(figsize=[12,12])
plt.imshow(stacked)
plt.gca().invert_yaxis()
plt.colorbar()
Out[31]:
In [32]:
stacked2 = search.stacked_sci(results[0], stamp_size)
plt.figure(figsize=[12,12])
plt.imshow(stacked)
plt.gca().invert_yaxis()
plt.colorbar()
Out[32]:
In [34]:
np.sum(stacked-stacked2)
Out[34]:
In [ ]: