parser.add_argument("--load",metavar="FILE",type=str,help="Load data from FILE")
parser.add_argument(
"--save",metavar="FILE",type=str,help="Save measurement data in FILE"
)
parser.add_argument(
"--skip",
metavar="COUNT",
type=int,
default=0,
help="Skip COUNT data samples. This is useful to avoid startup code influencing the results of a long-running measurement",
)
parser.add_argument(
"--threshold",
metavar="WATTS",
type=str,
help="Partition data into points with mean power >= WATTS and points with mean power < WATTS, and print some statistics. higher power is handled as peaks, whereas low-power measurements constitute the baseline. If WATTS is 'mean', the mean power of all measurements will be used",
)
parser.add_argument(
"--threshold-peakcount",
metavar="NUM",
type=int,
help="Automatically determine a threshold so that there are exactly NUM peaks. A peaks is a group of consecutive measurements with mean power >= threshold. WARNING: In general, there is more than one threshold value leading to exactly NUM peaks. If the difference between baseline and peak power is sufficiently high, this option should do what you mean[tm]",
)
parser.add_argument(
"--plot",
metavar="UNIT",
choices=["U","I","P"],
help="Plot voltage / current / power over time",
)
parser.add_argument(
"--stat",
action="store_true",
help="Print mean voltage, current, and power as well as total energy consumption",
)
parser.add_argument(
"--histogram",
metavar="N",
type=int,
help="Draw histograms of reported energy values per measurement interval (i.e., the differences between each pair of consecutive total energy readings), measurement interval duration, and mean power values per measurement interval (calculated from energy difference and duration). Each histogram uses N buckets",
)
parser.add_argument(
"duration",type=int,nargs="?",help="Measurement duration in seconds"
)
if"help"inopt:
show_help()
sys.exit(0)
args=parser.parse_args()
ifnot"load"inopt:
duration=int(args[0])
ifargs.loadisNoneandargs.durationisNone:
print("Either --load or duration must be specified",file=sys.stderr)