Skip to content

Commit f3d7dc7

Browse files
Fix tests, uniform formatting.
1 parent e41b180 commit f3d7dc7

File tree

11 files changed

+52
-111
lines changed

11 files changed

+52
-111
lines changed

src/navigate/controller/sub_controllers/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
from .waveform_popup import WaveformPopupController # noqa
1212
from .autofocus import AutofocusPopupController # noqa
1313
from .features_popup import FeaturePopupController # noqa
14-
from .feature_advanced_setting import (
15-
FeatureAdvancedSettingController, # noqa
16-
)
14+
from .feature_advanced_setting import FeatureAdvancedSettingController # noqa
1715
from .keystrokes import KeystrokeController # noqa
1816
from .multiposition import MultiPositionController # noqa
1917
from .ilastik import IlastikPopupController # noqa

src/navigate/controller/sub_controllers/acquire_bar.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,21 @@ def __init__(self, view, parent_controller):
5454
Parameters
5555
----------
5656
view : object
57-
Instance of the Acquire Bar View.
58-
parent_view : object
59-
Instance of the Main View.
57+
Instance of the View.
6058
parent_controller : object
6159
Instance of the Main Controller.
6260
"""
6361
super().__init__(view, parent_controller)
6462

6563
#: str: Acquisition image mode.
6664
self.mode = "live"
65+
6766
#: bool: Whether the image will be saved.
6867
self.is_save = False
68+
6969
#: bool: Whether the microscope is acquiring.
7070
self.is_acquiring = False
71+
7172
#: dict: Dictionary of different operating modes.
7273
self.mode_dict = {
7374
"Continuous Scan": "live",
@@ -101,10 +102,6 @@ def progress_bar(self, images_received, microscope_state, mode, stop=False):
101102
Number of images received in the controller.
102103
stop : bool
103104
Stop flag to set back to 0.
104-
105-
Examples
106-
--------
107-
>>> progress_bar(0, microscope_state, mode)
108105
"""
109106

110107
if images_received == 0:
@@ -230,10 +227,6 @@ def set_mode(self, mode):
230227
----------
231228
mode: str
232229
Mode could be: 'live', 'z-stack', 'single', 'projection',
233-
234-
Examples
235-
--------
236-
>>> set_mode('live')
237230
"""
238231
# update pull down combobox
239232
reverse_dict = dict(map(lambda v: (v[1], v[0]), self.mode_dict.items()))
@@ -253,10 +246,6 @@ def get_mode(self):
253246
-------
254247
mode : str
255248
Current imaging mode.
256-
257-
Examples
258-
--------
259-
>>> get_mode()
260249
"""
261250
return self.mode
262251

@@ -266,12 +255,7 @@ def add_mode(self, mode):
266255
self.view.pull_down["values"] = list(self.mode_dict.keys())
267256

268257
def stop_acquire(self):
269-
"""Stop the acquisition.
270-
271-
Examples
272-
--------
273-
>>> stop_acquire()
274-
"""
258+
"""Stop the acquisition."""
275259
self.stop_progress_bar()
276260
self.view.acquire_btn.configure(text="Acquire")
277261
self.view.acquire_btn.configure(state="normal")

src/navigate/controller/sub_controllers/camera_map.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,13 @@ def __init__(self, view, parent_controller=None):
6262
Parent controller of this controller.
6363
"""
6464
super().__init__(view, parent_controller)
65+
6566
#: str: Path to the camera maps directory.
6667
self.map_path = os.path.join(get_navigate_path(), "camera_maps")
68+
6769
#: np.ndarray: Offset map.
6870
self.off = None
71+
6972
#: np.ndarray: Variance map.
7073
self.var = None
7174

@@ -79,10 +82,6 @@ def showup(self):
7982
"""Show the popup.
8083
8184
This method is called by the parent controller.
82-
83-
Example
84-
-------
85-
>>> self.parent_controller.show_popup("camera_map_setting_popup")
8685
"""
8786
self.view.showup()
8887

@@ -138,13 +137,11 @@ def display_plot(self):
138137

139138
self.view.axs[0].hist(self.off.ravel(), bins=range(0, 2**8))
140139
self.view.axs[1].hist(self.var.ravel() * 0.47 * 0.47, bins=range(0, 2**8))
141-
142140
self.view.axs[0].set_xlabel("Offset (counts)")
143141
self.view.axs[0].set_ylabel("Frequency")
144142
self.view.axs[0].set_yscale("log")
145143
self.view.axs[1].set_xlabel("Variance (counts$^2$)")
146144
self.view.axs[1].set_ylabel("Frequency")
147145
self.view.axs[1].set_yscale("log")
148146
self.view.fig.tight_layout()
149-
150147
self.view.fig.canvas.draw_idle()

src/navigate/controller/sub_controllers/camera_settings.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,44 +58,59 @@ def __init__(self, view, parent_controller=None):
5858
"""
5959
super().__init__(view, parent_controller)
6060

