def testPlotAndStatistics(self):
        """ Check that we can get two plots (resetting the iterator works.)"""
        analyzer = DiffractionAnalysis(input_path=self.__test_data, pattern_indices="all", poissonize=True)

        analyzer.logscale = True
        analyzer.plotPattern(logscale=True)
        analyzer.statistics()
def main(args=None):

    # Setup the object.
    analyzer = DiffractionAnalysis(
        input_path=args.input_path,
        pattern_indices=eval(args.pattern_indices),
        poissonize=eval(args.poissonize),
    )

    # Plot if requested.
    if args.plot:
        analyzer.plotPattern(
            logscale=args.logscale,
            operation=eval(args.operation),
        )
    # Plot if requested.
    if args.radial:
        analyzer.plotRadialProjection(
            logscale=args.logscale,
            operation=eval(args.operation),
        )

    if args.statistics:
        analyzer.statistics()

    plt.show()

    # Animate if requested.
    if args.animation_filename:
        analyzer.animatePatterns(output_path=args.animation_filename)

        print "Animated gif saved to %s." % (
            analyzer._DiffractionAnalysis__animation_output_path)