def _merge_images(pathbuilder, configs): merged_image = None compare_pb = pathbuilder.clone(build=output.DEFAULT_BUILD_NAME) for c in configs: pb = compare_pb.clone(config=c) tagimage = image.normalize_img(pb.tagimage) image.add_label(image=tagimage, label=c) if not merged_image: merged_image = tagimage else: merged_image = image.merge_images(merged_image, tagimage) return merged_image
def __write_merged_image(file1, file2, diff, jobname): assert os.path.exists(file1), "file1 doesn't exist at path {}".format(file1) assert os.path.exists(file2), "file2 doesn't exist at path {}".format(file2) assert isinstance(jobname, basestring), "jobname is not a string!" compare_name = __get_compare_name(file1, file2) # Generate additional info in output mergedimg = image.merge_images(file1, file2) info = {"name": compare_name, "diff": diff} mergedimg2 = image.add_info(mergedimg, info) compare_dir = output.COMPARE_PATH build_dir = os.path.join(compare_dir, jobname) if not os.path.exists(build_dir): os.makedirs(build_dir) merged_path = os.path.join(build_dir, compare_name + ".png") LOGGER.debug("Writing merged image file at %s", merged_path) mergedimg2.save(open(merged_path, 'wb')) LOGGER.warning("%s produced diff=%s", compare_name, diff)
import image #open fits file img = image.open_fits_file('http://data.astropy.org/tutorials/FITS-images/HorseHead.fits') #print details of file image.print_img_details(img) #extract samples samples = image.extract_samples(img, 200, 10) #reconstruct image reconstruct = image.reconstruct_samples(samples, img.shape, 10) #reconstruct image with standard deviation samples reconstruct_stdev = image.calculate_stdev(samples, img.shape, 10) #overlay stdev samples over image image.merge_images(img, reconstruct_stdev) #animation with standard deviation image.slicing_animation(img, 100, 10)