def __init__(self, filename, remove_bkg='constant', bkg_box_size=50,
contour_threshold=3., min_points=10, shape_cut=0.2,
area_cut=10., radius_dev_cut=0.5, connectivity_angle=3.,
output_path=None):
hdulist = fits.open(filename)
raw_image = hdulist[0].data.astype(np.float64)
hdulist.close()
# Raw image.
self.raw_image = raw_image
# Background structure and background map
self._bkg = None
self.background_map = None
# Background removed image.
self.image = None
# Raw edges
self.raw_borders = None
# Filtered edges, so streak, by their morphologies and
# also connected (i.e. linked) by their slope.
self.streaks = None
# Statistics for the image data.
self._med = None
self._std = None
# Other variables.
remove_bkg_options = ('constant', 'map')
if remove_bkg not in remove_bkg_options:
raise RuntimeError('"remove_bkg" must be the one among: %s' %
', '.join(remove_bkg_options))
self.remove_bkg = remove_bkg
self.bkg_box_size = bkg_box_size
self.contour_threshold = contour_threshold
# These variables for the edge detections and linking.
self.min_points = min_points
self.shape_cut = shape_cut
self.area_cut = area_cut
self.radius_dev_cut = radius_dev_cut
self.connectivity_angle = connectivity_angle
# Set output path.
if output_path is None:
output_path = './%s/' % \
('.'.join(os.path.basename(filename).split('.')[:-1]))
if output_path[-1] != '/':
output_path += '/'
self.output_path = output_path
# For plotting.
pl.rcParams['figure.figsize'] = [12, 9]
评论列表
文章目录