61-
# default values
6261
#: bool: True if in initialization
6362
self.in_initialization = True
63+
6464
#: str: Resolution value
6565
self.resolution_value = "1x"
66+
6667
#: str: Mode value
6768
self.mode = "stop"
69+
6870
#: str: Solvent type
6971
self.solvent = "BABB"
7072

7173
# Getting Widgets/Buttons
74+
7275
#: dict: Mode widgets
7376
self.mode_widgets = view.camera_mode.get_widgets()
77+
7478
#: dict: Framerate widgets
7579
self.framerate_widgets = view.framerate_info.get_widgets()
80+
7681
#: dict: ROI widgets
7782
self.roi_widgets = view.camera_roi.get_widgets()
83+
7884
#: dict: ROI buttons
7985
self.roi_btns = view.camera_roi.get_buttons()
8086

8187
# initialize
88+
8289
#: int: Default pixel size
8390
self.default_pixel_size = None
91+
8492
#: int: Default width
8593
#: int: Default height
8694
self.default_width, self.default_height = None, None
95+
8796
#: int: Trigger type - 1: Internal, 2: External, 3: Synchronous
8897
self.trigger_source = None
98+
8999
#: int: Trigger active - 1: Edge, 2: Level, 3: Synchronous
90100
self.trigger_active = None
101+
91102
#: int: Readout speed
92103
self.readout_speed = None
104+
93105
#: int: Camera width step interval
94106
self.step_width = 4
107+
95108
#: int: Camera height step interval
96109
self.step_height = 4
110+
97111
#: int: Camera width minimum
98112
self.min_width = 4
113+
99114
#: int: Camera height minimum
100115
self.min_height = 4
101116
self.initialize()
@@ -187,6 +202,7 @@ def populate_experiment_values(self):
187202
self.camera_setting_dict = self.parent_controller.configuration["experiment"][
188203
"CameraParameters"
189204
]
205+
190206
#: dict: Microscope state dictionary
191207
self.microscope_state_dict = self.parent_controller.configuration["experiment"][
192208
"MicroscopeState"

src/navigate/controller/sub_controllers/channels_settings.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ def set_mode(self, mode="stop"):
9898
----------
9999
mode : str
100100
"stop" or "live"
101-
102-
Examples
103-
--------
104-
>>> self.set_mode("live")
105101
"""
106102

107103
self.mode = mode
@@ -127,12 +123,7 @@ def set_mode(self, mode="stop"):
127123
self.view.defocus_spins[i].config(state=state)
128124

129125
def initialize(self):
130-
"""Populates the laser and filter wheel options in the View.
131-
132-
Examples
133-
--------
134-
>>> self.initialize()
135-
"""
126+
"""Populates the laser and filter wheel options in the View."""
136127
setting_dict = self.configuration_controller.channels_info
137128
for i in range(self.num):
138129
self.view.laser_pulldowns[i]["values"] = setting_dict["laser"]
@@ -263,10 +254,6 @@ def channel_callback(self, channel_id, widget_name):
263254
-------
264255
success : bool
265256
Whether the callback function is executed successfully.
266-
267-
Examples
268-
--------
269-
>>> self.channel_callback(0, "laser")
270257
"""
271258

272259
channel_vals = self.get_vals_by_channel(channel_id)
@@ -399,10 +386,6 @@ def get_vals_by_channel(self, index):
399386
-------
400387
dict
401388
The values of the channel widgets.
402-
403-
Examples
404-
--------
405-
>>> self.get_vals_by_channel(0)
406389
"""
407390
if index < 0 or index >= self.num:
408391
return {}
@@ -435,10 +418,6 @@ def get_index(self, dropdown_name, value):
435418
-------
436419
int
437420
The index of the value in the dropdown list.
438-
439-
Examples
440-
--------
441-
>>> self.get_index("laser", "488")
442421
"""
443422
if not value:
444423
return -1

src/navigate/controller/sub_controllers/features_popup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,13 @@ def __init__(self, view, parent_controller, feature_list_id=0):
6969
The id of the feature list, by default 0
7070
"""
7171
super().__init__(view, parent_controller)
72+
7273
#: int: The id of the feature in the feature list.
7374
self.feature_list_id = feature_list_id
75+
7476
#: list: The list of feature names.
7577
self.features = []
78+
7679
#: list: The list of feature structure.
7780
self.feature_structure = []
7881

src/navigate/controller/sub_controllers/ilastik.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,19 @@ def __init__(self, view, parent_controller, service_url):
6363
url of the navigate_server for ilastik
6464
"""
6565
super().__init__(view, parent_controller)
66+
6667
#: str: url of the navigate_server for ilastik
6768
self.service_url = service_url
69+
6870
#: str: ilastik project file name
6971
self.project_filename = None
72+
7073
#: bool: show segmentation flag
7174
self.show_segmentation_flag = False
75+
7276
#: bool: mark position flag
7377
self.mark_position_flag = False
78+
7479
#: dict: label dictionary
7580
self.label_dict = None
7681
self.showup()

src/navigate/controller/sub_controllers/keystrokes.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,17 @@ def __init__(self, main_view, parent_controller):
7171
# Main view
7272
#: tk.Frame: Main view
7373
self.main_view = main_view.root
74+
7475
#: tk.Notebook: Main tabs
7576
self.main_tabs = main_view.settings
7677

7778
# Controllers for all sub frames
7879
#: CameraViewController: Camera View Controller
7980
self.camera_controller = parent_controller.camera_view_controller
81+
8082
#: MultipositionTableController: Multiposition Table Controller
8183
self.multi_controller = parent_controller.multiposition_tab_controller
84+
8285
#: StageController: Stage Controller
8386
self.stage_controller = parent_controller.stage_controller
8487

@@ -133,11 +136,6 @@ def camera_controller_mouse_wheel_enter(self, event):
133136
----------
134137
event : tkinter event
135138
Mouse wheel event
136-
137-
Example
138-
-------
139-
>>> self.camera_view.canvas.bind("<Enter>",
140-
>>> self.camera_controller_mouse_wheel_enter)
141139
"""
142140
self.view.root.unbind("<MouseWheel>") # get rid of scrollbar mousewheel
143141
if platform.system() != "Linux":
@@ -159,11 +157,6 @@ def camera_controller_mouse_wheel_leave(self, event):
159157
----------
160158
event : tkinter event
161159
Mouse wheel event
162-
163-
Example
164-
-------
165-
>>> self.camera_view.canvas.bind("<Leave>",
166-
>>> self.camera_controller_mouse_wheel_leave)
167160
"""
168161

169162
if platform.system() != "Linux":
@@ -182,10 +175,6 @@ def switch_tab(self, event):
182175
----------
183176
event : tkinter event
184177
Tab key event
185-
186-
Example
187-
-------
188-
>>> self.main_view.bind("<Control-Key-1>", self.switch_tab)
189178
"""
190179

191180
key_val = int(event.keysym)
@@ -199,10 +188,6 @@ def widget_undo(self, event):
199188
----------
200189
event : tkinter event
201190
Undo key event
202-
203-
Example
204-
-------
205-
>>> self.main_view.bind_all('<Control-Key-z>', self.widget_undo)
206191
"""
207192
if isinstance(event.widget, ValidatedEntry) or isinstance(
208193
event.widget, ValidatedSpinbox
@@ -216,10 +201,6 @@ def widget_redo(self, event):
216201
----------
217202
event : tkinter event
218203
Redo key event
219-
220-
Example
221-
-------
222-
>>> self.main_view.bind_all('<Control-Key-y>', self.widget_redo)
223204
"""
224205

225206
if isinstance(event.widget, ValidatedEntry) or isinstance(

src/navigate/controller/sub_controllers/microscope_popup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,22 @@ def __init__(self, view, parent_controller, microscope_info):
6565
6666
"""
6767
super().__init__(view, parent_controller)
68+
6869
#: tk.Toplevel-derived: The popup window.
6970
self.view = MicroscopeSettingPopupWindow(view, microscope_info)
71+
7072
#: dict: A dictionary containing the widgets.
7173
self.widgets = self.view.get_widgets()
74+
7275
#: dict: A dictionary containing the variables.
7376
self.variables = self.view.get_variables()
77+
7478
#: dict: A dictionary containing the buttons.
7579
self.buttons = self.view.get_buttons()
80+
7681
#: dict: A dictionary containing the microscope information.
7782
self.microscope_info = microscope_info
83+
7884
#: str: The name of the primary microscope.
7985
self.primary_microscope = None
8086

0 commit comments

Comments
 (0)