diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2020-07-06 15:32:32 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2020-07-06 15:32:32 +0200 |
commit | 9bed652910dfd3da3949d63a87b73614a9fd4bbc (patch) | |
tree | fc647cca4eb04185bf8f05466d4941f82b53627f /bin/mimplot | |
parent | 92030c19d7cde49999648509309c3ac6e8b4ba21 (diff) |
blacken more code
Diffstat (limited to 'bin/mimplot')
-rwxr-xr-x | bin/mimplot | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/bin/mimplot b/bin/mimplot index 0d4ba0e..a55a875 100755 --- a/bin/mimplot +++ b/bin/mimplot @@ -14,49 +14,47 @@ from dfatool.utils import running_mean opt = dict() -if __name__ == '__main__': +if __name__ == "__main__": - try: - optspec = ( - 'export= ' - ) + try: + optspec = "export= " - raw_opts, args = getopt.getopt(sys.argv[1:], '', optspec.split()) + raw_opts, args = getopt.getopt(sys.argv[1:], "", optspec.split()) - for option, parameter in raw_opts: - optname = re.sub(r'^--', '', option) - opt[optname] = parameter + for option, parameter in raw_opts: + optname = re.sub(r"^--", "", option) + opt[optname] = parameter - if 'export' in opt: - opt['export'] = list(map(int, opt['export'].split(':'))) + if "export" in opt: + opt["export"] = list(map(int, opt["export"].split(":"))) - except getopt.GetoptError as err: - print(err) - sys.exit(2) + except getopt.GetoptError as err: + print(err) + sys.exit(2) - voltage = float(args[0]) - shunt = float(args[1]) - mimfile = args[2] + voltage = float(args[0]) + shunt = float(args[1]) + mimfile = args[2] - mim = MIMOSA(voltage, shunt) + mim = MIMOSA(voltage, shunt) - charges, triggers = mim.load_file(mimfile) - charges = charges[:3000000] + charges, triggers = mim.load_file(mimfile) + charges = charges[:3000000] - currents = running_mean(mim.charge_to_current_nocal(charges), 10) * 1e-6 - powers = currents * voltage - xr = np.arange(len(currents)) * 1e-5 + currents = running_mean(mim.charge_to_current_nocal(charges), 10) * 1e-6 + powers = currents * voltage + xr = np.arange(len(currents)) * 1e-5 - if 'export' in opt: - xr = xr[opt['export'][0] : opt['export'][1]] - currents = currents[opt['export'][0] : opt['export'][1]] - powers = powers[opt['export'][0] : opt['export'][1]] + if "export" in opt: + xr = xr[opt["export"][0] : opt["export"][1]] + currents = currents[opt["export"][0] : opt["export"][1]] + powers = powers[opt["export"][0] : opt["export"][1]] - for pair in zip(xr, powers): - print('{} {}'.format(*pair)) + for pair in zip(xr, powers): + print("{} {}".format(*pair)) - plt.plot( xr, powers, "r-") - plt.xlabel('Time [s]') - plt.ylabel('Power [W]') - plt.grid(True) - plt.show() + plt.plot(xr, powers, "r-") + plt.xlabel("Time [s]") + plt.ylabel("Power [W]") + plt.grid(True) + plt.show() |