diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/workflows.yml similarity index 100% rename from .github/workflows/pre-commit.yml rename to .github/workflows/workflows.yml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 48ee030..45ebbb2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,17 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v5.0.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace + - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 24.10.0 hooks: - id: black + +- repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell diff --git a/README.md b/README.md index 8f8d66b..c41a975 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ The step size of a specific stage is given in um for translation stages and deg |---------|-------------|-----------|-----------|-----------| | `init` | `Init.` | Initialize motor stage. Powering and resetting the motor. Set motor move speed in the PIStageInterface.py function.| motor_name (str): name of the motorstage | - | | `move` | `Input rel.` | Moves the motor stage a relative amount, positive values for ahead, negatives for back. Accepts string inputs with units (4cm, -2mm...). If no unit is given, the motor moves the default unit amount. | motor_name (str): name of the motorstage | a (str): Move amount | -| `moveto` | `input abs.` | Moves the motor stage to a absolut position. Accepts string inputs with units (4cm, -2mm...). If no unit is given, the motor moves to the default position unit. | motor_name (str): name of the motorstage |a (str): Move to position | +| `moveto` | `input abs.` | Moves the motor stage to an absolute position. Accepts string inputs with units (4cm, -2mm...). If no unit is given, the motor moves to the default position unit. | motor_name (str): name of the motorstage |a (str): Move to position | | `pos` | - | Logs the current position of the motor stage.| motor_name (str): name of the motorstage | -| | `stop` | `Stop` | Immediately stops all movement of the stage | motor_name (str): name of the motorstage | - | | `sethome` | `Set Zero` | Sets the current position of the stage as new origin | motor_name (str): name of the motorstage | - | diff --git a/motor_stage_ui/PIStagesInterface.py b/motor_stage_ui/PIStagesInterface.py index bef722a..4843d59 100644 --- a/motor_stage_ui/PIStagesInterface.py +++ b/motor_stage_ui/PIStagesInterface.py @@ -12,7 +12,7 @@ class PIStagesInterface: def __init__( self, port: str, - baud_rate: int = "9600", + baud_rate: int = 9600, parity: str = "N", terminator: str = "\r", timeout: float = 2, @@ -115,7 +115,7 @@ def init_motor(self, address: int, logic: str = None) -> None: self.set_velocity(address, self.velocity) time.sleep(0.1) - logging.info("Inititialized motorstage with address: %i" % address) + logging.info("Initialized motorstage with address: %i" % address) def motor_on(self, address=None): self._write_command("MN", address) @@ -154,7 +154,7 @@ def set_home(self, address: int) -> None: self.log.info("Set Home for motorstage with address: %i" % (address)) def go_home(self, address: int) -> None: - """Moves the motorstage to the absolut zero position. + """Moves the motorstage to the absolute zero position. Args: address (int): Address of the motorstage @@ -177,14 +177,14 @@ def move_to_position( """Moves the motor stage absolute position. Accepts string inputs with units (4cm, -2mm...). If no unit is given, the motor moves the default unit amount. The unit inputs are converted using the pint package into the according motor controller steps. - Carefull stepsize depends on motorstage and powering. Deviations can also occure from weight on stage usw. + Careful stepsize depends on motorstage and powering. Deviations can also occur from weight on stage usw. Args: address (int): Address of the motorstage amount (str): absolute position unit (str): input unit - stage (int): stage type eather 'rotation' or translation - step_size (float): step size of the motorstage given in deg or um respectivly + stage (int): stage type either 'rotation' or translation + step_size (float): step size of the motorstage given in deg or um respectively """ try: if amount != "" and stage in ["translation", "rotation"]: @@ -201,14 +201,14 @@ def move_relative( """Moves the motor stage relative amount, positive values for ahead, negatives for back. Accepts string inputs with units (4cm, -2mm...). If no unit is given, the motor moves the default unit amount. The unit inputs are converted using the pint package into the according motor controller steps. - Carefull stepsize depends on motorstage and powering. Deviations can also occure from weight on stage usw. + Careful stepsize depends on motorstage and powering. Deviations can also occur from weight on stage usw. Args: address (int): Address of the motorstage amount (str): absolute position unit (str): input unit - stage (int): stage type eather 'rotation' or translation - step_size (float): step size of the motorstage given in deg or um respectivly + stage (int): stage type either 'rotation' or translation + step_size (float): step size of the motorstage given in deg or um respectively """ try: if amount != "" and stage in ["translation", "rotation"]: @@ -227,11 +227,11 @@ def get_position( Args: address (int): Address of the motorstage unit (str): output unit - stage (int): stage type eather 'rotation' or translation - step_size (int): step size of the motorstage given in deg or um respectivly + stage (int): stage type either 'rotation' or translation + step_size (int): step size of the motorstage given in deg or um Returns: - str: current position of motorstage in unit 3 digits precision + str: current position of motorstage in unit 3 digits precision respectively """ if stage in ["translation", "rotation"]: if stage == "translation": diff --git a/motor_stage_ui/configuration.yaml b/motor_stage_ui/configuration.yaml index b6a4b85..3549cbd 100644 --- a/motor_stage_ui/configuration.yaml +++ b/motor_stage_ui/configuration.yaml @@ -17,7 +17,7 @@ x_axis: step_size: 0.018 unit: mm port: '/dev/ttyUSB0' - baud_rate: '9600' + baud_rate: 9600 y_axis: stage_type: translation @@ -25,7 +25,7 @@ y_axis: step_size: 0.018 unit: mm port: '/dev/ttyUSB0' - baud_rate: '9600' + baud_rate: 9600 rot: stage_type: rotation @@ -33,4 +33,4 @@ rot: step_size: 34e-06 unit: deg port: '/dev/ttyUSB0' - baud_rate: '9600' + baud_rate: 9600 diff --git a/motor_stage_ui/motor_stage_gui.py b/motor_stage_ui/motor_stage_gui.py index a46fa53..2544436 100644 --- a/motor_stage_ui/motor_stage_gui.py +++ b/motor_stage_ui/motor_stage_gui.py @@ -125,7 +125,7 @@ def position_setting( """ Draw GUI """ def labels(self): - """Draws lables above motorstage buttons.""" + """Draws labels above motorstage buttons.""" label = QLabel("Motor", self) label.setAlignment(Qt.AlignCenter) label.resize(100, 20) diff --git a/motor_stage_ui/motor_stage_terminal.py b/motor_stage_ui/motor_stage_terminal.py index 499e515..842a9c2 100644 --- a/motor_stage_ui/motor_stage_terminal.py +++ b/motor_stage_ui/motor_stage_terminal.py @@ -21,7 +21,7 @@ def motor(conf): (also in basil). Args: - conf (str): Needs path to configuration yaml. This path is convertet into a click object and passed to the individual functions. + conf (str): Needs path to configuration yaml. This path is converted into a click object and passed to the individual functions. """ conf.ensure_object(dict) @@ -77,7 +77,7 @@ def move(conf, motor_name: str, a: str): @click.argument("motor_name") @click.option("-a", default="0", help="move value") def moveto(conf, motor_name: str, a: str): - """Moves the motor stage to a absolut position. + """Moves the motor stage to a absolute position. Accepts string inputs with units (4cm, -2mm...). If no unit is given, the motor moves to the default position unit. Args: