Skip to content

Commit e532d30

Browse files
Merge branch 'develop' into pr/1100
2 parents ba98107 + 478e217 commit e532d30

File tree

10 files changed

+466
-162
lines changed

10 files changed

+466
-162
lines changed

docs/source/02_user_guide/01_supported_hardware/remote_focus.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,34 @@ Optotune Focus Tunable Lens
112112
113113
------------------
114114

115+
ASI
116+
---
117+
118+
The ASI Tiger Controller has a few limitations for the analog signals. First, the
119+
minimum voltage must be zero volts. Second, the period value needs to be a whole number.
120+
121+
There are two analog waveforms offered, triangle and ramp waves. The triangle waveform is
122+
a periodic analog waveform, with no delay periods. The sawtooth waveform is a periodic
123+
analog waveform with a delay period between each cycle.
124+
125+
.. collapse:: Configuration File
126+
127+
.. code-block:: yaml
128+
129+
microscopes:
130+
microscope_name:
131+
remote_focus_device:
132+
hardware:
133+
type: ASI
134+
axis: A
135+
min: 0
136+
max: 5
137+
port: COM2
138+
baudrate: 9600
139+
|
140+
141+
------------------
142+
115143
Synthetic Remote Focus Device
116144
-----------------------------
117145
If no remote focus device is present, one must configure the software to use a synthetic

src/navigate/config/configuration_database.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,14 @@
435435
remote_focus_device_types = {
436436
"Equipment Solutions": ("EquipmentSolutions", "equipment_solutions"),
437437
"Analog Device": ("NI", "ni"),
438+
"ASI Device": ("ASI", "asi"),
438439
"Virtual Device": ("Synthetic", "synthetic"),
439440
}
440441

