Skip to content

Commit

Permalink
Validate numbers instead of ints
Browse files Browse the repository at this point in the history
For reasons unclear to me, validation is performed before set_parsing,
making the latter obsolete if validation for the set_parser type
  • Loading branch information
thangleiter committed Oct 19, 2023
1 parent 79576e3 commit d601bc2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qcodes_contrib_drivers/drivers/Horiba/Horiba_FHR.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def __init__(self, parent: InstrumentBase, name: str, cli, handle,
get_cmd=self._get_position,
set_cmd=self._set_position,
set_parser=int,
vals=validators.Ints(min_value, max_value),
vals=validators.Numbers(min_value, max_value),
unit=self.unit)

@property
Expand Down Expand Up @@ -242,6 +242,7 @@ def __init__(self, parent: InstrumentBase, name: str, cli, handle,
self.add_parameter('position',
label=f'{label} position',
get_cmd=False,
set_parser=int,
set_cmd=self._set_position,
val_mapping=val_mapping)

Expand All @@ -264,7 +265,7 @@ def __init__(self, parent: InstrumentBase, name: str, cli, handle,
set_cmd=self._set_width,
set_parser=int,
unit=self.unit,
vals=validators.Ints(min_value, max_value),
vals=validators.Numbers(min_value, max_value),
docstring="Actual slit opening width")

@property
Expand Down

0 comments on commit d601bc2

Please sign in to comment.