Skip to content

Commit

Permalink
Calibrate screen shape migrated to log_tools
Browse files Browse the repository at this point in the history
Fixing merge conflict in example_calibrate_screen_shape
  • Loading branch information
braden6521 committed Mar 20, 2024
1 parent 48a768c commit 492975d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
20 changes: 12 additions & 8 deletions example/sofast_fringe/example_calibration_screen_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
from opencsp.common.lib.geometry.Vxyz import Vxyz
from opencsp.common.lib.opencsp_path.opencsp_root_path import opencsp_code_dir
import opencsp.common.lib.tool.file_tools as ft
import opencsp.common.lib.tool.log_tools as lt


def example_run_screen_shape_calibration():
"""Runs screen shape calibration. Saves data to ./data/output/screen_shape"""
# Define save directory
save_dir = join(dirname(__file__), 'data/output/screen_shape')
ft.create_directories_if_necessary(save_dir)

def example_run_screen_shape_calibration(save_dir):
"""Runs screen shape calibration. Saves data to ./data/output/screen_shape
"""
# Load output data from Scene Reconstruction (Aruco marker xyz points)
file_pts_data = join(
opencsp_code_dir(),
Expand Down Expand Up @@ -72,7 +70,8 @@ def example_run_screen_shape_calibration():

# Perform screen shape calibration
cal = CalibrateDisplayShape(data_input)
cal.run_calibration(2)
cal.make_figures = True
cal.run_calibration()

# Save screen shape data as HDF5 file
cal.save_data_as_hdf(join(save_dir, 'screen_distortion_data.h5'))
Expand All @@ -83,4 +82,9 @@ def example_run_screen_shape_calibration():


if __name__ == '__main__':
example_run_screen_shape_calibration()
# Define save directory
save_path = join(dirname(__file__), 'data/output/screen_shape')
ft.create_directories_if_necessary(save_path)
lt.logger(join(save_path, 'log.txt'), lt.log.INFO)

example_run_screen_shape_calibration(save_path)
6 changes: 3 additions & 3 deletions opencsp/app/sofast/lib/CalibrateDisplayShape.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class CalibrateDisplayShape:
----------
data_input: : DataInput
DataInput class with input data
to_plot : bool
make_figures : bool
Set to True to output plots
data_calculation : DataCalculation
DataCalculation class for storing calculated data
Expand All @@ -109,7 +109,7 @@ def __init__(self, data_input: DataInput) -> 'CalibrateDisplayShape':
A DataInput class with all fields defined
"""
self.data_input = data_input
self.to_plot = False
self.make_figures = False

# Load cal params
cal_pattern_params = CalParams(
Expand Down Expand Up @@ -539,7 +539,7 @@ def run_calibration(self) -> None:
self.assemble_xyz_data_into_images()

# Plot figures
if self.to_plot:
if self.make_figures:
self.visualize_located_cameras()
self.visualize_annotated_camera_images()
self.plot_ray_intersection_errors()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(
self.pts_xy_marker_corners_reprojected: Vxy

# Save figures
self.make_figures: bool = False
self.make_figures = False
self.figures: list[plt.Figure] = []

def find_markers(self) -> None:
Expand Down

0 comments on commit 492975d

Please sign in to comment.