Commit 68dd6506 authored by Daniel Friesel's avatar Daniel Friesel
Browse files

add --histogram option

parent 7f0dd1c8
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -106,6 +106,10 @@ OPTIONS
    Draw power/time plot
  --stat
    Print mean voltage, current, and power as well as total energy consumption.
  --histogram=<n>
    Draw histogram of reported energy values per measurement interval
    (i.e., the differences between each pair of consecutive total energy readings)
    using <n> buckets.

DEPENDENCIES

@@ -141,7 +145,7 @@ def peak_search2(data, lower, upper, check_function):

if __name__ == '__main__':
    try:
        optspec = ('help load= save= skip= threshold= threshold-peakcount= plot stat')
        optspec = ('help load= save= skip= threshold= threshold-peakcount= plot stat histogram=')
        raw_opts, args = getopt.getopt(sys.argv[1:], "", optspec.split(' '))

        for option, parameter in raw_opts:
@@ -309,4 +313,10 @@ if __name__ == '__main__':
        plt.xlabel('Time [s]')
        plt.ylabel('Power [W]')
        plt.grid(True)
        if 'load' in opt:
            plt.title(opt['load'])
        plt.show()

    if 'histogram' in opt:
        plt.hist((data[1:, 3] - data[:-1, 3]) * 1e-9, bins=int(opt['histogram']))
        plt.show()