Skip to content

Commit

Permalink
Fix typos and bool comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Gsponer committed Sep 5, 2024
1 parent 054149d commit 63a78bd
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/comet/driver/nkt_photonics/pilas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class PILAS(Driver):
"""Class for controllingNKT Photonics PILAS picosecond pulsed diode laser"""
"""Class for controlling NKT Photonics PILAS picosecond pulsed diode laser"""

OUTPUT_ON: bool = True
OUTPUT_OFF: bool = False
Expand All @@ -27,7 +27,7 @@ def identify(self) -> str:
def output(self) -> bool:
response = self.query_value("ld?")

return True if response == "on" else False
return response == "on"

@output.setter
def output(self, state: bool) -> None:
Expand All @@ -38,7 +38,7 @@ def output(self, state: bool) -> None:
def tune_mode(self) -> bool:
response = self.query_value("tm?")

return True if response == "auto" else False
return response == "auto"

@tune_mode.setter
def tune_mode(self, state: bool) -> None:
Expand All @@ -54,8 +54,7 @@ def tune(self, value: float) -> None:
if value < 0 or value > 100:
raise ValueError("Tune value must be between 0 and 100")

if self.tune_mode != self.TUNE_MANUAL:
self.tune_mode = self.TUNE_MANUAL
self.tune_mode = self.TUNE_MANUAL

self.write_and_check(f"tune={int(value*10)}")

Expand All @@ -76,11 +75,7 @@ def get_laser_head_temperature(self) -> float:

def get_laser_diode_temperature(self) -> bool:
response = self.query_value("ldtemp?")
return (
self.DIODE_TEMPERATURE_GOOD
if response == "good"
else self.DIODE_TEMPERATURE_BAD
)
return response == "good"

# helper
def query_value(self, command: str) -> str:
Expand Down

0 comments on commit 63a78bd

Please sign in to comment.