diff --git a/opencsp/app/camera_calibration/lib/ViewAnnotatedImages.py b/opencsp/app/camera_calibration/lib/ViewAnnotatedImages.py index eda5e09e6..48a5c379e 100644 --- a/opencsp/app/camera_calibration/lib/ViewAnnotatedImages.py +++ b/opencsp/app/camera_calibration/lib/ViewAnnotatedImages.py @@ -9,7 +9,8 @@ class ViewAnnotatedImages: - """Class that controls a window used to view images with a next and previous + """ + Class that controls a window used to view images with a next and previous button """ diff --git a/opencsp/app/sofast/lib/ImageCalibrationAbstract.py b/opencsp/app/sofast/lib/ImageCalibrationAbstract.py index 84a925553..643e214af 100644 --- a/opencsp/app/sofast/lib/ImageCalibrationAbstract.py +++ b/opencsp/app/sofast/lib/ImageCalibrationAbstract.py @@ -178,7 +178,8 @@ def calculate_min_display_camera_values(self, derivative_thresh: float = 0.4) -> return (display_min_value, camera_min_value) def plot_gray_levels(self) -> None: - """Shows plot of gray levels calibration data. When the close() method of this instance is called (or this + """ + Shows plot of gray levels calibration data. When the close() method of this instance is called (or this instance is destructed), the plot will be closed automatically.""" title = 'Projector-Camera Calibration Curve' diff --git a/opencsp/app/target/target_color/target_color_bullseye.py b/opencsp/app/target/target_color/target_color_bullseye.py index 570871c93..efd90530d 100755 --- a/opencsp/app/target/target_color/target_color_bullseye.py +++ b/opencsp/app/target/target_color/target_color_bullseye.py @@ -59,7 +59,9 @@ def bullseye_color_bar( cx_offset_trim_pix, target_img_width_pix, ): - # Bullseye. + """ + Placeholder + """ for row in range(0, n_rows): for col in range(0, n_cols): r_mrad = bullseye_error.radius_in_mrad_given_row_col( diff --git a/opencsp/app/target/target_color/target_color_bullseye_error.py b/opencsp/app/target/target_color/target_color_bullseye_error.py index 7623eeb71..afd012785 100755 --- a/opencsp/app/target/target_color/target_color_bullseye_error.py +++ b/opencsp/app/target/target_color/target_color_bullseye_error.py @@ -30,14 +30,16 @@ def meters_given_pixels(d_pixel, dpi): def surface_normal_error_magnitude_given_radius_in_meters(r_meter, focal_length_meter): - # Computes the surface normal error of a reflection with a reflected image the given - # radius r_meter away from the target center. - # - # Correct if the mirror design is spherical, the view position is along the optical axis, - # and the target-to-mirror and camera-to-mirror distances are equal to the radius of curvature. - # - # Returns value in milliradians. - # + """ + Computes the surface normal error of a reflection with a reflected image the given + radius r_meter away from the target center. + + Correct if the mirror design is spherical, the view position is along the optical axis, + and the target-to-mirror and camera-to-mirror distances are equal to the radius of curvature. + + Returns value in milliradians. + """ + radius_of_curvature_meter = 2 * focal_length_meter reflected_ray_angle = math.atan(r_meter / radius_of_curvature_meter) # radians surface_normal_error = reflected_ray_angle / 2.0 # radians @@ -45,6 +47,9 @@ def surface_normal_error_magnitude_given_radius_in_meters(r_meter, focal_length_ def radius_in_mrad_given_row_col(n_rows, row, col, x_max, cx_offset_pix, y_offset_pix, focal_length_meter): + """ + Placeholder + """ x = col y = n_rows - row cx = (x_max / 2) + cx_offset_pix diff --git a/opencsp/common/lib/camera/Camera.py b/opencsp/common/lib/camera/Camera.py index 6a31edade..76b0ffde8 100644 --- a/opencsp/common/lib/camera/Camera.py +++ b/opencsp/common/lib/camera/Camera.py @@ -37,20 +37,6 @@ class Camera: def __init__( self, intrinsic_mat: np.ndarray, distortion_coef: np.ndarray, image_shape_xy: tuple[int, int], name: str ): - """ - Calibrated machine vision camera representation. - - Parameters - ---------- - intrinsic_mat : np.ndarray - distortion_coef : np.ndarray - 1d array, distortion coefficients. - image_shape_xy : tuple(int) - (x, y), image size in pixels. - name : str - Name of camera/lens combination. - - """ if intrinsic_mat.shape[0] != 3 or intrinsic_mat.shape[1] != 3 or np.ndim(intrinsic_mat) != 2: raise ValueError('Input intrinsic_mat must be a 3x3 ndarray.') diff --git a/opencsp/test/test_DocStringsExist.py b/opencsp/test/test_DocStringsExist.py index 36448da18..abf41c5a8 100644 --- a/opencsp/test/test_DocStringsExist.py +++ b/opencsp/test/test_DocStringsExist.py @@ -1,12 +1,14 @@ -from pathlib import Path +import inspect # Assume opencsp is in PYHTONPATH -from opencsp.app.sofast.lib.ProcessSofastFringe import ProcessSofastFringe as Sofast +import opencsp as opencsp +import example as example # TODO: why aren't these imported from import opencsp as opencsp above from opencsp.app.camera_calibration.lib.ViewAnnotatedImages import ViewAnnotatedImages from opencsp.app.sofast.SofastGUI import SofastGUI from opencsp.app.sofast.lib import * +from opencsp.app.sofast.lib.visualize_setup import visualize_setup # from opencsp.app.target.target_color.target_color_2d_gradient import target_color_2d_gradient import opencsp.app.target.target_color.target_color_bullseye_error as target_color_bullseye_error @@ -36,6 +38,8 @@ def test_docstrings_exist_for_methods(): opencsp.app.sofast.lib.DisplayShape.DisplayShape, opencsp.app.sofast.lib.DistanceOpticScreen.DistanceOpticScreen, opencsp.app.sofast.lib.DotLocationsFixedPattern.DotLocationsFixedPattern, + SofastGUI, + visualize_setup, opencsp.app.sofast.lib.Fringes.Fringes, opencsp.app.sofast.lib.ImageCalibrationAbstract.ImageCalibrationAbstract, opencsp.app.sofast.lib.ImageCalibrationGlobal.ImageCalibrationGlobal, @@ -55,15 +59,16 @@ def test_docstrings_exist_for_methods(): opencsp.app.sofast.lib.SystemSofastFringe.SystemSofastFringe, SofastGUI, ] + target_class_list = [ - target_color, - target_color_bullseye, + opencsp.app.target.target_color.lib.ImageColor, target_color_bullseye_error, + target_color_bullseye, target_color_one_color, target_color_polar, - opencsp.app.target.target_color.lib.ImageColor, + target_color, ] - target_class_list = [target_color, target_color_polar, opencsp.app.target.target_color.lib.ImageColor] + camera_calibration_class_list = [ opencsp.app.camera_calibration.lib.calibration_camera, opencsp.app.camera_calibration.lib.image_processing, @@ -85,11 +90,23 @@ def test_docstrings_exist_for_methods(): class_list = sofast_class_list + target_class_list + camera_calibration_class_list + scene_reconstruction_class_list for class_module in class_list: - method_list = [ - func - for func in dir(class_module) - if callable(getattr(class_module, func)) and not func.startswith("__") and not func.startswith("_") - ] + print(class_module) + method_list = [] + if inspect.isclass(class_module): + method_list = [ + func + for func in class_module.__dict__ + if callable(getattr(class_module, func)) + and not func.startswith("__") + and not func.startswith("_") + and not hasattr(super(class_module), func) + ] + else: + method_list = [ + func + for func in dir(class_module) + if callable(getattr(class_module, func)) and not func.startswith("__") and not func.startswith("_") + ] for method in method_list: doc_exists = True