Skip to content

Commit

Permalink
clean up formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mprib committed Sep 15, 2024
1 parent 598ce34 commit 699f5ba
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 35 deletions.
15 changes: 3 additions & 12 deletions caliscope/gui/post_processing_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ def __init__(self, controller: Controller):
def set_current_xyz(self):
if self.xyz_processed_path.exists():
self.vis_widget.update_motion_trial(self.xyz_processed_path)
# # confirm that there are some triangulated values to observe
# xyz = pd.read_csv(self.xyz_processed_path)
# if xyz.shape[0] != 0:
# logger.info(f"Setting xyz display coordinates to those stored in {self.xyz_processed_path}")
# self.xyz = xyz
# else:
# logger.info("Not enough data to triangulate points")
# QMessageBox.warning(self, "Warning", f"The {self.active_tracker_enum.name} tracker did not identify sufficient points for triangulation to occur for recordings stored in:\n{self.active_recording_path}.") # show a warning dialog
# self.xyz = None
else:
logger.info(f"No points displayed; Nothing stored in {self.xyz_processed_path}")
# self.xyz = None
Expand All @@ -79,7 +70,7 @@ def set_current_xyz(self):
QMessageBox.warning(
self,
"Warning",
f"The {self.active_tracker_enum.name} tracker did not identify any points to track in recordings stored in:\n{self.active_recording_path}.",
f"The {self.active_tracker_enum.name} tracker did not identify any points to track in recordings stored in:\n{self.active_recording_path}.", # noqa 501
) # show a warning dialog

def update_recording_folders(self):
Expand Down Expand Up @@ -155,7 +146,7 @@ def viz_title_html(self):
else:
suffix = "(no processed data)"

title = f"<div align='center'><b>{self.tracker_combo.currentData().name.title()} Tracker: {self.active_folder} {suffix} </b></div>"
title = f"<div align='center'><b>{self.tracker_combo.currentData().name.title()} Tracker: {self.active_folder} {suffix} </b></div>" # noqa E501

return title

Expand Down Expand Up @@ -274,7 +265,7 @@ def update_enabled_disabled(self):
self.generate_metarig_config_btn.setToolTip("Tracker is not set up to scale to a metarig")
elif self.metarig_config_path.exists():
self.generate_metarig_config_btn.setToolTip(
"The Metarig configuration json file has already been created.Check the tracker subfolder in the recording directory."
"The Metarig configuration json file has already been created. Check the tracker subfolder in the recording directory." # noqa E501
)
elif not self.xyz_processed_path.exists():
self.generate_metarig_config_btn.setToolTip(
Expand Down
3 changes: 0 additions & 3 deletions caliscope/gui/vizualize/calibration/capture_volume_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ def __init__(self, controller: Controller):
self.rotate_z_plus_btn = QPushButton("Z+")
self.rotate_z_minus_btn = QPushButton("Z-")

# self.distance_error_summary = QLabel(self.session.quality_controller.distance_error_summary.to_string(index=False))
self.rmse_summary = QLabel(self.controller.capture_volume.get_rmse_summary())

# self.recalibrate_btn = QPushButton("Recalibrate")

self.place_widgets()
self.connect_widgets()

Expand Down
3 changes: 2 additions & 1 deletion caliscope/packets.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def metarig_bilateral_measures(self):
OPTIONAL PROPERTY
a dictionary of key: value in the form Measure_Name:[side_pointA, side_pointB]
when processed, mean distance (excluding outliers) between the two points will be calculated and stored as the measure
when processed, mean distance (excluding outliers)
between the two points will be calculated and stored as the measure
"""
raise NotImplementedError(f"Tracker {self.name} has not provided its measures for configuring a metarig")

Expand Down
8 changes: 6 additions & 2 deletions caliscope/recording/recorded_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def __init__(
self.directory = directory
self.port = port
self.rotation_count = rotation_count
self.break_on_last = break_on_last # stop while loop if end reached. Preferred behavior for automated file processing, not interactive frame selection

# stop while loop if end reached.
# Preferred behavior for automated file processing, not interactive frame selection
self.break_on_last = break_on_last

self.tracker = tracker

Expand Down Expand Up @@ -77,7 +80,8 @@ def __init__(
}
self.port_history = pd.DataFrame(mocked_port_history)

# note that this is not simply 0 and frame count because the syncronized recording might start recording many frames into pulling from a camera
# note that this is not simply 0 and frame count because the syncronized recording might start recording many
# frames into pulling from a camera
# this is one of those unhappy artifacts that may be a good candidate for simplification in a future refactor
self.start_frame_index = self.port_history["frame_index"].min()
self.last_frame_index = self.port_history["frame_index"].max()
Expand Down
13 changes: 0 additions & 13 deletions caliscope/recording/video_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,6 @@ def start_recording(
self.destination_folder = destination_folder
# create the folder if it doesn't already exist
self.destination_folder.mkdir(exist_ok=True, parents=True)

# # Because calibration files are nested in a calibration directory, need to go
# # to parent.parent to get the config.toml file
# if self.destination_folder.parent.stem == "calibration":
# source_config_path = Path(self.destination_folder.parent.parent, "config.toml")
# else: # just a regular recording
# source_config_path = Path(self.destination_folder.parent, "config.toml")

# No longer storing config file with recordings....can't know when they were done relative to calibration so will only complicate things..
# source_config_path = find_config_file(self.destination_folder)
# duplicate_config_path = Path(self.destination_folder,"config.toml")
# shutil.copy2(source_config_path,duplicate_config_path)

self.recording = True
self.recording_thread = Thread(
target=self.save_data_worker,
Expand Down
3 changes: 2 additions & 1 deletion caliscope/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def metarig_bilateral_measures(self):
OPTIONAL PROPERTY
a dictionary of key: value in the form Measure_Name:[side_pointA, side_pointB]
when processed, mean distance (excluding outliers) between the two points will be calculated and stored as the measure
when processed, mean distance (excluding outliers) between the two points
will be calculated and stored as the measure
"""
raise NotImplementedError(f"Tracker {self.name} has not provided its measures for configuring a metarig")

Expand Down
3 changes: 2 additions & 1 deletion caliscope/trackers/holistic_opensim_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ def run_frame_processor(self, port: int, rotation_count: int):
pass
else:
mapped_point_id = landmark_id + POSE_OFFSET
# some of the pose values are too noisy to bother with including considering that holistic face and hand tracking is so good
# some of the pose values are too noisy to bother with including considering that
# holistic face and hand tracking is so good
# ignore those points that aren't in the POINT_NAMES list
if mapped_point_id in POINT_NAMES:
point_ids.append(landmark_id + POSE_OFFSET)
Expand Down
2 changes: 1 addition & 1 deletion caliscope/triangulate/sync_packet_triangulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def process_incoming(self):

xyz_packet = XYZPacket(sync_packet.sync_index, point_id_xyz, points_xyz)
logger.info(
f"Placing xyz pacKet for index {sync_packet.sync_index} with {len(xyz_packet.point_ids)} points"
f"Placing xyz pacKet for index {sync_packet.sync_index} with {len(xyz_packet.point_ids)} points" # noqa E501
)
for q in self.subscribers:
q.put(xyz_packet)
Expand Down
2 changes: 1 addition & 1 deletion caliscope/triangulate/triangulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def triangulate_xy(xy: pd.DataFrame, camera_array: CameraArray) -> pd.DataFrame:
def undistort(points, camera: CameraData, iter_num=3) -> np.ndarray:
"""
points: (n,2) dimensional np.ndarray
returns: (2,n) dimensional np.ndarray... definitely not happy with this but not going to start refactoring this at this moment
returns: (2,n) dimensional np.ndarray
"""

# implementing a function described here: https://yangyushi.github.io/code/2020/03/04/opencv-undistort.html
Expand Down

0 comments on commit 699f5ba

Please sign in to comment.