Commit 882169076da by Pierre Augier

black, version 19.10b0

parent bd947f297e1
Pipeline #3719 passed with stage
in 1 minute 54 seconds
......@@ -196,7 +196,9 @@ class Value(SuperValue):
if self.channel_argument:
# here we don't call _convert_as_str to allow the user to choose
# the desired format in the command_set string
command = self.command_set.format(channel=channel, value=self._convert_as_str(value))
command = self.command_set.format(
channel=channel, value=self._convert_as_str(value)
)
else:
command = self.command_set + " " + self._convert_as_str(value)
self._interface.write(command)
......
......@@ -29,8 +29,10 @@ class HP33120a(IEC60488, Trigger):
burst count / carrier frequency <= 500 seconds
"""
if freq <= 100.0 and ncycles/freq > 500.0:
raise ValueError("For freq <= 100 Hz, ncycles/freq must be <= 500 seconds")
if freq <= 100.0 and ncycles / freq > 500.0:
raise ValueError(
"For freq <= 100 Hz, ncycles/freq must be <= 500 seconds"
)
if ncycles > 50000:
raise ValueError("Maximum count number is 50000")
self.interface.write("OUTP:LOAD INF")
......
......@@ -14,6 +14,7 @@ from fluidlab.instruments.iec60488 import IEC60488
from fluidlab.instruments.features import FloatValue, BoolValue
from fluidlab.interfaces import PhysicalInterfaceType
class TtiCpx400dpUnitValue(FloatValue):
def _convert_from_str(self, value):
index_v = value.find("V")
......@@ -53,6 +54,7 @@ class TtiCpx400dp(IEC60488):
v = tti.vdc.get(channel=1)
print(v)
"""
# the default params below are for use with Serial connection (RS-232 or USB)
# they are ignored by the GPIBInterface, VISAInterface and SocketInterface
# classes.
......@@ -69,6 +71,7 @@ class TtiCpx400dp(IEC60488):
"use_readlines": False,
}
features = [
TtiCpx400dpUnitValue(
"vdc",
......
......@@ -103,7 +103,7 @@ def interface_classname_from_string(
elif isinstance(name, (ipaddress.IPv4Address, ipaddress.IPv6Address)):
name = str(name)
physical_interface = PhysicalInterfaceType.Ethernet
elif name.startswith('/dev/tty'):
elif name.startswith("/dev/tty"):
physical_interface = PhysicalInterfaceType.Serial
classname = "SerialInterface"
else:
......
......@@ -99,7 +99,9 @@ class SerialInterface(QueryInterface):
return self.ser_io.write(*args)
else:
for a in args:
self.serial_port.write(a.encode('ascii') + self.eol.encode('ascii'))
self.serial_port.write(
a.encode("ascii") + self.eol.encode("ascii")
)
else:
# ensure no unicode strings sent to serial_port.write
args = [a.encode("ascii") if isinstance(a, str) else a for a in args]
......@@ -130,7 +132,7 @@ class SerialInterface(QueryInterface):
def _read(self):
if not self.use_readlines:
iw = self.serial_port.inWaiting()
data = self.serial_port.read(iw).decode('ascii')
data = self.serial_port.read(iw).decode("ascii")
return data
if self.multilines:
......
......@@ -47,7 +47,9 @@ class SocketInterface(QueryInterface):
class UDPSocketInterface(SocketInterface):
def __init__(self, ip_address, in_port, out_port, autoremove_eol=True, **kwargs):
def __init__(
self, ip_address, in_port, out_port, autoremove_eol=True, **kwargs
):
super().__init__(ip_address, autoremove_eol)
if callable(in_port):
self.in_port = in_port(ip_address)
......
......@@ -90,9 +90,13 @@ class MSCTIProbe:
self.fit_rho_vs_voltrho(rho_old, voltrho_old)
if self._has_temp:
rho_old, voltrho_old, T_old, voltT_old, date_old = self.load_calibration(
"T"
)
(
rho_old,
voltrho_old,
T_old,
voltT_old,
date_old,
) = self.load_calibration("T")
if _isarray(rho_old) and rho_old.size > 1:
self.fit_T_vs_voltT(T_old, voltT_old)
......@@ -192,9 +196,13 @@ class MSCTIProbe:
if os.path.exists(self.files_calib[0] + ".h5"):
f["calibration/file_calibration_rho"] = self.files_calib[0]
if not hasattr(self, "coeffs_rho"):
rho_old, voltrho_old, T_old, voltT_old, date_old = self.load_calibration(
"rho"
)
(
rho_old,
voltrho_old,
T_old,
voltT_old,
date_old,
) = self.load_calibration("rho")
if _isarray(rho_old) and rho_old.size >= 1:
self.fit_rho_vs_voltrho(rho_old, voltrho_old)
f["calibration/coeffsrho"] = self.coeffsrho
......@@ -204,9 +212,13 @@ class MSCTIProbe:
if self._has_temp and os.path.exists(self.files_calib[1] + ".h5"):
f["calibration/file_calibration_T"] = self.files_calib[1]
if not hasattr(self, "coeffs_T"):
rho_old, voltrho_old, T_old, voltT_old, date_old = self.load_calibration(
"T"
)
(
rho_old,
voltrho_old,
T_old,
voltT_old,
date_old,
) = self.load_calibration("T")
if _isarray(rho_old) and rho_old.size >= 1:
self.fit_T_vs_voltT(T_old, voltT_old)
f["calibration/coeffsT"] = self.coeffsT
......
......@@ -95,9 +95,13 @@ if __name__ == "__main__":
delta_t = 0.5
n = 256
times1, volts1, time_expo, delta_t, time_between_nodes = make_signal_double_frame(
time_between_pairs, time_expo, delta_t, n
)
(
times1,
volts1,
time_expo,
delta_t,
time_between_nodes,
) = make_signal_double_frame(time_between_pairs, time_expo, delta_t, n)
import matplotlib.pyplot as plt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment