Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/camera_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def identify_channel_index_and_slice(self):

else:
channel_idx = 0
slice_idx = self.image_count
slice_idx = self.image_count % self.number_of_slices

self.image_count += 1
return channel_idx, slice_idx
Expand Down
2 changes: 2 additions & 0 deletions src/navigate/controller/sub_controllers/features_popup.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ def func(event):
# if there is any parameters
if args_value is not None and "args" in feature:
for i, a in enumerate(feature["args"]):
if i >= len(args_value):
break
args_value[i] = a
kwargs = {}
if "true" in feature:
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,8 +1143,8 @@ def func(*args):
popup.popup.protocol(
"WM_DELETE_WINDOW",
combine_funcs(
camera_setting_controller.update_experiment_values,
popup.popup.dismiss,
camera_setting_controller.update_experiment_values(),
lambda: delattr(self.parent_controller, controller_name),
),
)
Expand Down
13 changes: 9 additions & 4 deletions src/navigate/model/features/autofocus.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,9 @@ def in_func_data(self, frame_ids=[]):
frame_ids : list
List of frame ids to be processed.
"""

self.get_frames_num += len(frame_ids)
# self.get_frames_num += len(frame_ids)
if self.get_frames_num == self.total_frame_num:
self.get_frames_num += len(frame_ids)
while True:
try:
if self.f_frame_id < 0:
Expand All @@ -387,6 +388,8 @@ def in_func_data(self, frame_ids=[]):
except Exception:
break

self.get_frames_num += 1

entropy = fast_normalized_dct_shannon_entropy(
input_array=self.model.data_buffer[self.f_frame_id],
psf_support_diameter_xy=3,
Expand All @@ -409,8 +412,6 @@ def in_func_data(self, frame_ids=[]):
self.focus_pos = self.f_pos
self.target_frame_id = self.f_frame_id

self.f_frame_id = -1

if self.frame_num == 1:
self.frame_num = 10 # any value but not 1
self.model.logger.info(
Expand All @@ -420,6 +421,10 @@ def in_func_data(self, frame_ids=[]):
# find out the focus
self.autofocus_pos_queue.put(self.focus_pos)
# return [self.target_frame_id]
if frame_ids.index(self.f_frame_id) < len(frame_ids) - 1:
self.get_frames_num += 1

self.f_frame_id = -1

if self.get_frames_num > self.total_frame_num:
return frame_ids
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/model/features/common_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,7 @@ def __init__(
#: int: The number of pixels for the rolling shutter.
try:
self.rolling_shutter_width = int(rolling_shutter_width)
except ValueError:
except (ValueError, TypeError):
self.rolling_shutter_width = None

def signal_func(self):
Expand Down
8 changes: 7 additions & 1 deletion src/navigate/model/features/feature_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
# Standard Library Imports
import logging
import traceback
import inspect

# Third Party Imports

Expand Down Expand Up @@ -827,7 +828,12 @@ def create_node(feature_dict):
if variable_name not in shared_variables:
shared_variables[variable_name] = list(arg["value"])
args[i] = shared_variables[variable_name]
feature = feature_dict["name"](model, *args)

parameter_num = len(inspect.signature(feature_dict["name"].__init__).parameters) - 2
if len(args) > parameter_num:
feature = feature_dict["name"](model, *args[:parameter_num])
else:
feature = feature_dict["name"](model, *args)

node_config = feature.config_table.get("node", {})
# if signal function has a waiting func,
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ def load_feature_records(self):
continue
item = load_yaml_file(f"{feature_lists_path}/{temp['yaml_file_name']}")
if item is None:
i += 1
del feature_records[i]
continue

if item["module_name"]:
Expand Down
Loading