Skip to content

Commit 4b37039

Browse files
Merge pull request #933 from TheDeanLab/refactor_naming
Refactor naming
2 parents 14af024 + 273eaa8 commit 4b37039

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+498
-524
lines changed

src/navigate/controller/sub_controllers/multi_position_controller.py

Lines changed: 11 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
# Third Party Imports
3939
import pandas as pd
40-
from pandastable import TableModel
4140

4241
# Local Imports
4342
from navigate.controller.sub_controllers.gui_controller import GUIController
@@ -64,6 +63,7 @@ def __init__(self, view, parent_controller=None):
6463
super().__init__(view, parent_controller)
6564
#: MultiPositionTable: Multi-Position Acquisition Interface
6665
self.table = self.view.pt
66+
6767
# self.table.rowheader.bind("<Double-Button-1>", self.handle_double_click)
6868
self.table.loadCSV = self.load_positions
6969
self.table.exportCSV = self.export_positions
@@ -88,7 +88,6 @@ def __init__(self, view, parent_controller=None):
8888

8989
def eliminate_tiles(self):
9090
"""Eliminate tiles that do not contain tissue."""
91-
9291
self.parent_controller.execute("eliminate_tiles")
9392

9493
def set_positions(self, positions):
@@ -98,14 +97,6 @@ def set_positions(self, positions):
9897
----------
9998
positions : [[]]
10099
positions to be set
101-
102-
Example
103-
-------
104-
>>> positions = [
105-
>>> [0, 0, 0, 0, 0],
106-
>>> [1, 1, 1, 1, 1],
107-
>>> [2, 2, 2, 2, 2]]
108-
>>> set_positions(positions)
109100
"""
110101
axis_dict = {"x": "X", "y": "Y", "z": "Z", "theta": "R", "f": "F"}
111102
data = {}
@@ -125,18 +116,19 @@ def get_positions(self):
125116
-------
126117
list
127118
positions in the format of [[x, y, z, theta, f], ]
128-
129-
Example
130-
-------
131-
>>> get_positions()
132119
"""
133120
positions = []
134121
rows = self.table.model.df.shape[0]
135122
for i in range(rows):
136123
temp = list(self.table.model.df.iloc[i])
137124
if (
138125
len(
139-
list(filter(lambda v: type(v) in (float, int) and not math.isnan(v), temp))
126+
list(
127+
filter(
128+
lambda v: type(v) in (float, int) and not math.isnan(v),
129+
temp,
130+
)
131+
)
140132
)
141133
== 5
142134
):
@@ -167,7 +159,7 @@ def handle_double_click(self, event):
167159
if list(filter(lambda v: type(v) != int and type(v) != float, temp)):
168160
messagebox.showwarning(
169161
title="Warning",
170-
message="The selected position is invalid, can't go to this position!"
162+
message="The selected position is invalid, can't go to this position!",
171163
)
172164
logger.info("position is invalid")
173165
return
@@ -188,21 +180,13 @@ def get_position_num(self):
188180
-------
189181
int
190182
number of positions
191-
192-
Example
193-
-------
194-
>>> get_position_num()
195183
"""
196184
return self.table.model.df.shape[0]
197185

198186
def load_positions(self):
199187
"""Load a csv file.
200188
201189
The valid csv file should contain the line of headers ['X', 'Y', 'Z', 'R', 'F']
202-
203-
Example
204-
-------
205-
>>> load_positions()
206190
"""
207191
filename = filedialog.askopenfilenames(
208192
defaultextension=".csv",
@@ -217,7 +201,7 @@ def load_positions(self):
217201
if not cmp_header.all():
218202
messagebox.showwarning(
219203
title="Warning",
220-
message="The csv file isn't right, it should contain [X, Y, Z, R, F]"
204+
message="The csv file isn't right, it should contain [X, Y, Z, R, F]",
221205
)
222206
logger.info("The csv file isn't right, it should contain [X, Y, Z, R, F]")
223207
return
@@ -235,10 +219,6 @@ def export_positions(self):
235219
236220
This function opens a dialog that let the user input a filename
237221
Then, it will export positions to that csv file
238-
239-
Example
240-
-------
241-
>>> export_positions()
242222
"""
243223
filename = filedialog.asksaveasfilename(
244224
defaultextension=".csv",
@@ -250,23 +230,13 @@ def export_positions(self):
250230
self.show_verbose_info("exporting csv file", filename)
251231

252232
def move_to_position(self):
253-
"""Move to a position within the Multi-Position Acquisition Interface.
254-
255-
Example
256-
-------
257-
>>> move_to_position()
258-
"""
233+
"""Move to a position within the Multi-Position Acquisition Interface."""
259234
event = type("MyEvent", (object,), {})
260235
event.x, event.y = 0, 0
261236
self.handle_double_click(event)
262237

263238
def insert_row_func(self):
264-
"""Insert a row in the Multi-Position Acquisition Interface.
265-
266-
Example
267-
-------
268-
>>> insert_row_func()
269-
"""
239+
"""Insert a row in the Multi-Position Acquisition Interface."""
270240
self.table.model.addRow(self.table.currentrow)
271241
self.table.update_rowcolors()
272242
self.table.redraw()
@@ -278,10 +248,6 @@ def add_stage_position(self):
278248
279249
This function will get the stage's current position,
280250
Then add it to position list
281-
282-
Example
283-
-------
284-
>>> add_stage_position()
285251
"""
286252
position = self.parent_controller.execute("get_stage_position")
287253
self.append_position(position)
@@ -293,10 +259,6 @@ def append_position(self, position):
293259
----------
294260
position : dict
295261
position in the format of {axis: value}
296-
297-
Example
298-
-------
299-
>>> append_position(position)
300262
"""
301263
temp = list(map(lambda k: position[k], position))
302264
self.table.model.df = self.table.model.df.append(

0 commit comments

Comments
 (0)