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