Skip to content

Commit

Permalink
Merge pull request #11 from qt3uw/105-add-piezo-controller-scale-and-…
Browse files Browse the repository at this point in the history
…range-options-to-qt3scan

issue105 for the piezos and bullet point #3
  • Loading branch information
NnguyenHTommy authored Jun 29, 2023
2 parents 4f77270 + 3785b68 commit e04c1a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
12 changes: 11 additions & 1 deletion src/applications/tkcontrollerapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
help='When true,logger level will be set to warning. Otherwise, set to "info".')
parser.add_argument('-t', '--test', action = 'store_true',
help='This is for development testing.')
parser.add_argument('-pmin', '--piezo-min-position', metavar = 'microns', default = 0, type=float,
help='sets min allowed position on piezo controller.')
parser.add_argument('-pmax', '--piezo-max-position', metavar = 'microns', default = 80, type=float,
help='sets min allowed position on piezo controller.')
parser.add_argument('-pscale', '--piezo-scale-microns-per-volt', default = 8, type=float,
help='sets micron to volt scale for piezo controller.')

args = parser.parse_args()

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -204,7 +211,10 @@ def build_controller():
controller = nipiezojenapy.PiezoControl(device_name = args.daq_name,
write_channels = args.piezo_write_channels.split(','),
read_channels = args.piezo_read_channels.split(','),
move_settle_time = args.settle_time)
move_settle_time = args.settle_time,
min_position = args.piezo_min_position,
max_position = args.piezo_max_position,
scale_microns_per_volt = args.piezo_scale_microns_per_volt)
return controller

def main():
Expand Down
8 changes: 4 additions & 4 deletions src/nipiezojenapy/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
logger = logging.getLogger(__name__)

class BaseControl:
def __init__(self):
self.minimum_allowed_position = 0.00
self.maximum_allowed_position = 80.0
def __init__(self, min_allowed_position = 0.0, max_allowed_position = 80.0):
self.minimum_allowed_position = min_allowed_position
self.maximum_allowed_position = max_allowed_position
self.last_write_values = [0, 0, 0]

def _validate_value(self, position: float) -> None:
Expand Down Expand Up @@ -81,7 +81,7 @@ def __init__(self, device_name: str,
move_settle_time: float = 0.001,
min_position: float = 0.0,
max_position: float = 80.0) -> None:
super().__init__()
super().__init__(min_allowed_position = min_position, max_allowed_position = max_position)

self.device_name = device_name
self.write_channels = write_channels
Expand Down

0 comments on commit e04c1a1

Please sign in to comment.