441442
remote_focus_hardware_widgets = {
442443
"type": ["Device Type", "Combobox", "string", remote_focus_device_types, None],
443444
"channel": ["DAQ Channel", "Input", "string", None, "Example: PXI6259/ao3"],
445+
"axis": ["Device Type", "Input", "string", None, "Example: A"],
444446
"min": [
445447
"Minimum Voltage",
446448
"Spinbox",

src/navigate/controller/sub_controllers/adaptive_optics.py

Lines changed: 42 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ def __init__(self, view, parent_controller):
6363

6464
self.view.popup.protocol("WM_DELETE_WINDOW", self.view.popup.dismiss)
6565

66-
self.parent_controller.configuration["experiment"]["AdaptiveOpticsParameters"][
67-
"HighlightedMode"
68-
] = None
66+
self.mirror_params = self.parent_controller.configuration["experiment"]["MirrorParameters"]
67+
self.ao_params = self.parent_controller.configuration["experiment"]["AdaptiveOpticsParameters"]
68+
self.tw_params = self.ao_params["TonyWilson"]
69+
70+
self.ao_params["HighlightedMode"] = None
6971

7072
#: list of dicts: list of dicts containing trace data
7173
self.trace_list = []
@@ -79,16 +81,6 @@ def __init__(self, view, parent_controller):
7981
#: dict: dictionary of mode labels
8082
self.mode_labels = self.view.get_labels()
8183

82-
# TODO: just for testing, remove later...
83-
#: list: list of cameras
84-
self.camera_list = self.view.camera_list
85-
self.camera_list[
86-
"values"
87-
] = self.parent_controller.configuration_controller.microscope_list
88-
self.camera_list.bind(
89-
"<<ComboboxSelected>>", lambda evt: self.change_camera(evt)
90-
)
91-
9284
#: Figure: figure for mirror plot
9385
self.fig = self.view.fig
9486

@@ -129,20 +121,27 @@ def __init__(self, view, parent_controller):
129121
"<Leave>", lambda evt: evt.widget.config(background="SystemButtonFace")
130122
)
131123

132-
self.populate_experiment_values()
124+
# update all experiment values each time one is changed
125+
# from navigate.view.custom_widgets.LabelInputWidgetFactory import LabelInput
126+
# for k in self.widgets:
127+
# input = self.widgets[k]
128+
# if type(input) == LabelInput:
129+
# input.widget.bind(
130+
# "<KeyRelease>", self.on_input_change
131+
# )
133132

134-
def change_camera(self, evt):
135-
"""Change the camera to the selected camera
133+
self.widgets["iterations"].widget.bind( "<KeyRelease>", self.on_input_change)
134+
self.widgets["steps"].widget.bind( "<KeyRelease>", self.on_input_change)
135+
self.widgets["amplitude"].widget.bind( "<KeyRelease>", self.on_input_change)
136136

137-
Parameters
138-
----------
139-
evt : Event
140-
The event that triggered this function
141-
"""
142-
# cam_id = evt.widget.get().split("_")[-1]
143-
# self.parent_controller.execute("change_camera", int(cam_id))
144-
cam_name = evt.widget.get()
145-
self.parent_controller.execute("resolution", cam_name)
137+
self.widgets["from"]["button"].bind( "<<ComboboxSelected>>", self.on_input_change)
138+
self.widgets["metric"]["button"].bind( "<<ComboboxSelected>>", self.on_input_change)
139+
self.widgets["fitfunc"]["button"].bind( "<<ComboboxSelected>>", self.on_input_change)
140+
141+
self.populate_experiment_values()
142+
143+
def on_input_change(self, evt):
144+
self.update_experiment_values()
146145

147146
def set_highlighted_mode(self, evt, mode):
148147
"""Set the highlighted mode
@@ -155,7 +154,7 @@ def set_highlighted_mode(self, evt, mode):
155154
The mode to highlight
156155
"""
157156
evt.widget.config(background="red")
158-
self.parent_controller.configuration["experiment"]["AdaptiveOpticsParameters"][
157+
self.ao_params[
159158
"HighlightedMode"
160159
] = mode
161160
self.plot_tw_trace()
@@ -172,11 +171,7 @@ def deselect_all_modes(self):
172171

173172
def populate_experiment_values(self):
174173
"""Populate the experiment values"""
175-
self.camera_list.set(
176-
self.parent_controller.configuration["experiment"]["MicroscopeState"][
177-
"microscope_name"
178-
]
179-
)
174+
180175
self.widgets["save_report"]["variable"].set(
181176
self.parent_controller.configuration["experiment"][
182177
"AdaptiveOpticsParameters"
@@ -217,41 +212,26 @@ def update_experiment_values(self):
217212
modes_dict = {}
218213
coef_list = self.get_coef_from_widgets()
219214
keys = self.view.mode_names
215+
220216
for i, coef in enumerate(coef_list):
221217
modes_dict[keys[i]] = coef
222-
self.parent_controller.configuration["experiment"]["MirrorParameters"][
223-
"modes"
224-
] = modes_dict
225-
226-
self.parent_controller.configuration["experiment"]["AdaptiveOpticsParameters"][
227-
"TonyWilson"
228-
]["iterations"] = int(self.widgets["iterations"].get())
229-
self.parent_controller.configuration["experiment"]["AdaptiveOpticsParameters"][
230-
"TonyWilson"
231-
]["steps"] = int(self.widgets["steps"].get())
232-
self.parent_controller.configuration["experiment"]["AdaptiveOpticsParameters"][
233-
"TonyWilson"
234-
]["amplitude"] = float(self.widgets["amplitude"].get())
235-
self.parent_controller.configuration["experiment"]["AdaptiveOpticsParameters"][
236-
"TonyWilson"
237-
]["from"] = self.widgets["from"]["variable"].get()
238-
self.parent_controller.configuration["experiment"]["AdaptiveOpticsParameters"][
239-
"TonyWilson"
240-
]["metric"] = self.widgets["metric"]["variable"].get()
241-
self.parent_controller.configuration["experiment"]["AdaptiveOpticsParameters"][
242-
"TonyWilson"
243-
]["fitfunc"] = self.widgets["fitfunc"]["variable"].get()
244-
245-
self.parent_controller.configuration["experiment"]["AdaptiveOpticsParameters"][
246-
"save_report"
247-
] = self.widgets["save_report"]["variable"].get()
218+
219+
self.mirror_params["modes"] = modes_dict
248220

249-
for k in self.modes_armed.keys():
250-
self.parent_controller.configuration["experiment"][
251-
"AdaptiveOpticsParameters"
252-
]["TonyWilson"]["modes_armed"][k] = self.modes_armed[k]["variable"].get()
221+
try:
222+
self.tw_params["iterations"] = int(self.widgets["iterations"].get())
223+
self.tw_params["steps"] = int(self.widgets["steps"].get())
224+
self.tw_params["amplitude"] = float(self.widgets["amplitude"].get())
225+
self.tw_params["from"] = self.widgets["from"]["variable"].get()
226+
self.tw_params["metric"] = self.widgets["metric"]["variable"].get()
227+
self.tw_params["fitfunc"] = self.widgets["fitfunc"]["variable"].get()
228+
except ValueError:
229+
pass
230+
231+
self.ao_params["save_report"] = self.widgets["save_report"]["variable"].get()
253232

254-
# print(self.parent_controller.configuration['experiment']['MirrorParameters']['modes'])
233+
for k in self.modes_armed.keys():
234+
self.tw_params["modes_armed"][k] = self.modes_armed[k]["variable"].get()
255235

256236
def get_coef_from_widgets(self):
257237
"""Get the coefficients from the widgets

0 commit comments

Comments
 (0)