diff --git a/example/sofast_fringe/example_calibration_screen_shape.py b/example/sofast_fringe/example_calibration_screen_shape.py index 43bae362b..5995a9eed 100644 --- a/example/sofast_fringe/example_calibration_screen_shape.py +++ b/example/sofast_fringe/example_calibration_screen_shape.py @@ -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(), @@ -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')) @@ -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) diff --git a/opencsp/app/sofast/lib/CalibrateDisplayShape.py b/opencsp/app/sofast/lib/CalibrateDisplayShape.py index 3951b29dc..04add0827 100644 --- a/opencsp/app/sofast/lib/CalibrateDisplayShape.py +++ b/opencsp/app/sofast/lib/CalibrateDisplayShape.py @@ -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 @@ -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( @@ -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() diff --git a/opencsp/common/lib/deflectometry/CalibrationCameraPosition.py b/opencsp/common/lib/deflectometry/CalibrationCameraPosition.py index 88a708f1e..4747fe424 100644 --- a/opencsp/common/lib/deflectometry/CalibrationCameraPosition.py +++ b/opencsp/common/lib/deflectometry/CalibrationCameraPosition.py @@ -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: