Exemplo n.º 1
0
            continue

        header.append(filename)
        infile = open(filename, "r")

        h = []
        while 1:

            line = infile.readline()
            if not line: break

            if line[0] == "#": continue

            if not re.match("(\d+)", line): continue

            data = map(string.atof, re.split("\s+", line[:-1]))

            h.append((data[0], tuple(data[1:])))

        infile.close()

        histograms.append(h)

    print "# bin\t" + string.join(header, "\t\t")
    ch = Histogram.Combine(histograms)
    Histogram.Print(ch)

    ch = Histogram.Normalize(ch)
    print "# bin\t" + string.join(header, "\t\t")
    Histogram.Print(ch)
Exemplo n.º 2
0
            if options.loglevel >= 1:
                options.stdlog.write("# column=%i, num_values=%i\n" %
                                     (options.columns[x], len(vals[x])))

            if len(vals[x]) < options.min_data: continue

            h = Histogram.Calculate(
                vals[x],
                no_empty_bins=options.no_empty_bins,
                increment=options.bin_size,
                min_value=options.min_value,
                max_value=options.max_value,
                dynamic_bins=options.dynamic_bins,
                ignore_out_of_range=options.ignore_out_of_range)

            if options.normalize: h = Histogram.Normalize(h)
            if options.cumulative: h = Histogram.Cumulate(h)
            if options.reverse_cumulative:
                h = Histogram.Cumulate(h, direction=0)

            hists.append(h)

            for m in options.append:
                if m == "normalize":
                    hists.append(Histogram.Normalize(h))

            if options.headers:
                titles.append(options.headers[x])
            elif options.titles:
                titles.append(options.titles[x])
            else: