In [11]:
from kbmodpy import kbmod as kb
import numpy as np
import matplotlib.pyplot as plt
import os
%matplotlib inline
In [12]:
def run_search(file_list, psf, flags, flag_except, master_flags,
min_lh, min_obs, vel_x, vel_y, radius):
stack = kb.image_stack([kb.layered_image(f) for f in file_list])
stack.apply_mask_flags(flags, flag_except)
stack.apply_master_mask(master_flags, 15)
search = kb.stack_search(stack, psf)
del(stack)
search.set_debug(True)
return search.region_search(vel_x, vel_y, radius, min_lh, min_obs)
In [13]:
def plot(img, lx, ux, ly, uy):
fig = plt.figure(figsize=(12,12))
plt.imshow(img[lx:ux,ly:uy], origin='lower', vmin=-50, vmax=200)#cmap=plt.cm.Greys_r,
plt.xlabel('X Pixels')
plt.ylabel('Y Pixels')
plt.colorbar()
In [14]:
path = '../../fraser/'
In [15]:
max_imgs = 35
In [16]:
files = os.listdir(path)
files = [f for f in files if 'chip' in f]
files.sort()
chip_list = []
for chip in files:
current = []
current = [path+chip+'/'+img for img
in os.listdir(path+chip)][:max_imgs]
current.sort()
chip_list.append(current)
In [17]:
m_flags = ~0 # mask pixels with any flags
flag_exceptions = [32] # unless it has one of these special combinations of flags
mastr_flags = int('100111', 2)
In [18]:
x_v, y_v = 230, 90
rad = 50
minlh = 60.0
minobs = 22
In [19]:
res = run_search(chip_list[5], kb.psf(1.2),
m_flags, flag_exceptions, mastr_flags, minlh, minobs,
x_v, y_v, rad)
In [20]:
res
Out[20]:
In [ ]:
In [ ]: