To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit a12b72da authored by alisec's avatar alisec
Browse files

fixed line length and removed mention of self.config.model.full_scale_ranges...

fixed line length and removed mention of self.config.model.full_scale_ranges for get/set_full_scale_range_unitless docstring
parent c3442a2f
Pipeline #52513 canceled with stages
......@@ -143,8 +143,9 @@ class PfeifferTPG(SingleCommDevice):
class PressureUnits(NameEnum):
"""
Enum of available pressure units for the digital display. "0" corresponds either to bar or to mbar depending on
the TPG model. In case of doubt, the unit is visible on the digital display.
Enum of available pressure units for the digital display. "0" corresponds either
to bar or to mbar depending on the TPG model. In case of doubt, the unit is
visible on the digital display.
"""
mbar = 0
......@@ -345,19 +346,22 @@ class PfeifferTPG(SingleCommDevice):
def set_full_scale_unitless(self, fsr: List[int]) -> None:
"""
Set the full scale range of the attached sensors. See lookup table between
command and corresponding pressure with self.config.model.full_scale_ranges or
in the device user manual.
command and corresponding pressure in the device user manual.
:param fsr: list of full scale range values, like [0, 1, 3, 3, 2, 0]
:raises SerialCommunicationIOError: when communication port is not opened
"""
wrong_values = [v for v in fsr if v not in self.config.model.full_scale_ranges_reversed]
wrong_values = [v for v in fsr
if v not in self.config.model.full_scale_ranges_reversed]
if len(fsr) != self.number_of_sensors:
raise ValueError(f"Argument fsr should be of length {self.number_of_sensors}. Received length {len(fsr)}.")
raise ValueError(f"Argument fsr should be of length "
f"{self.number_of_sensors}. Received length {len(fsr)}.")
elif wrong_values:
raise ValueError(f"Argument fsr contains invalid values: {wrong_values}. "
f"Accepted values are {list(self.config.model.full_scale_ranges_reversed.keys())}")
raise ValueError(
f"Argument fsr contains invalid values: {wrong_values}. Accepted "
f"values are {list(self.config.model.full_scale_ranges.values())}"
)
str_fsr = ','.join([str(f) for f in fsr])
try:
......@@ -370,8 +374,7 @@ class PfeifferTPG(SingleCommDevice):
def get_full_scale_unitless(self) -> List[int]:
"""
Get the full scale range of the attached sensors. See lookup table between
command and corresponding pressure with self.config.model.full_scale_ranges or
in the device user manual.
command and corresponding pressure in the device user manual.
:return: list of full scale range values, like [0, 1, 3, 3, 2, 0]
:raises SerialCommunicationIOError: when communication port is not opened
......@@ -384,11 +387,14 @@ class PfeifferTPG(SingleCommDevice):
raise
wrong_values = [v for v in answer.split(',')
if not v.isdigit() or int(v) not in self.config.model.full_scale_ranges_reversed]
if not v.isdigit()
or int(v) not in self.config.model.full_scale_ranges_reversed]
if wrong_values:
raise PfeifferTPGError(f"The controller returned the full scale range values: {answer}. The values "
f"{wrong_values} are invalid. Accepted values are "
f"{list(self.config.model.full_scale_ranges_reversed.keys())}.")
raise PfeifferTPGError(
f"The controller returned the full scale range values: {answer}. The "
f"values {wrong_values} are invalid. Accepted values are "
f"{list(self.config.model.full_scale_ranges.values())}."
)
fsr = [int(i) for i in answer.split(',')]
logging.info(f"Obtained full scale range of all sensors as {fsr}.")
......@@ -404,10 +410,14 @@ class PfeifferTPG(SingleCommDevice):
wrong_values = [v for v in fsr if v not in self.config.model.full_scale_ranges]
if len(fsr) != self.number_of_sensors:
raise ValueError(f"Argument fsr should be of length {self.number_of_sensors}. Received length {len(fsr)}.")
raise ValueError(
f"Argument fsr should be of length {self.number_of_sensors}. "
f"Received length {len(fsr)}.")
elif wrong_values:
raise ValueError(f"Argument fsr contains invalid values: {wrong_values}. "
f"Accepted values are {list(self.config.model.full_scale_ranges.keys())}")
raise ValueError(
f"Argument fsr contains invalid values: {wrong_values}. Accepted "
f"values are {list(self.config.model.full_scale_ranges.keys())}"
)
str_fsr = ','.join([str(self.config.model.full_scale_ranges[f]) for f in fsr])
......@@ -433,11 +443,14 @@ class PfeifferTPG(SingleCommDevice):
raise
wrong_values = [v for v in answer.split(',')
if not v.isdigit() or int(v) not in self.config.model.full_scale_ranges_reversed]
if not v.isdigit()
or int(v) not in self.config.model.full_scale_ranges_reversed]
if wrong_values:
raise PfeifferTPGError(f"The controller returned the full scale range values: {answer}. The values "
f"{wrong_values} are invalid. Accepted values are "
f"{list(self.config.model.full_scale_ranges_reversed.keys())}.")
raise PfeifferTPGError(
f"The controller returned the full scale range values: {answer}. The "
f"values {wrong_values} are invalid. Accepted values are "
f"{list(self.config.model.full_scale_ranges_reversed.keys())}."
)
fsr = [self.config.model.full_scale_ranges_reversed[int(i)]
for i in answer.split(',')]
......
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