Exemplo n.º 1
0
def pos_im(fitsfile, output, waverange, threshold=0.1):

    wave, data = get_data(fitsfile)
    widx = np.where((wave >= waverange[0]) & (wave >= waverange[1]))
    smoosh = np.sum(data[widx], axis=0)
    color_smoosh = np.repeat(smoosh[:,:,None],4,axis=2)
    uppercut = np.mean(color_smoosh) + np.std(color_smoosh)*6

    cidx = np.where(color_smoosh > uppercut)
    color_smoosh -= np.min(color_smoosh)
    color_smoosh[cidx] = np.max(color_smoosh)
    color_smoosh /= np.max(color_smoosh)
    color_smoosh[:,:,3] = 1.0

    tidx = np.where(color_smoosh[:,:,0] < threshold)

    color = np.repeat(np.repeat(np.r_[RGB.rgb(np.mean(waverange)),1][None,None,:],smoosh.shape[0],axis=0),
                      smoosh.shape[1],axis=1)
    #color[:,:,3][tidx] = 0

    norm = color*trans(color_smoosh)*255
    image = Image.fromarray(norm.astype(np.uint8))
    image.save(output)

    return norm
Exemplo n.º 2
0
def get_color_overlay(wave):

    c = [np.r_[RGB.rgb(w),1] for w in wave]
    return np.vstack(c)