from numpy import * import matplotlib from matplotlib.pyplot import * from matplotlib.colors import LogNorm import pyfits # Tools -> Package Manager -> Available -> pyfits from astropy.utils.data import download_file from astropy.io import fits from matplotlib.widgets import Slider from ass import slidershow, makeHRdiag from scipy.misc import imsave ##################################################################################### # Read in a set of images # if images are local, do this... folder = '/Users/rvdb/personal/Trius/16-02-06/' image = array(pyfits.getdata(folder+'m3-RGB-BiasCalib-ColorWts.fit', 0)) ''' # if image is on the web, do something like this... url = 'http://orfe.princeton.edu/~rvdb/FRS_175/python/fits_files/' imagefile = download_file(url+'m15-2016-2015-2013-LRGB.fit', cache=True ) image = array(fits.getdata(imagefile)) ''' close('all') #################################################################################### # Make HR diagram (N,m,n) = image.shape R = image[0,:,:] G = image[1,:,:] B = image[2,:,:] RGB = zeros(3*m*n, dtype=float32).reshape(m,n,3) RGB[:,:,0] = R RGB[:,:,1] = G RGB[:,:,2] = B objname = 'M3' makeHRdiag(RGB, objname, 11.0, 'circ', (669, 581, 515)) ##################################################################################### # Plot image w/ sliderbar slidershow(R + G + B) folder = '/Users/rvdb/personal/sxv/HRdiag/python/' outfile= 'HRdiag_'+objname+'.png' figure(5) savefig(folder+outfile, facecolor='black')