def group_darks(cam, key1, key2): """ Group the dark frames into a nested dictionary of Images, keyed by key1, then key2. """ filenames = darkfiles(cam) images = valid_images(filenames) groups = groupby(images, key1) for key in groups: groups[key] = groupby(groups[key], key2) return groups
def image_sort_example(): """ Sort a bunch of images based on different keys """ files = darkfiles("sbc") images = valid_images(files) image = Image(files[0]) print image.MIN print image.BSCALE sortby(images, "MAX") print [image.MAX for image in images]
def image_sort_example(): """ Sort a bunch of images based on different keys """ files = darkfiles("sbc") images = valid_images(files) image = Image(files[0]) print image.MIN print image.BSCALE sortby(images, "MAX") print[image.MAX for image in images] sortby(images, "MEAN") print[image.MEAN for image in images]