blue_non_linear_fact = 0.005


# Read red image
hdulist = pyfits.open(red_fn)
img_header = hdulist[0].header
img_data = hdulist[0].data
hdulist.close()
width=img_data.shape[0]
height=img_data.shape[1]
print "Red file = ", red_fn, "(", width, ",", height, ")"
img_data_r = numpy.array(img_data, dtype=float)
#sky = numpy.median(numpy.ravel(img_data_r))
#sky = numpy.mean(numpy.ravel(img_data_r))
#sky, num_iter = img_scale.sky_median_sig_clip(img_data_r, sig_fract, per_fract, max_iter)
sky, num_iter = img_scale.sky_median_sig_clip(img_data_r, sig_fract, per_fract, max_iter, low_cut=False, high_cut=True)
print "sky = ", sky, "(", num_iter, ") for red image \
(", numpy.max(img_data_r), ",", numpy.min(img_data_r), ")"
img_data_r = img_data_r - sky


# Read green image
hdulist = pyfits.open(green_fn)
img_header = hdulist[0].header
img_data = hdulist[0].data
hdulist.close()
width=img_data.shape[0]
height=img_data.shape[1]
print "Green file = ", green_fn, "(", width, ",", height, ")"
img_data_g = numpy.array(img_data, dtype=float)
#sky = numpy.median(numpy.ravel(img_data_g))
示例#2
0
            ra_target = float(ra_target)
            dec_target = float(dec_target)
            cd=math.cos(dec_target*3.14159/180.) 
            ax["fk5"].plot([ra_target+6*arcmin, ra_target+10*arcmin], [dec_target, dec_target], "r")
            ax["fk5"].plot([ra_target-6*arcmin, ra_target-10*arcmin], [dec_target, dec_target], "r")
            ax["fk5"].plot([ra_target, ra_target], [dec_target+6*arcmin*cd, dec_target+10*arcmin*cd], "r")
            ax["fk5"].plot([ra_target, ra_target], [dec_target-6*arcmin*cd, dec_target-10*arcmin*cd], "r")
            
            # annotate the target
            from matplotlib.patheffects import withStroke
            myeffect = withStroke(foreground="w", linewidth=0)
            kwargs = dict(path_effects=[myeffect])
            ax["fk5"].annotate((target.replace("_"," ")), (ra_target-13*arcmin,dec_target), size=8, ha="left", va="center", **kwargs)
            
            # draw the image
            (sky,niter) = img_scale.sky_median_sig_clip(data,0.01,0.1,10)
            scaled_data = img_scale.sqrt(data,scale_min=sky-300,scale_max=sky+10000)
            ax[h_original].imshow_affine(scaled_data, origin='lower', cmap=plt.cm.gray_r)
            ax.grid()
            grayscale_drawn = True


        # Outline the frame limits. This gets done for all frames.
        i_a, j_a = (0.0 + 1.0), (0.0 + 1.0)
        [ra_a, dec_a], = w_original.wcs_pix2world([[i_a, j_a]], 1)

        i_b, j_b = (float(nx) + 1.0), (0 + 1.0)
        [ra_b, dec_b], = w_original.wcs_pix2world([[i_b, j_b]], 1)

        i_c, j_c = (float(nx) + 1.0), (float(ny) + 1.0)
        [ra_c, dec_c], = w_original.wcs_pix2world([[i_c, j_c]], 1)
#axis_tag = True


# Blue image
hdulist = pyfits.open(blue_fn)
img_header = hdulist[0].header
img_data = hdulist[0].data
hdulist.close()
width=img_data.shape[0]
height=img_data.shape[1]
print "Blue file = ", blue_fn, "(", width, ",", height, ")"
img_data_b = numpy.array(img_data, dtype=float)
rgb_array = numpy.empty((width,height,3), dtype=float)
#sky = numpy.median(numpy.ravel(img_data_b))
#sky = numpy.mean(numpy.ravel(img_data_b))
sky, num_iter = img_scale.sky_median_sig_clip(img_data_b, sig_fract, per_fract, max_iter)
print "sky = ", sky, "(", num_iter, ") for blue image \
(", numpy.max(img_data_b), ",", numpy.min(img_data_b), ")"
img_data_b = img_data_b - sky
b = img_scale.asinh(img_data_b, scale_min = min_val, non_linear=non_linear_fact)

# Green image
hdulist = pyfits.open(green_fn)
img_header = hdulist[0].header
img_data = hdulist[0].data
hdulist.close()
width=img_data.shape[0]
height=img_data.shape[1]
print "Green file = ", green_fn, "(", width, ",", height, ")"
img_data_g = numpy.array(img_data, dtype=float)
#sky = numpy.median(numpy.ravel(img_data_g))
示例#4
0
# Read red image
hdulist = pyfits.open(red_fn)
img_header = hdulist[0].header
img_data = hdulist[0].data
hdulist.close()
width = img_data.shape[0]
height = img_data.shape[1]
print "Red file = ", red_fn, "(", width, ",", height, ")"
img_data_r = numpy.array(img_data, dtype=float)
#sky = numpy.median(numpy.ravel(img_data_r))
#sky = numpy.mean(numpy.ravel(img_data_r))
#sky, num_iter = img_scale.sky_median_sig_clip(img_data_r, sig_fract, per_fract, max_iter)
sky, num_iter = img_scale.sky_median_sig_clip(img_data_r,
                                              sig_fract,
                                              per_fract,
                                              max_iter,
                                              low_cut=False,
                                              high_cut=True)
print "sky = ", sky, "(", num_iter, ") for red image \
(", numpy.max(img_data_r), ",", numpy.min(img_data_r), ")"
img_data_r = img_data_r - sky

# Read green image
hdulist = pyfits.open(green_fn)
img_header = hdulist[0].header
img_data = hdulist[0].data
hdulist.close()
width = img_data.shape[0]
height = img_data.shape[1]
print "Green file = ", green_fn, "(", width, ",", height, ")"
img_data_g = numpy.array(img_data, dtype=float)