def plot_set( fits_list, name ) : images = load_images( fits_list ) fig, axes = plt.subplots(nrows=len(images)/2, ncols=2) for ax, data in zip(axes.flat,images) : im = ax.imshow( data ) fig.subplots_adjust(right=0.9) plt.savefig(name)
def plot_set(fits_list, name, labels=None, cmap_name='viridis', ncols=2): images = load_images(fits_list) print[image.shape for image in images] images = [normalized_positive_image(image) for image in images] fig, axes = plt.subplots(nrows=len(images) / ncols, ncols=ncols) if labels != None: for ax, data, label in zip(axes.flat, images, labels): if args['hog'] != None: data = hog_image(data, label) im = ax.imshow(data, cmap=plt.get_cmap(cmap_name)) if len(label) > 6: plt.text(0.1, 0.9, '%.2f' % float(label), ha='left', va='center', transform=ax.transAxes, fontsize='large', color='white') else: plt.text(0.1, 0.9, label, ha='left', va='center', transform=ax.transAxes, fontsize='large', color='white') ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False) else: for ax, data in zip(axes.flat, images): im = ax.imshow(data, cmap=plt.get_cmap(cmap_name)) ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False) #plt.subplots_adjust(wspace=-0.8, hspace=-0.4) plt.subplots_adjust(wspace=-0.4, hspace=-0.4) print "saving " + name plt.tight_layout() plt.savefig(name, bbox_inches='tight', pad_inches=0)
def data2plot(fitsfiles, name): fitsdata = load_images(fitsfiles) nrows = len(fitsfiles) / 2 return name, nrows, fitsdata, [ hog(fd, visualise=True, **read_hog_kwargs(modeldir)) for fd in fitsdata ]
def data2plot( fitsfiles, name ) : fitsdata = load_images(fitsfiles) nrows = len(fitsfiles)/2 return name, nrows, fitsdata, [hog(fd, visualise=True, **read_hog_kwargs(modeldir)) for fd in fitsdata]