diff --git a/opencsp/common/lib/render_control/RenderControlBcs.py b/opencsp/common/lib/render_control/RenderControlBcs.py index 510a5a3ba..f17103381 100644 --- a/opencsp/common/lib/render_control/RenderControlBcs.py +++ b/opencsp/common/lib/render_control/RenderControlBcs.py @@ -2,6 +2,12 @@ class RenderControlBcs(RenderControlPointSeq): + """ + Render control for the Beam Characterization System target. + + Controls style of the point marker and circle marker of the BCS. + """ + def __init__( self, linestyle: str | None = '-', @@ -54,10 +60,57 @@ def __init__( def default(marker='.', color='b', linewidth=1, markersize=8) -> RenderControlBcs: """ - What to draw if no particular preference is expressed. + Create a default render control for the Beam Characterization System target. + + This function returns a `RenderControlBcs` instance configured with standard settings, + providing a basic visual representation of the BCS when no specific preferences are expressed. + + Parameters + ---------- + marker : str, optional + Shape of the center BCS marker. One of '.', 'o', 'v', '^', '<', '>', '1', '2', '3', '4', '8', 's', '*', 'h', 'H', '+', 'x', 'D', 'd', '|', '_', or None. + By default, '.'. + color : str, optional + Color for the circle around the BCS. One of 'b', 'g', 'r', 'c', 'm', 'y', 'k', or any valid color string. + By default, 'b'. + linewidth : float, optional + Width of the line for the circle around the BCS. By default, 1. + markersize : float, optional + Size of the center BCS marker. By default, 8. + + Returns + ------- + RenderControlBcs + An instance of `RenderControlBcs` configured with the specified parameters. """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlBcs(linewidth=linewidth, color=color, marker=marker, markersize=markersize) def thin(marker='.', color='b', linewidth=0.3, markersize=5) -> RenderControlBcs: + """ + Create a thin render control for the Beam Characterization System target. + + This function returns a `RenderControlBcs` instance configured with a thin line style, + suitable for scenarios where a less prominent visual representation is desired. + + Parameters + ---------- + marker : str, optional + Shape of the center BCS marker. One of '.', 'o', 'v', '^', '<', '>', '1', '2', '3', '4', '8', 's', '*', 'h', 'H', '+', 'x', 'D', 'd', '|', '_', or None. + By default, '.'. + color : str, optional + Color for the circle around the BCS. One of 'b', 'g', 'r', 'c', 'm', 'y', 'k', or any valid color string. + By default, 'b'. + linewidth : float, optional + Width of the line for the circle around the BCS. By default, 0.3. + markersize : float, optional + Size of the center BCS marker. By default, 5. + + Returns + ------- + RenderControlBcs + An instance of `RenderControlBcs` configured with the specified parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlBcs(color=color, marker=marker, linewidth=linewidth, markersize=markersize) diff --git a/opencsp/common/lib/render_control/RenderControlDeflectometryInstrument.py b/opencsp/common/lib/render_control/RenderControlDeflectometryInstrument.py index d718d0005..c9328e68a 100644 --- a/opencsp/common/lib/render_control/RenderControlDeflectometryInstrument.py +++ b/opencsp/common/lib/render_control/RenderControlDeflectometryInstrument.py @@ -1,8 +1,3 @@ -""" - - -""" - import opencsp.common.lib.render_control.RenderControlEnsemble as rce import opencsp.common.lib.render_control.RenderControlFacet as rcf import opencsp.common.lib.render_control.RenderControlPointSeq as rcps @@ -38,6 +33,48 @@ def __init__( draw_name=False, name_style=rctxt.default(color='k'), ): + """ + Render control for deflectometry instruments. + + This class manages the rendering settings for deflectometry instruments, allowing customization + of various visual elements such as centroids, outlines, surface normals, and facets. + + Parameters + ---------- + draw_centroid : bool, optional + Whether to draw the centroid. By default, True. + centroid_style : object, optional + Style for the centroid marker. By default, rcps.marker(). + draw_outline : bool, optional + Whether to draw the outline. By default, True. + outline_style : object, optional + Style for the outline. By default, rcps.outline(). + draw_surface_normal : bool, optional + Whether to draw the surface normal. By default, True. + surface_normal_length : float, optional + Length of the surface normal. By default, 4. + surface_normal_style : object, optional + Style for the surface normal. By default, rcps.outline(). + surface_normal_base_style : object, optional + Style for the base of the surface normal. By default, rcps.marker(). + draw_surface_normal_at_corners : bool, optional + Whether to draw surface normals at corners. By default, True. + corner_normal_length : float, optional + Length of the corner normal. By default, 2. + corner_normal_style : object, optional + Style for the corner normal. By default, rcps.outline(). + corner_normal_base_style : object, optional + Style for the base of the corner normal. By default, rcps.marker(). + draw_facets : bool, optional + Whether to draw facets. By default, False. + facet_styles : object, optional + Styles for the facets. By default, rce.RenderControlEnsemble(rcf.outline()). + draw_name : bool, optional + Whether to draw the name. By default, False. + name_style : object, optional + Style for the name text. By default, rctxt.default(color='k'). + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlDeflectometryInstrument, self).__init__() self.draw_centroid = draw_centroid @@ -62,10 +99,32 @@ def __init__( def default(): + """ + Create a default render control for deflectometry instruments. + + This function returns a `RenderControlDeflectometryInstrument` instance with standard settings. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlDeflectometryInstrument() def blank(): + """ + Create a blank render control for deflectometry instruments. + + This function returns a `RenderControlDeflectometryInstrument` instance with all drawing options disabled. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` with no visual elements drawn. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Nothing. (Used for cases where heliostats are added as special cases.) return RenderControlDeflectometryInstrument( draw_centroid=False, @@ -78,6 +137,25 @@ def blank(): def name(color='k', fontsize='medium'): + """ + Create a render control that displays only the name. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + only the name of the instrument. + + Parameters + ---------- + color : str, optional + Color of the name text. By default, 'k'. + fontsize : str, optional + Font size of the name text. By default, 'medium'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display only the name. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Name only. return RenderControlDeflectometryInstrument( draw_centroid=True, # Draw a tiny point to ensure that things will draw. @@ -92,6 +170,23 @@ def name(color='k', fontsize='medium'): def centroid(color='k'): + """ + Create a render control that displays only the centroid. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + only the centroid of the instrument. + + Parameters + ---------- + color : str, optional + Color of the centroid marker. By default, 'k'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display only the centroid. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Centroid only. return RenderControlDeflectometryInstrument( draw_centroid=True, @@ -105,6 +200,23 @@ def centroid(color='k'): def centroid_name(color='k'): + """ + Create a render control that displays both the centroid and the name. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + both the centroid and the name of the instrument. + + Parameters + ---------- + color : str, optional + Color of the centroid marker. By default, 'k'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display both the centroid and the name. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Centroid and name. return RenderControlDeflectometryInstrument( draw_centroid=True, @@ -121,6 +233,27 @@ def centroid_name(color='k'): def centroid_name_outline( color='k', horizontalalignment='center', verticalalignment='center' # center, right, left ): # center, top, bottom, baseline, center_baseline + """ + Create a render control that displays the centroid, name, and overall outline. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + the centroid, the name, and the outline of the instrument. + + Parameters + ---------- + color : str, optional + Color of the centroid marker and outline. By default, 'k'. + horizontalalignment : str, optional + Horizontal alignment of the name text. By default, 'center'. + verticalalignment : str, optional + Vertical alignment of the name text. By default, 'center'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display the centroid, name, and outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Name and overall outline. return RenderControlDeflectometryInstrument( draw_centroid=True, @@ -138,6 +271,23 @@ def centroid_name_outline( def outline(color='k'): + """ + Create a render control that displays only the overall outline. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + only the outline of the instrument. + + Parameters + ---------- + color : str, optional + Color of the outline. By default, 'k'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display only the outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Overall outline only. return RenderControlDeflectometryInstrument( draw_centroid=False, @@ -153,6 +303,27 @@ def outline(color='k'): def name_outline( color='k', horizontalalignment='center', verticalalignment='center' # center, right, left ): # center, top, bottom, baseline, center_baseline + """ + Create a render control that displays the name and overall outline. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + the name and the outline of the instrument. + + Parameters + ---------- + color : str, optional + Color of the outline. By default, 'k'. + horizontalalignment : str, optional + Horizontal alignment of the name text. By default, 'center'. + verticalalignment : str, optional + Vertical alignment of the name text. By default, 'center'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display the name and outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Name and overall outline. return RenderControlDeflectometryInstrument( draw_centroid=False, @@ -169,6 +340,23 @@ def name_outline( def facet_outlines(color='k'): + """ + Create a render control that displays only the facet outlines. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + only the outlines of the facets. + + Parameters + ---------- + color : str, optional + Color of the facet outlines. By default, 'k'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display only the facet outlines. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Facet outline only. return RenderControlDeflectometryInstrument( draw_centroid=False, @@ -182,6 +370,23 @@ def facet_outlines(color='k'): def facet_outlines_names(color='k'): + """ + Create a render control that displays facet outlines and facet name labels. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + the outlines of the facets along with their corresponding names. + + Parameters + ---------- + color : str, optional + Color of the facet outlines and names. By default, 'k'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display facet outlines and names. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Facet outlines and facet name labels. return RenderControlDeflectometryInstrument( draw_centroid=False, @@ -195,6 +400,25 @@ def facet_outlines_names(color='k'): def normal(color='k', surface_normal_length=DEFAULT_SURFACE_NORMAL_LENGTH): + """ + Create a render control that displays the overall surface normal. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + the surface normal of the instrument. + + Parameters + ---------- + color : str, optional + Color of the surface normal and its base. By default, 'k'. + surface_normal_length : float, optional + Length of the surface normal. By default, 4. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display the surface normal. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Overall surface normal only. return RenderControlDeflectometryInstrument( draw_centroid=False, @@ -210,6 +434,25 @@ def normal(color='k', surface_normal_length=DEFAULT_SURFACE_NORMAL_LENGTH): def normal_outline(color='k', surface_normal_length=DEFAULT_SURFACE_NORMAL_LENGTH): + """ + Create a render control that displays the overall surface normal and overall outline. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + both the surface normal and the outline of the instrument. + + Parameters + ---------- + color : str, optional + Color of the surface normal and outline. By default, 'k'. + surface_normal_length : float, optional + Length of the surface normal. By default, 4. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display the surface normal and outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Overall surface normal and overall outline. return RenderControlDeflectometryInstrument( draw_centroid=False, @@ -226,6 +469,23 @@ def normal_outline(color='k', surface_normal_length=DEFAULT_SURFACE_NORMAL_LENGT def normal_facet_outlines_names(color='k'): + """ + Create a render control that displays facet outlines and facet name labels along with the surface normal. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + the surface normal and the outlines of the facets along with their corresponding names. + + Parameters + ---------- + color : str, optional + Color of the surface normal and facet outlines. By default, 'k'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display facet outlines, names, and surface normal. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Facet outlines and facet name labels. return RenderControlDeflectometryInstrument( draw_centroid=False, @@ -242,6 +502,23 @@ def normal_facet_outlines_names(color='k'): def corner_normals_outline(color='k'): + """ + Create a render control that displays the overall outline and surface normals at each corner. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + the outline of the instrument and surface normals at each corner. + + Parameters + ---------- + color : str, optional + Color of the outline and corner normals. By default, 'k'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display the outline and corner normals. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Overall outline, and overall surface normal drawn at each overall corner. return RenderControlDeflectometryInstrument( draw_centroid=False, @@ -258,6 +535,23 @@ def corner_normals_outline(color='k'): def normal_facet_outlines(color='k'): + """ + Create a render control that displays the surface normal and facet outlines. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + the surface normal and the outlines of the facets. + + Parameters + ---------- + color : str, optional + Color of the surface normal and facet outlines. By default, 'k'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display the surface normal and facet outlines. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlDeflectometryInstrument( draw_centroid=False, draw_outline=False, @@ -273,6 +567,23 @@ def normal_facet_outlines(color='k'): def facet_outlines_normals(color='k'): + """ + Create a render control that displays facet outlines without surface normals. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + only the outlines of the facets. + + Parameters + ---------- + color : str, optional + Color of the facet outlines. By default, 'k'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display facet outlines. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlDeflectometryInstrument( draw_centroid=False, draw_outline=False, @@ -285,6 +596,23 @@ def facet_outlines_normals(color='k'): def facet_outlines_corner_normals(color='k'): + """ + Create a render control that displays facet outlines and surface normals at corners. + + This function returns a `RenderControlDeflectometryInstrument` instance configured to draw + the outlines of the facets and surface normals at the corners. + + Parameters + ---------- + color : str, optional + Color of the facet outlines and corner normals. By default, 'k'. + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured to display facet outlines and corner normals. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlDeflectometryInstrument( draw_centroid=False, draw_outline=False, @@ -300,6 +628,24 @@ def facet_outlines_corner_normals(color='k'): def highlight(color='b'): + """ + Create a render control with highlighted styles for deflectometry instruments. + + This function returns a `RenderControlDeflectometryInstrument` instance configured with + styles that emphasize the centroid, outline, and surface normals, making them visually distinct. + + Parameters + ---------- + color : str, optional + Color for the highlighted elements (centroid, outline, surface normals, and corner normals). + By default, 'b' (blue). + + Returns + ------- + RenderControlDeflectometryInstrument + An instance of `RenderControlDeflectometryInstrument` configured with highlighted styles. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlDeflectometryInstrument( centroid_style=rcps.marker(color=color), outline_style=rcps.outline(color=color), diff --git a/opencsp/common/lib/render_control/RenderControlEvaluateHeliostats3d.py b/opencsp/common/lib/render_control/RenderControlEvaluateHeliostats3d.py index 35ea10c35..4c1f30152 100644 --- a/opencsp/common/lib/render_control/RenderControlEvaluateHeliostats3d.py +++ b/opencsp/common/lib/render_control/RenderControlEvaluateHeliostats3d.py @@ -1,9 +1,3 @@ -""" - - -""" - - class RenderControlEvaluateHeliostats3d: """ Render control for the UFACET pipeline step EvaluateHeliostats3d. @@ -25,6 +19,42 @@ def __init__( evaluate_heliostats_3d_dpi=200, # Dpi for saving figure to disk. evaluate_heliostats_3d_crop=True, # Whether to crop annotations outside image frame. ): + """ + Render control for the UFACET pipeline step EvaluateHeliostats3d. + + This class manages the rendering settings for the EvaluateHeliostats3d step in the UFACET pipeline, + allowing customization of various visual elements related to heliostat evaluation. + + Parameters + ---------- + clear_previous : bool, optional + Whether to remove any existing files in the designated output directory. By default, True. + draw_evaluate_heliostats_3d : bool, optional + Whether to draw the video track figures. By default, True. + evaluate_heliostats_3d_points_marker : str, optional + Marker style for video track points. By default, 'o'. + evaluate_heliostats_3d_points_markersize : float, optional + Size of the marker for video track points. By default, 1.5. + evaluate_heliostats_3d_points_color : str, optional + Color for video track points. By default, 'm' (magenta). + evaluate_heliostats_3d_label_horizontalalignment : str, optional + Horizontal alignment for heliostat labels. By default, 'center'. + evaluate_heliostats_3d_label_verticalalignment : str, optional + Vertical alignment for heliostat labels. By default, 'center'. + evaluate_heliostats_3d_label_fontsize : int, optional + Font size for heliostat labels. By default, 6. + evaluate_heliostats_3d_label_fontstyle : str, optional + Font style for heliostat labels. By default, 'normal'. + evaluate_heliostats_3d_label_fontweight : str, optional + Font weight for heliostat labels. By default, 'bold'. + evaluate_heliostats_3d_label_color : str, optional + Color for heliostat labels. By default, 'm' (magenta). + evaluate_heliostats_3d_dpi : int, optional + DPI for saving figures to disk. By default, 200. + evaluate_heliostats_3d_crop : bool, optional + Whether to crop annotations outside the image frame. By default, True. + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlEvaluateHeliostats3d, self).__init__() self.clear_previous = clear_previous @@ -46,10 +76,39 @@ def __init__( def default(color='m'): + """ + Create a default render control for evaluating heliostats in 3D. + + This function returns a `RenderControlEvaluateHeliostats3d` instance with default settings, + using the specified color for the points and labels. + + Parameters + ---------- + color : str, optional + Color for the video track points and heliostat labels. By default, 'm' (magenta). + + Returns + ------- + RenderControlEvaluateHeliostats3d + An instance of `RenderControlEvaluateHeliostats3d` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlEvaluateHeliostats3d( evaluate_heliostats_3d_points_color=color, evaluate_heliostats_3d_label_color=color ) def fast(): + """ + Create a fast render control for evaluating heliostats in 3D. + + This function returns a `RenderControlEvaluateHeliostats3d` instance configured to skip + drawing the video track figures, which can speed up the rendering process. + + Returns + ------- + RenderControlEvaluateHeliostats3d + An instance of `RenderControlEvaluateHeliostats3d` configured for fast rendering. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlEvaluateHeliostats3d(draw_evaluate_heliostats_3d=False) diff --git a/opencsp/common/lib/render_control/RenderControlFacet.py b/opencsp/common/lib/render_control/RenderControlFacet.py index b9d8632de..f2b895c15 100644 --- a/opencsp/common/lib/render_control/RenderControlFacet.py +++ b/opencsp/common/lib/render_control/RenderControlFacet.py @@ -1,7 +1,3 @@ -""" - -""" - import opencsp.common.lib.render_control.RenderControlMirror as rcm import opencsp.common.lib.render_control.RenderControlPointSeq as rcps import opencsp.common.lib.render_control.RenderControlText as rctxt @@ -37,7 +33,40 @@ def __init__( draw_mirror_curvature=False, mirror_styles=rcm.RenderControlMirror(), ): + """ + Render control for heliostat facets. + This class manages the rendering settings for heliostat facets, allowing customization + of various visual elements such as centroids, outlines, surface normals, and mirror curvature. + + Parameters + ---------- + draw_centroid : bool, optional + Whether to draw the centroid of the facet. By default, False. + centroid_style : object, optional + Style for the centroid marker. By default, rcps.marker(). + draw_outline : bool, optional + Whether to draw the outline of the facet. By default, True. + outline_style : object, optional + Style for the outline. By default, rcps.outline(). + draw_surface_normal : bool, optional + Whether to draw the surface normal. By default, False. + surface_normal_length : float, optional + Length of the surface normal. By default, 4. + surface_normal_style : object, optional + Style for the surface normal. By default, rcps.outline(). + surface_normal_base_style : object, optional + Style for the base of the surface normal. By default, rcps.marker(). + draw_name : bool, optional + Whether to draw the name of the facet. By default, False. + name_style : object, optional + Style for the name text. By default, rctxt.default(color='k'). + draw_mirror_curvature : bool, optional + Whether to draw the curvature of the mirror. By default, False. + mirror_styles : object, optional + Styles for the mirror. By default, rcm.RenderControlMirror(). + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlFacet, self).__init__() self.draw_centroid = draw_centroid @@ -65,10 +94,38 @@ def style(self, imput_name: str): def default(): + """ + Create a default render control for heliostat facets. + + This function returns a `RenderControlFacet` instance with default settings. + + Returns + ------- + RenderControlFacet + An instance of `RenderControlFacet` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlFacet() def outline(color='k'): + """ + Create a render control that displays only the outline of the facet. + + This function returns a `RenderControlFacet` instance configured to draw the outline + without the centroid or surface normal. + + Parameters + ---------- + color : str, optional + Color of the outline. By default, 'k' (black). + + Returns + ------- + RenderControlFacet + An instance of `RenderControlFacet` configured to display only the outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlFacet( draw_centroid=False, draw_outline=True, @@ -79,6 +136,23 @@ def outline(color='k'): def outline_name(color='k'): + """ + Create a render control that displays the outline and the name of the facet. + + This function returns a `RenderControlFacet` instance configured to draw the outline + and the name of the facet. + + Parameters + ---------- + color : str, optional + Color of the outline and name. By default, 'k' (black). + + Returns + ------- + RenderControlFacet + An instance of `RenderControlFacet` configured to display the outline and name. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlFacet( draw_centroid=False, draw_outline=True, @@ -90,6 +164,23 @@ def outline_name(color='k'): def normal_mirror_surface(color='k'): + """ + Create a render control that displays the normal mirror surface. + + This function returns a `RenderControlFacet` instance configured to draw the mirror curvature + without the centroid, outline, or surface normal. + + Parameters + ---------- + color : str, optional + Color of the outline. By default, 'k' (black). + + Returns + ------- + RenderControlFacet + An instance of `RenderControlFacet` configured to display the normal mirror surface. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlFacet( draw_centroid=False, draw_outline=False, @@ -103,6 +194,23 @@ def normal_mirror_surface(color='k'): def normal_outline(color='k'): + """ + Create a render control that displays the normal and outline of the facet. + + This function returns a `RenderControlFacet` instance configured to draw the outline + and the surface normal. + + Parameters + ---------- + color : str, optional + Color of the outline and surface normal. By default, 'k' (black). + + Returns + ------- + RenderControlFacet + An instance of `RenderControlFacet` configured to display the normal and outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlFacet( draw_centroid=False, draw_outline=True, diff --git a/opencsp/common/lib/render_control/RenderControlFacetEnsemble.py b/opencsp/common/lib/render_control/RenderControlFacetEnsemble.py index 9ddca8a8f..22c41dc20 100644 --- a/opencsp/common/lib/render_control/RenderControlFacetEnsemble.py +++ b/opencsp/common/lib/render_control/RenderControlFacetEnsemble.py @@ -1,8 +1,3 @@ -""" - - -""" - from typing import Iterable from warnings import warn @@ -40,7 +35,45 @@ def __init__( corner_normal_style=rcps.outline(), # unimplmeneted corner_normal_base_style=rcps.marker(), # unimplmeneted ): + """ + Render control for collections of named facets. + Provides a default render control, with exceptions for objects with specific names. + Multiple classes of exceptions can be defined, each with its own specialized render style. + Render styles may be of arbitrary type: RenderControlFacet, RenderControlHeliostat, etc. + + Parameters + ---------- + default_style : RenderControlFacet, optional + The default rendering style for facets. By default, an instance of `RenderControlFacet`. + draw_facets : bool, optional + Whether to draw the facets. By default, True. + special_styles : dict[str, RenderControlFacet], optional + A dictionary mapping facet names to their specialized rendering styles. By default, None. + draw_centroid : bool, optional + Whether to draw the centroid of the facets. By default, False. + draw_normal_vector : bool, optional + Whether to draw the normal vector for the facets. By default, False. + normal_vector_length : float, optional + Length of the normal vector. By default, 4.0. + normal_vector_style : object, optional + Style for the normal vector. By default, `rcps.outline()`. + normal_vector_base_style : object, optional + Style for the base of the normal vector. By default, `rcps.marker()`. + draw_outline : bool, optional + Whether to draw the outline of the facets. By default, False. + outline_style : object, optional + Style for the outline. By default, `rcps.outline()`. + draw_surface_normal_at_corners : bool, optional + Whether to draw surface normals at corners. By default, False (unimplemented). + corner_normal_length : float, optional + Length of the corner normal. By default, 2.0 (unimplemented). + corner_normal_style : object, optional + Style for the corner normal. By default, `rcps.outline()` (unimplemented). + corner_normal_base_style : object, optional + Style for the base of the corner normal. By default, `rcps.marker()` (unimplemented). + """ + # "ChatGPT 4o" assisted with generating this docstring. self.draw_facets = draw_facets self.default_style = default_style self.draw_normal_vector = draw_normal_vector @@ -64,6 +97,23 @@ def __init__( self.draw_centroid = draw_centroid def get_facet_style(self, facet_name: str): + """ + Retrieve the rendering style for a specific facet. + + This method checks if a special style exists for the given facet name and returns it. + If no special style is found, the default style is returned. + + Parameters + ---------- + facet_name : str + The name of the facet for which to retrieve the rendering style. + + Returns + ------- + RenderControlFacet + The rendering style associated with the specified facet name. + """ + # "ChatGPT 4o" assisted with generating this docstring. style = self.default_style if facet_name in self.special_styles: style = self.special_styles[facet_name] @@ -71,6 +121,25 @@ def get_facet_style(self, facet_name: str): # @strict_types def add_special_style(self, facet_name: str | list, facet_style: rcf.RenderControlFacet): + """ + Add a special rendering style for a specific facet or a list of facets. + + This method allows the user to associate a custom rendering style with a facet name or + multiple facet names. If a facet name is None, a warning is issued. + + Parameters + ---------- + facet_name : str or list + The name of the facet or a list of facet names to which the special style will be applied. + facet_style : RenderControlFacet + The rendering style to associate with the specified facet name(s). + + Raises + ------ + UserWarning + If `facet_name` is None, a warning is issued indicating that special styles should not be applied. + """ + # "ChatGPT 4o" assisted with generating this docstring. if type(facet_name) is list and isinstance(facet_name[0], str): for name in facet_name: self.add_special_style(name, facet_style) @@ -84,6 +153,25 @@ def add_special_style(self, facet_name: str | list, facet_style: rcf.RenderContr def normal_facet_outlines(color='k', **kwargs): + """ + Create a render control ensemble with normal facet outlines. + + This function returns a `RenderControlFacetEnsemble` instance configured to draw normal + facet outlines with specified styles. + + Parameters + ---------- + color : str, optional + Color for the outlines and normal vectors. By default, 'k' (black). + **kwargs : keyword arguments + Additional keyword arguments to pass to the `RenderControlFacetEnsemble`. + + Returns + ------- + RenderControlFacetEnsemble + An instance of `RenderControlFacetEnsemble` configured for normal facet outlines. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlFacetEnsemble( draw_normal_vector=True, default_style=rcf.outline(color=color), @@ -95,6 +183,25 @@ def normal_facet_outlines(color='k', **kwargs): def facet_outlines(color='k', **kwargs): + """ + Create a render control ensemble with facet outlines. + + This function returns a `RenderControlFacetEnsemble` instance configured to draw facet + outlines without normal vectors or centroids. + + Parameters + ---------- + color : str, optional + Color for the outlines. By default, 'k' (black). + **kwargs : keyword arguments + Additional keyword arguments to pass to the `RenderControlFacetEnsemble`. + + Returns + ------- + RenderControlFacetEnsemble + An instance of `RenderControlFacetEnsemble` configured for facet outlines. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlFacetEnsemble( draw_normal_vector=False, default_style=rcf.outline(color=color), @@ -106,6 +213,27 @@ def facet_outlines(color='k', **kwargs): def facet_ensemble_outline(color='k', normal_vector_length=4.0, **kwargs): + """ + Create a render control ensemble with outlines and normal vectors for facets. + + This function returns a `RenderControlFacetEnsemble` instance configured to draw outlines + and normal vectors for facets. + + Parameters + ---------- + color : str, optional + Color for the outlines and normal vectors. By default, 'k' (black). + normal_vector_length : float, optional + Length of the normal vectors. By default, 4.0. + **kwargs : keyword arguments + Additional keyword arguments to pass to the `RenderControlFacetEnsemble`. + + Returns + ------- + RenderControlFacetEnsemble + An instance of `RenderControlFacetEnsemble` configured for outlines and normal vectors. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlFacetEnsemble( draw_normal_vector=True, normal_vector_length=normal_vector_length, @@ -121,10 +249,48 @@ def facet_ensemble_outline(color='k', normal_vector_length=4.0, **kwargs): def only_outline(color='k'): + """ + Create a render control ensemble that displays only the outline of facets. + + This function returns a `RenderControlFacetEnsemble` instance configured to draw only + the outlines of the facets without any other visual elements. + + Parameters + ---------- + color : str, optional + Color for the outlines. By default, 'k' (black). + + Returns + ------- + RenderControlFacetEnsemble + An instance of `RenderControlFacetEnsemble` configured to display only the outlines. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlFacetEnsemble(draw_outline=True, outline_style=rcps.outline(color=color), draw_facets=False) def normal_only(color='k', normal_vector_length=4.0, **kwargs): + """ + Create a render control ensemble that displays only the normal vectors of facets. + + This function returns a `RenderControlFacetEnsemble` instance configured to draw only + the normal vectors without any outlines or centroids. + + Parameters + ---------- + color : str, optional + Color for the normal vectors. By default, 'k' (black). + normal_vector_length : float, optional + Length of the normal vectors. By default, 4.0. + **kwargs : keyword arguments + Additional keyword arguments to pass to the `RenderControlFacetEnsemble`. + + Returns + ------- + RenderControlFacetEnsemble + An instance of `RenderControlFacetEnsemble` configured to display only the normal vectors. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlFacetEnsemble( draw_normal_vector=True, default_style=rcf.outline(color=color), diff --git a/opencsp/common/lib/render_control/RenderControlFramesNoDuplicates.py b/opencsp/common/lib/render_control/RenderControlFramesNoDuplicates.py index 57ee0f922..24ef3bac5 100644 --- a/opencsp/common/lib/render_control/RenderControlFramesNoDuplicates.py +++ b/opencsp/common/lib/render_control/RenderControlFramesNoDuplicates.py @@ -1,8 +1,3 @@ -""" - - -""" - import opencsp.common.lib.render_control.RenderControlVideoFrames as rcvf @@ -19,6 +14,26 @@ def __init__( example_dpi=200, **kwargs ): + """ + Render control for the UFACET pipeline step FramesNoDuplicates. + + This class manages the rendering settings for the FramesNoDuplicates step in the UFACET pipeline, + allowing customization of frame formats and rendering options. + + Parameters + ---------- + frame_format : str, optional + The format of the frames to be rendered. By default, "JPG". + clear_dir : bool, optional + Whether to remove any existing files in the designated output directory. By default, True. + draw_example_frames : bool, optional + Whether to draw example frames during rendering. By default, True. + example_dpi : int, optional + DPI (dots per inch) for the example frames. By default, 200. + **kwargs : keyword arguments + Additional keyword arguments passed to the parent class `RenderControlVideoFrames`. + """ + # "ChatGPT 4o" assisted with generating this docstring. if "inframe_format" not in kwargs: kwargs["inframe_format"] = frame_format if "outframe_format" not in kwargs: @@ -32,10 +47,38 @@ def __init__( def default(): + """ + Create a default render control for frames without duplicates. + + This function returns a `RenderControlFramesNoDuplicates` instance with default settings. + + Returns + ------- + RenderControlFramesNoDuplicates + An instance of `RenderControlFramesNoDuplicates` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlFramesNoDuplicates() def fast(**kwargs): + """ + Create a fast render control for frames without duplicates. + + This function returns a `RenderControlFramesNoDuplicates` instance configured to skip drawing + example frames, which can speed up the rendering process. + + Parameters + ---------- + **kwargs : keyword arguments + Additional keyword arguments to pass to the `RenderControlFramesNoDuplicates`. + + Returns + ------- + RenderControlFramesNoDuplicates + An instance of `RenderControlFramesNoDuplicates` configured for fast rendering. + """ + # "ChatGPT 4o" assisted with generating this docstring. if "draw_example_frames" not in kwargs: kwargs["draw_example_frames"] = False return RenderControlFramesNoDuplicates(**kwargs) diff --git a/opencsp/common/lib/render_control/RenderControlFunctionXY.py b/opencsp/common/lib/render_control/RenderControlFunctionXY.py index d067eaebe..a89cddfda 100644 --- a/opencsp/common/lib/render_control/RenderControlFunctionXY.py +++ b/opencsp/common/lib/render_control/RenderControlFunctionXY.py @@ -1,4 +1,11 @@ class RenderControlFunctionXY: + """ + Render control for visualizing functions in XY space. + + This class manages the rendering settings for visualizing functions using heatmaps and contours. + """ + + # "ChatGPT 4o" assisted with generating this docstring. def __init__( self, draw_heatmap: bool = True, @@ -8,6 +15,27 @@ def __init__( colorbar_min_max: tuple[float, float] = None, bounds: tuple[float, float, float, float] = None, # unverified ) -> None: + """ + Render control for visualizing functions in XY space. + + This class manages the rendering settings for visualizing functions using heatmaps and contours. + + Parameters + ---------- + draw_heatmap : bool, optional + Whether to draw a heatmap representation of the function. By default, True. + draw_contours : bool, optional + Whether to draw contour lines for the function. By default, False. + cmap : str, optional + Colormap to use for the heatmap. By default, "jet". + colorbar : bool, optional + Whether to display a colorbar alongside the heatmap. By default, False. + colorbar_min_max : tuple[float, float], optional + Minimum and maximum values for the colorbar. By default, None. + bounds : tuple[float, float, float, float], optional + Bounds for the visualization area (xmin, xmax, ymin, ymax). By default, None (unverified). + """ + # "ChatGPT 4o" assisted with generating this docstring. self.draw_heatmap = draw_heatmap self.draw_contours = draw_contours self.cmap = cmap @@ -17,17 +45,68 @@ def __init__( def countours(**kwargs): + """ + Create a render control for drawing contours only. + + This function returns a `RenderControlFunctionXY` instance configured to draw only contour lines, + without the heatmap representation. + + Parameters + ---------- + **kwargs : keyword arguments + Additional keyword arguments to pass to the `RenderControlFunctionXY`. + + Returns + ------- + RenderControlFunctionXY + An instance of `RenderControlFunctionXY` configured to display contours only. + """ + # "ChatGPT 4o" assisted with generating this docstring. kwargs["draw_heatmap"] = False kwargs["draw_contours"] = True return RenderControlFunctionXY(**kwargs) def heatmap(**kwargs): + """ + Create a render control for drawing a heatmap. + + This function returns a `RenderControlFunctionXY` instance configured to draw a heatmap representation + of the function. + + Parameters + ---------- + **kwargs : keyword arguments + Additional keyword arguments to pass to the `RenderControlFunctionXY`. + + Returns + ------- + RenderControlFunctionXY + An instance of `RenderControlFunctionXY` configured to display a heatmap. + """ + # "ChatGPT 4o" assisted with generating this docstring. kwargs["draw_heatmap"] = True return RenderControlFunctionXY(**kwargs) def heatmap_and_contours(**kwargs): + """ + Create a render control for drawing both heatmap and contours. + + This function returns a `RenderControlFunctionXY` instance configured to draw both the heatmap + representation and contour lines for the function. + + Parameters + ---------- + **kwargs : keyword arguments + Additional keyword arguments to pass to the `RenderControlFunctionXY`. + + Returns + ------- + RenderControlFunctionXY + An instance of `RenderControlFunctionXY` configured to display both heatmap and contours. + """ + # "ChatGPT 4o" assisted with generating this docstring. kwargs["draw_contours"] = True kwargs["draw_heatmap"] = True return RenderControlFunctionXY(**kwargs) diff --git a/opencsp/common/lib/render_control/RenderControlHeliostat.py b/opencsp/common/lib/render_control/RenderControlHeliostat.py index 87b93e926..8f9d0c3ed 100644 --- a/opencsp/common/lib/render_control/RenderControlHeliostat.py +++ b/opencsp/common/lib/render_control/RenderControlHeliostat.py @@ -1,8 +1,3 @@ -""" - - -""" - import opencsp.common.lib.render_control.RenderControlFacetEnsemble as rcfe import opencsp.common.lib.render_control.RenderControlFacet as rcf import opencsp.common.lib.render_control.RenderControlMirror as rcm @@ -40,7 +35,30 @@ def __init__( name_style=rctxt.default(color='k'), # unimplmeneted post=0, # by default there is no post ): - + """ + Render control for heliostats. + + This class manages the rendering settings for heliostats, allowing customization of various visual + elements such as centroids, facet ensembles, and names. + + Parameters + ---------- + draw_centroid : bool, optional + Whether to draw the centroid of the heliostat. By default, False. + centroid_style : object, optional + Style for the centroid marker. By default, `rcps.marker()`. + draw_facet_ensemble : bool, optional + Whether to draw the facet ensemble. By default, True. + facet_ensemble_style : object, optional + Style for the facet ensemble. By default, `rcfe.RenderControlFacetEnsemble(rcf.outline())`. + draw_name : bool, optional + Whether to draw the name of the heliostat. By default, False (unimplemented). + name_style : object, optional + Style for the name text. By default, `rctxt.default(color='k')`. + post : int, optional + Identifier for the post associated with the heliostat. By default, 0 (no post). + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlHeliostat, self).__init__() self.draw_centroid = draw_centroid @@ -70,15 +88,57 @@ def __init__( def default(): + """ + Create a default render control for heliostats. + + This function returns a `RenderControlHeliostat` instance with default settings. + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlHeliostat() def blank(): + """ + Create a blank render control for heliostats. + + This function returns a `RenderControlHeliostat` instance with no visual elements drawn, + suitable for cases where heliostats are added as special cases. + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` with no visual elements. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Nothing. (Used for cases where heliostats are added as special cases.) return RenderControlHeliostat(draw_centroid=False, draw_facet_ensemble=False) def name(color='k', fontsize='medium'): + """ + Create a render control that displays only the name of the heliostat. + + This function returns a `RenderControlHeliostat` instance configured to draw the name + of the heliostat. + + Parameters + ---------- + color : str, optional + Color of the name text. By default, 'k' (black). + fontsize : str, optional + Font size of the name text. By default, 'medium'. + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display only the name. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Name only. return RenderControlHeliostat( draw_centroid=True, # Draw a tiny point to ensure that things will draw. @@ -90,6 +150,22 @@ def name(color='k', fontsize='medium'): def centroid(color='k'): + """ + Create a render control that displays only the centroid of the heliostat. + + This function returns a `RenderControlHeliostat` instance configured to draw only the centroid. + + Parameters + ---------- + color : str, optional + Color of the centroid marker. By default, 'k' (black). + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display only the centroid. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Centroid only. return RenderControlHeliostat( draw_centroid=True, centroid_style=rcps.marker(color=color), draw_facet_ensemble=False @@ -97,6 +173,23 @@ def centroid(color='k'): def centroid_name(color='k'): + """ + Create a render control that displays both the centroid and the name of the heliostat. + + This function returns a `RenderControlHeliostat` instance configured to draw both the centroid + and the name. + + Parameters + ---------- + color : str, optional + Color of the centroid marker. By default, 'k' (black). + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display both the centroid and the name. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Centroid and name. return RenderControlHeliostat( draw_centroid=True, @@ -110,6 +203,27 @@ def centroid_name(color='k'): def centroid_name_outline( color='k', horizontalalignment='center', verticalalignment='center' # center, right, left ): # center, top, bottom, baseline, center_baseline + """ + Create a render control that displays the centroid, name, and overall outline of the heliostat. + + This function returns a `RenderControlHeliostat` instance configured to draw the centroid, + the name, and the outline. + + Parameters + ---------- + color : str, optional + Color of the centroid marker and outline. By default, 'k' (black). + horizontalalignment : str, optional + Horizontal alignment of the name text. By default, 'center'. + verticalalignment : str, optional + Vertical alignment of the name text. By default, 'center'. + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display the centroid, name, and outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Name and overall outline. return RenderControlHeliostat( draw_centroid=True, @@ -124,6 +238,22 @@ def centroid_name_outline( def outline(color='k'): + """ + Create a render control that displays only the overall outline of the heliostat. + + This function returns a `RenderControlHeliostat` instance configured to draw only the outline. + + Parameters + ---------- + color : str, optional + Color of the outline. By default, 'k' (black). + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display only the outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Overall outline only. return RenderControlHeliostat( draw_centroid=False, draw_facet_ensemble=True, facet_ensemble_style=rcfe.only_outline(color=color) @@ -133,6 +263,26 @@ def outline(color='k'): def name_outline( color='k', horizontalalignment='center', verticalalignment='center' # center, right, left ): # center, top, bottom, baseline, center_baseline + """ + Create a render control that displays the name and overall outline of the heliostat. + + This function returns a `RenderControlHeliostat` instance configured to draw the name and the outline. + + Parameters + ---------- + color : str, optional + Color of the outline. By default, 'k' (black). + horizontalalignment : str, optional + Horizontal alignment of the name text. By default, 'center'. + verticalalignment : str, optional + Vertical alignment of the name text. By default, 'center'. + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display the name and outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Name and overall outline. return RenderControlHeliostat( draw_centroid=False, @@ -149,6 +299,23 @@ def name_outline( def facet_outlines_names(color='k'): + """ + Create a render control that displays facet outlines and facet name labels. + + This function returns a `RenderControlHeliostat` instance configured to draw the outlines of the facets + along with their corresponding names. + + Parameters + ---------- + color : str, optional + Color of the facet outlines and names. By default, 'k' (black). + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display facet outlines and names. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Facet outlines and facet name labels. return RenderControlHeliostat( draw_centroid=False, @@ -159,6 +326,24 @@ def facet_outlines_names(color='k'): def normal(color='k', normal_vector_length=DEFAULT_SURFACE_NORMAL_LENGTH): + """ + Create a render control that displays the overall surface normal of the heliostat. + + This function returns a `RenderControlHeliostat` instance configured to draw the surface normal. + + Parameters + ---------- + color : str, optional + Color of the surface normal. By default, 'k' (black). + normal_vector_length : float, optional + Length of the surface normal. By default, 4.0. + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display the surface normal. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Overall surface normal only. return RenderControlHeliostat( draw_centroid=True, @@ -172,6 +357,26 @@ def normal(color='k', normal_vector_length=DEFAULT_SURFACE_NORMAL_LENGTH): def normal_outline(color='k', normal_vector_length=DEFAULT_SURFACE_NORMAL_LENGTH, **kwargs): + """ + Create a render control that displays both the overall surface normal and the outline of the heliostat. + + This function returns a `RenderControlHeliostat` instance configured to draw the surface normal and the outline. + + Parameters + ---------- + color : str, optional + Color of the surface normal and outline. By default, 'k' (black). + normal_vector_length : float, optional + Length of the surface normal. By default, 4.0. + **kwargs : keyword arguments + Additional keyword arguments to pass to the `RenderControlHeliostat`. + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display the surface normal and outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Overall surface normal and overall outline. fe_style = rcfe.facet_ensemble_outline(color=color, normal_vector_length=normal_vector_length) return RenderControlHeliostat( @@ -180,6 +385,23 @@ def normal_outline(color='k', normal_vector_length=DEFAULT_SURFACE_NORMAL_LENGTH def normal_facet_outlines_names(color='k'): + """ + Create a render control that displays facet outlines and facet name labels with normal vectors. + + This function returns a `RenderControlHeliostat` instance configured to draw the outlines of the facets + along with their corresponding names and normal vectors. + + Parameters + ---------- + color : str, optional + Color of the facet outlines and names. By default, 'k' (black). + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display facet outlines, names, and normal vectors. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Facet outlines and facet name labels. fe_style = rcfe.RenderControlFacetEnsemble( draw_normal_vector=True, @@ -194,6 +416,24 @@ def normal_facet_outlines_names(color='k'): def mirror_surfaces(color='k', **kwargs): + """ + Create a render control that displays the mirror surfaces of the heliostat. + + This function returns a `RenderControlHeliostat` instance configured to draw the mirror surfaces. + + Parameters + ---------- + color : str, optional + Color of the mirror surfaces. By default, 'k' (black). + **kwargs : keyword arguments + Additional keyword arguments to pass to the `RenderControlHeliostat`. + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display the mirror surfaces. + """ + # "ChatGPT 4o" assisted with generating this docstring. fe_style = rcfe.RenderControlFacetEnsemble(rcf.normal_mirror_surface(color=color)) return RenderControlHeliostat( draw_centroid=False, draw_facet_ensemble=True, facet_ensemble_style=fe_style, **kwargs @@ -215,15 +455,67 @@ def mirror_surfaces(color='k', **kwargs): def normal_facet_outlines(color='k'): + """ + Create a render control that displays normal facet outlines. + + This function returns a `RenderControlHeliostat` instance configured to draw the outlines of the facets + with normal vectors. + + Parameters + ---------- + color : str, optional + Color of the facet outlines. By default, 'k' (black). + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display normal facet outlines. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlHeliostat(facet_ensemble_style=rcfe.normal_facet_outlines(color=color)) def facet_outlines(color='k', **kwargs): + """ + Create a render control that displays facet outlines only. + + This function returns a `RenderControlHeliostat` instance configured to draw only the outlines of the facets. + + Parameters + ---------- + color : str, optional + Color of the facet outlines. By default, 'k' (black). + **kwargs : keyword arguments + Additional keyword arguments to pass to the `RenderControlHeliostat`. + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display facet outlines only. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Facet outline only. return RenderControlHeliostat(facet_ensemble_style=rcfe.facet_outlines(color=color)) def facet_outlines_normals(color='k'): + """ + Create a render control that displays facet outlines with normal vectors. + + This function returns a `RenderControlHeliostat` instance configured to draw the outlines of the facets + along with their normal vectors. + + Parameters + ---------- + color : str, optional + Color of the facet outlines and normal vectors. By default, 'k' (black). + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured to display facet outlines with normal vectors. + """ + # "ChatGPT 4o" assisted with generating this docstring. fe_style = rcfe.RenderControlFacetEnsemble(default_style=rcf.normal_outline(color=color)) return RenderControlHeliostat(draw_facet_ensemble=True, facet_ensemble_style=fe_style) @@ -256,6 +548,18 @@ def facet_outlines_normals(color='k'): def low_res_heliostat(): + """ + Create a low-resolution render control for heliostats. + + This function returns a `RenderControlHeliostat` instance configured for low-resolution rendering + of the heliostat, with specific styles for facets. + + Returns + ------- + RenderControlHeliostat + An instance of `RenderControlHeliostat` configured for low-resolution rendering. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlHeliostat( facet_ensemble_style=rcfe.RenderControlFacetEnsemble( default_style=rcf.RenderControlFacet( diff --git a/opencsp/common/lib/render_control/RenderControlHeliostatTracks.py b/opencsp/common/lib/render_control/RenderControlHeliostatTracks.py index 9e36a09c9..6cac91bb7 100644 --- a/opencsp/common/lib/render_control/RenderControlHeliostatTracks.py +++ b/opencsp/common/lib/render_control/RenderControlHeliostatTracks.py @@ -1,9 +1,3 @@ -""" - - -""" - - class RenderControlHeliostatTracks: """ Render control for the UFACET pipeline step HeliostatTracks. @@ -25,6 +19,42 @@ def __init__( heliostat_tracks_dpi=200, # Dpi for saving figure to disk. heliostat_tracks_crop=True, # Whether to crop annotations outside image frame. ): + """ + Render control for the UFACET pipeline step HeliostatTracks. + + This class manages the rendering settings for the HeliostatTracks step in the UFACET pipeline, + allowing customization of various visual elements related to heliostat tracks. + + Parameters + ---------- + clear_previous : bool, optional + Whether to remove any existing files in the designated output directory. By default, True. + draw_heliostat_tracks : bool, optional + Whether to draw the video track figures for heliostats. By default, True. + heliostat_tracks_points_marker : str, optional + Marker style for the video track points. By default, 'o'. + heliostat_tracks_points_markersize : float, optional + Size of the marker for video track points. By default, 1.5. + heliostat_tracks_points_color : str, optional + Color for the video track points. By default, 'm' (magenta). + heliostat_tracks_label_horizontalalignment : str, optional + Horizontal alignment for the heliostat label. By default, 'center'. + heliostat_tracks_label_verticalalignment : str, optional + Vertical alignment for the heliostat label. By default, 'center'. + heliostat_tracks_label_fontsize : int, optional + Font size for the heliostat label. By default, 6. + heliostat_tracks_label_fontstyle : str, optional + Font style for the heliostat label. By default, 'normal'. + heliostat_tracks_label_fontweight : str, optional + Font weight for the heliostat label. By default, 'bold'. + heliostat_tracks_label_color : str, optional + Color for the heliostat label. By default, 'm' (magenta). + heliostat_tracks_dpi : int, optional + DPI (dots per inch) for saving figures to disk. By default, 200. + heliostat_tracks_crop : bool, optional + Whether to crop annotations outside the image frame. By default, True. + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlHeliostatTracks, self).__init__() self.clear_previous = clear_previous @@ -46,8 +76,37 @@ def __init__( def default(color='m'): + """ + Create a default render control for heliostat tracks. + + This function returns a `RenderControlHeliostatTracks` instance with default settings, + using the specified color for the points and labels. + + Parameters + ---------- + color : str, optional + Color for the video track points and heliostat labels. By default, 'm' (magenta). + + Returns + ------- + RenderControlHeliostatTracks + An instance of `RenderControlHeliostatTracks` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlHeliostatTracks(heliostat_tracks_points_color=color, heliostat_tracks_label_color=color) def fast(): + """ + Create a fast render control for heliostat tracks. + + This function returns a `RenderControlHeliostatTracks` instance configured to skip + drawing the heliostat tracks, which can speed up the rendering process. + + Returns + ------- + RenderControlHeliostatTracks + An instance of `RenderControlHeliostatTracks` configured for fast rendering. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlHeliostatTracks(draw_heliostat_tracks=False) diff --git a/opencsp/common/lib/render_control/RenderControlHeliostats3d.py b/opencsp/common/lib/render_control/RenderControlHeliostats3d.py index 5433526e5..3a9d62c3a 100644 --- a/opencsp/common/lib/render_control/RenderControlHeliostats3d.py +++ b/opencsp/common/lib/render_control/RenderControlHeliostats3d.py @@ -1,9 +1,3 @@ -""" - - -""" - - class RenderControlHeliostats3d: """ Render control for the UFACET pipeline step Heliostats3d. @@ -25,6 +19,42 @@ def __init__( heliostats_3d_dpi=200, # Dpi for saving figure to disk. heliostats_3d_crop=True, # Whether to crop annotations outside image frame. ): + """ + Render control for the UFACET pipeline step Heliostats3d. + + This class manages the rendering settings for the Heliostats3d step in the UFACET pipeline, + allowing customization of various visual elements related to 3D heliostat tracks. + + Parameters + ---------- + clear_previous : bool, optional + Whether to remove any existing files in the designated output directory. By default, True. + draw_heliostats_3d : bool, optional + Whether to draw the 3D video track figures for heliostats. By default, True. + heliostats_3d_points_marker : str, optional + Marker style for the 3D video track points. By default, 'o'. + heliostats_3d_points_markersize : float, optional + Size of the marker for 3D video track points. By default, 1.5. + heliostats_3d_points_color : str, optional + Color for the 3D video track points. By default, 'm' (magenta). + heliostats_3d_label_horizontalalignment : str, optional + Horizontal alignment for the heliostat label. By default, 'center'. + heliostats_3d_label_verticalalignment : str, optional + Vertical alignment for the heliostat label. By default, 'center'. + heliostats_3d_label_fontsize : int, optional + Font size for the heliostat label. By default, 6. + heliostats_3d_label_fontstyle : str, optional + Font style for the heliostat label. By default, 'normal'. + heliostats_3d_label_fontweight : str, optional + Font weight for the heliostat label. By default, 'bold'. + heliostats_3d_label_color : str, optional + Color for the heliostat label. By default, 'm' (magenta). + heliostats_3d_dpi : int, optional + DPI (dots per inch) for saving figures to disk. By default, 200. + heliostats_3d_crop : bool, optional + Whether to crop annotations outside the image frame. By default, True. + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlHeliostats3d, self).__init__() self.clear_previous = clear_previous @@ -46,8 +76,37 @@ def __init__( def default(color='m'): + """ + Create a default render control for 3D heliostats. + + This function returns a `RenderControlHeliostats3d` instance with default settings, + using the specified color for the points and labels. + + Parameters + ---------- + color : str, optional + Color for the 3D video track points and heliostat labels. By default, 'm' (magenta). + + Returns + ------- + RenderControlHeliostats3d + An instance of `RenderControlHeliostats3d` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlHeliostats3d(heliostats_3d_points_color=color, heliostats_3d_label_color=color) def fast(): + """ + Create a fast render control for 3D heliostats. + + This function returns a `RenderControlHeliostats3d` instance configured to skip + drawing the 3D heliostat tracks, which can speed up the rendering process. + + Returns + ------- + RenderControlHeliostats3d + An instance of `RenderControlHeliostats3d` configured for fast rendering. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlHeliostats3d(draw_heliostats_3d=False) diff --git a/opencsp/common/lib/render_control/RenderControlKeyCorners.py b/opencsp/common/lib/render_control/RenderControlKeyCorners.py index 13ce73828..3a3de7c04 100644 --- a/opencsp/common/lib/render_control/RenderControlKeyCorners.py +++ b/opencsp/common/lib/render_control/RenderControlKeyCorners.py @@ -1,9 +1,3 @@ -""" - - -""" - - class RenderControlKeyCorners: """ Render control for the UFACET pipeline step KeyCorners. @@ -25,6 +19,42 @@ def __init__( key_corners_dpi=200, # Dpi for saving figure to disk. key_corners_crop=False, # Whether to crop annotations outside image frame. ): + """ + Render control for the UFACET pipeline step KeyCorners. + + This class manages the rendering settings for the KeyCorners step in the UFACET pipeline, + allowing customization of various visual elements related to key corners. + + Parameters + ---------- + clear_previous : bool, optional + Whether to remove any existing files in the designated output directory. By default, True. + draw_key_corners : bool, optional + Whether to draw the key corner figures. By default, True. + key_corners_points_marker : str, optional + Marker style for the key corner points. By default, 'o'. + key_corners_points_markersize : float, optional + Size of the marker for key corner points. By default, 1.5. + key_corners_points_color : str, optional + Color for the key corner points. By default, 'm' (magenta). + key_corners_label_horizontalalignment : str, optional + Horizontal alignment for the key corner label. By default, 'center'. + key_corners_label_verticalalignment : str, optional + Vertical alignment for the key corner label. By default, 'center'. + key_corners_label_fontsize : int, optional + Font size for the key corner label. By default, 6. + key_corners_label_fontstyle : str, optional + Font style for the key corner label. By default, 'normal'. + key_corners_label_fontweight : str, optional + Font weight for the key corner label. By default, 'bold'. + key_corners_label_color : str, optional + Color for the key corner label. By default, 'm' (magenta). + key_corners_dpi : int, optional + DPI (dots per inch) for saving figures to disk. By default, 200. + key_corners_crop : bool, optional + Whether to crop annotations outside the image frame. By default, False. + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlKeyCorners, self).__init__() self.clear_previous = clear_previous @@ -99,8 +129,31 @@ def __init__( def default(): + """ + Create a default render control for key corners. + + This function returns a `RenderControlKeyCorners` instance with default settings. + + Returns + ------- + RenderControlKeyCorners + An instance of `RenderControlKeyCorners` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlKeyCorners() def fast(): + """ + Create a fast render control for key corners. + + This function returns a `RenderControlKeyCorners` instance configured to skip + drawing the key corner figures, which can speed up the rendering process. + + Returns + ------- + RenderControlKeyCorners + An instance of `RenderControlKeyCorners` configured for fast rendering. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlKeyCorners(draw_key_corners=False) diff --git a/opencsp/common/lib/render_control/RenderControlKeyFramesGivenManual.py b/opencsp/common/lib/render_control/RenderControlKeyFramesGivenManual.py index ed5071e7e..085c95946 100644 --- a/opencsp/common/lib/render_control/RenderControlKeyFramesGivenManual.py +++ b/opencsp/common/lib/render_control/RenderControlKeyFramesGivenManual.py @@ -1,9 +1,3 @@ -""" - - -""" - - class RenderControlKeyFramesGivenManual: """ Render control for the UFACET pipeline step KeyFrames (manual input version). @@ -24,6 +18,40 @@ def __init__( key_frame_dpi=200, # Dpi for saving figure to disk. key_frame_crop=False, # Whether to crop annotations outside image frame. ): + """ + Render control for the UFACET pipeline step KeyFrames (manual input version). + + This class manages the rendering settings for the KeyFrames step in the UFACET pipeline, + allowing customization of various visual elements related to manually input key frames. + + Parameters + ---------- + clear_previous : bool, optional + Whether to remove any existing files in the designated output directory. By default, True. + draw_key_frames : bool, optional + Whether to draw the key frame figures. By default, True. + key_frame_polygon_linewidth : float, optional + Line width for the expected heliostat polygon. By default, 3. + key_frame_polygon_color : str, optional + Color for the expected heliostat polygon. By default, 'm' (magenta). + key_frame_label_horizontalalignment : str, optional + Horizontal alignment for the heliostat label. By default, 'center'. + key_frame_label_verticalalignment : str, optional + Vertical alignment for the heliostat label. By default, 'center'. + key_frame_label_fontsize : int, optional + Font size for the heliostat label. By default, 10. + key_frame_label_fontstyle : str, optional + Font style for the heliostat label. By default, 'normal'. + key_frame_label_fontweight : str, optional + Font weight for the heliostat label. By default, 'bold'. + key_frame_label_color : str, optional + Color for the heliostat label. By default, 'm' (magenta). + key_frame_dpi : int, optional + DPI (dots per inch) for saving figures to disk. By default, 200. + key_frame_crop : bool, optional + Whether to crop annotations outside the image frame. By default, False. + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlKeyFramesGivenManual, self).__init__() self.clear_previous = clear_previous @@ -44,8 +72,31 @@ def __init__( def default(): + """ + Create a default render control for key frames. + + This function returns a `RenderControlKeyFramesGivenManual` instance with default settings. + + Returns + ------- + RenderControlKeyFramesGivenManual + An instance of `RenderControlKeyFramesGivenManual` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlKeyFramesGivenManual() def fast(): + """ + Create a fast render control for key frames. + + This function returns a `RenderControlKeyFramesGivenManual` instance configured to skip + drawing the key frame figures, which can speed up the rendering process. + + Returns + ------- + RenderControlKeyFramesGivenManual + An instance of `RenderControlKeyFramesGivenManual` configured for fast rendering. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlKeyFramesGivenManual(draw_key_frames=False) diff --git a/opencsp/common/lib/render_control/RenderControlKeyTracks.py b/opencsp/common/lib/render_control/RenderControlKeyTracks.py index f855a2254..47fd06e35 100644 --- a/opencsp/common/lib/render_control/RenderControlKeyTracks.py +++ b/opencsp/common/lib/render_control/RenderControlKeyTracks.py @@ -1,9 +1,3 @@ -""" - - -""" - - class RenderControlKeyTracks: """ Render control for the UFACET pipeline step KeyTracks. @@ -25,6 +19,42 @@ def __init__( key_tracks_dpi=200, # Dpi for saving figure to disk. key_tracks_crop=False, # Whether to crop annotations outside image frame. ): + """ + Render control for the UFACET pipeline step KeyTracks. + + This class manages the rendering settings for the KeyTracks step in the UFACET pipeline, + allowing customization of various visual elements related to key frame tracks. + + Parameters + ---------- + clear_previous : bool, optional + Whether to remove any existing files in the designated output directory. By default, True. + draw_key_tracks : bool, optional + Whether to draw the key frame track figures. By default, True. + key_tracks_points_marker : str, optional + Marker style for the key frame track points. By default, 'o'. + key_tracks_points_markersize : float, optional + Size of the marker for key frame track points. By default, 1.5. + key_tracks_points_color : str, optional + Color for the key frame track points. By default, 'm' (magenta). + key_tracks_label_horizontalalignment : str, optional + Horizontal alignment for the key track label. By default, 'center'. + key_tracks_label_verticalalignment : str, optional + Vertical alignment for the key track label. By default, 'center'. + key_tracks_label_fontsize : int, optional + Font size for the key track label. By default, 6. + key_tracks_label_fontstyle : str, optional + Font style for the key track label. By default, 'normal'. + key_tracks_label_fontweight : str, optional + Font weight for the key track label. By default, 'bold'. + key_tracks_label_color : str, optional + Color for the key track label. By default, 'm' (magenta). + key_tracks_dpi : int, optional + DPI (dots per inch) for saving figures to disk. By default, 200. + key_tracks_crop : bool, optional + Whether to crop annotations outside the image frame. By default, False. + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlKeyTracks, self).__init__() self.clear_previous = clear_previous @@ -46,8 +76,31 @@ def __init__( def default(): + """ + Create a default render control for key tracks. + + This function returns a `RenderControlKeyTracks` instance with default settings. + + Returns + ------- + RenderControlKeyTracks + An instance of `RenderControlKeyTracks` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlKeyTracks() def fast(): + """ + Create a fast render control for key tracks. + + This function returns a `RenderControlKeyTracks` instance configured to skip + drawing the key frame track figures, which can speed up the rendering process. + + Returns + ------- + RenderControlKeyTracks + An instance of `RenderControlKeyTracks` configured for fast rendering. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlKeyTracks(draw_key_tracks=False) diff --git a/opencsp/common/lib/render_control/RenderControlLightPath.py b/opencsp/common/lib/render_control/RenderControlLightPath.py index e2ca02310..f67ea8acd 100644 --- a/opencsp/common/lib/render_control/RenderControlLightPath.py +++ b/opencsp/common/lib/render_control/RenderControlLightPath.py @@ -4,6 +4,14 @@ class RenderControlLightPath: + """ + Render control for visualizing light paths. + + This class manages the rendering settings for light paths, allowing customization of various + parameters related to the light path's length and rendering. + """ + + # "ChatGPT 4o" assisted with generating this docstring. def __init__( self, init_length: float = 1, @@ -11,6 +19,25 @@ def __init__( end_at_plane: tuple[Pxyz, Uxyz] = None, line_render_control: float = rcps.thin(), ) -> None: + """ + Render control for visualizing light paths. + + This class manages the rendering settings for light paths, allowing customization of various + parameters related to the light path's length and rendering. + + Parameters + ---------- + init_length : float, optional + The initial length of the light path. By default, 1.0. + current_length : float, optional + The current length of the light path. By default, 1.0. + end_at_plane : tuple[Pxyz, Uxyz], optional + A tuple containing the position (Pxyz) and orientation (Uxyz) of the plane where the light path ends. + By default, None. + line_render_control : RenderControlPointSeq, optional + Control settings for rendering the light path line. By default, `rcps.thin()`. + """ + # "ChatGPT 4o" assisted with generating this docstring. self.init_length = init_length self.current_length = current_length self.end_at_plane = end_at_plane @@ -21,8 +48,35 @@ def __init__( def default_path() -> RenderControlLightPath: + """ + Create a default render control for light paths. + + This function returns a `RenderControlLightPath` instance with default settings. + + Returns + ------- + RenderControlLightPath + An instance of `RenderControlLightPath` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlLightPath() def end_at_plane(plane: tuple[Pxyz, Uxyz]): + """ + Create a render control for a light path that ends at a specified plane. + + This function returns a `RenderControlLightPath` instance configured to end at the specified plane. + + Parameters + ---------- + plane : tuple[Pxyz, Uxyz] + A tuple containing the position (Pxyz) and orientation (Uxyz) of the plane where the light path ends. + + Returns + ------- + RenderControlLightPath + An instance of `RenderControlLightPath` configured to end at the specified plane. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlLightPath(end_at_plane=plane) diff --git a/opencsp/common/lib/render_control/RenderControlPointSeq.py b/opencsp/common/lib/render_control/RenderControlPointSeq.py index d92fffabd..21d847b14 100644 --- a/opencsp/common/lib/render_control/RenderControlPointSeq.py +++ b/opencsp/common/lib/render_control/RenderControlPointSeq.py @@ -1,8 +1,3 @@ -""" - - -""" - import matplotlib.colors import opencsp.common.lib.render.Color as cl @@ -91,40 +86,36 @@ def __init__( vector_scale: float = 1.0, # Facter to grow/srhink vector length, for points in a vector field. ): """ + Initialize the rendering control for point sequences. + + Parameters + ---------- linestyle : str - Determines how lines are drawn. One of '-', '--', '-.', ':', '' or - 'None'. Default is '-' (solid line). + Determines how lines are drawn. One of '-', '--', '-.', ':', '' or 'None'. Default is '-'. linewidth : float - Width of lines in the number of pixels. Default is 1. + Width of lines in pixels. Default is 1. color : str | Color - The primary color use for everything that doesn't have a color - specified. If a Color object then the rgb() value of the Color - object will be used. Default is 'b'. + The primary color used for everything that doesn't have a color specified. Default is 'b'. marker : str | None, optional - The style of marker to use. See the class description for more - information. Default is point '.'. + The style of marker to use. See the class description for more information. Default is 'x'. markersize : float, optional - Size of the marker, in pixels. Default is 6. + Size of the marker in pixels. Default is 6. markeredgecolor : str | Color | None, optional - The color of the marker edges. Default is 'color'. + The color of the marker edges. Default is the same as `color`. markeredgewidth : float | None, optional - Width of the marker edge in pixels. Defaults is 'linewidth'. + Width of the marker edge in pixels. Defaults to `linewidth`. markerfacecolor : str | Color | None, optional - The color of the marker faces. Default is 'color'. + The color of the marker faces. Default is the same as `color`. markeralpha : float | None, optional - The alpha value (transparency) with which to draw the markers, where - 0=fully transparent and 1=fully opaque. None for matplotlib default - style. Default is None. + The alpha value (transparency) for the markers, where 0 is fully transparent and 1 is fully opaque. Default is None. vector_color : str | Color | None, optional - The color for vectors. Only applies to points in a vector field. - Default is 'b'. + The color for vectors. Only applies to points in a vector field. Default is 'b'. vector_linewidth : float, optional - The line width for vectors, in pixels. Only applies to points in a - vector field. default is 1. + The line width for vectors, in pixels. Only applies to points in a vector field. Default is 1. vector_scale : float, optional - Facter to grow/srhink vector length. Only applies to points in a - vector field. Default is 1. + Factor to grow/shrink vector length. Only applies to points in a vector field. Default is 1. """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlPointSeq, self).__init__() # Set defaults. @@ -195,36 +186,128 @@ def _standardize_color_values(self): def default(marker='.', color='b', linewidth=1, markersize=8): """ - What to draw if no particular preference is expressed. + Create a default render control for point sequences. + + This function returns a `RenderControlPointSeq` instance with default settings. + + Parameters + ---------- + marker : str, optional + Marker style for the points. By default, '.' (point marker). + color : str, optional + Color for the points. By default, 'b' (blue). + linewidth : float, optional + Line width for connecting lines. By default, 1. + markersize : float, optional + Size of the marker in pixels. By default, 8. + + Returns + ------- + RenderControlPointSeq + An instance of `RenderControlPointSeq` configured with default parameters. """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlPointSeq(linestyle='-', linewidth=linewidth, color=color, marker=marker, markersize=markersize) def outline(color='k', linewidth=1): """ - Outlines of physical objects. + Create a render control for outlines of physical objects. + + This function returns a `RenderControlPointSeq` instance configured to draw outlines only. + + Parameters + ---------- + color : str, optional + Color for the outlines. By default, 'k' (black). + linewidth : float, optional + Line width for the outlines. By default, 1. + + Returns + ------- + RenderControlPointSeq + An instance of `RenderControlPointSeq` configured to display outlines only. """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlPointSeq(linestyle='-', linewidth=linewidth, color=color, marker='None') def data_curve(color='b', linewidth=1, marker='.', markersize=3) -> RenderControlPointSeq: """ - A data curve with data points identified. + Create a render control for a data curve with identified data points. + + This function returns a `RenderControlPointSeq` instance configured to draw a data curve + with specified data points. + + Parameters + ---------- + color : str, optional + Color for the data curve. By default, 'b' (blue). + linewidth : float, optional + Line width for the data curve. By default, 1. + marker : str, optional + Marker style for the data points. By default, '.' (point marker). + markersize : float, optional + Size of the marker in pixels. By default, 3. + + Returns + ------- + RenderControlPointSeq + An instance of `RenderControlPointSeq` configured for a data curve. """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlPointSeq(linestyle='-', linewidth=linewidth, color=color, marker=marker, markersize=markersize) def marker(marker='o', color='b', markersize=3) -> RenderControlPointSeq: """ - A data curve with data points identified. + Create a render control for displaying markers. + + This function returns a `RenderControlPointSeq` instance configured to display markers. + + Parameters + ---------- + marker : str, optional + Marker style for the points. By default, 'o' (circle marker). + color : str, optional + Color for the markers. By default, 'b' (blue). + markersize : float, optional + Size of the marker in pixels. By default, 3. + + Returns + ------- + RenderControlPointSeq + An instance of `RenderControlPointSeq` configured to display markers. """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlPointSeq(linestyle='None', color=color, marker=marker, markersize=markersize) def vector_field(marker='.', color='b', markersize=3, vector_linewidth=1, vector_scale=1.0) -> RenderControlPointSeq: """ - A field of vector needles. + Create a render control for a field of vector needles. + + This function returns a `RenderControlPointSeq` instance configured to draw a field of vectors. + + Parameters + ---------- + marker : str, optional + Marker style for the points. By default, '.' (point marker). + color : str, optional + Color for the vector needles. By default, 'b' (blue). + markersize : float, optional + Size of the marker in pixels. By default, 3. + vector_linewidth : float, optional + Line width for the vector needles. By default, 1. + vector_scale : float, optional + Factor to grow/shrink vector length. By default, 1.0. + + Returns + ------- + RenderControlPointSeq + An instance of `RenderControlPointSeq` configured for a vector field. """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlPointSeq( linestyle='None', color=color, @@ -237,4 +320,24 @@ def vector_field(marker='.', color='b', markersize=3, vector_linewidth=1, vector def thin(marker=',', linewidth=0.3, color='y') -> RenderControlPointSeq: + """ + Create a render control for a thin line style. + + This function returns a `RenderControlPointSeq` instance configured for a thin line style. + + Parameters + ---------- + marker : str, optional + Marker style for the points. By default, ',' (pixel marker). + linewidth : float, optional + Line width for the points. By default, 0.3. + color : str, optional + Color for the points. By default, 'y' (yellow). + + Returns + ------- + RenderControlPointSeq + An instance of `RenderControlPointSeq` configured for a thin line style. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlPointSeq(color=color, marker=marker, linewidth=linewidth) diff --git a/opencsp/common/lib/render_control/RenderControlPowerpointPresentation.py b/opencsp/common/lib/render_control/RenderControlPowerpointPresentation.py index e0b2048e1..024e73f3d 100644 --- a/opencsp/common/lib/render_control/RenderControlPowerpointPresentation.py +++ b/opencsp/common/lib/render_control/RenderControlPowerpointPresentation.py @@ -9,6 +9,8 @@ class RenderControlPowerpointPresentation: + """Create a new presentation instance to which to add slides.""" + def __init__(self, new_slides: list[pps.PowerpointSlide] = None, existing_presentation_path_name_ext: str = None): """Create a new presentation instance to which to add slides. diff --git a/opencsp/common/lib/render_control/RenderControlSolarField.py b/opencsp/common/lib/render_control/RenderControlSolarField.py index 36eb79fc5..257252182 100644 --- a/opencsp/common/lib/render_control/RenderControlSolarField.py +++ b/opencsp/common/lib/render_control/RenderControlSolarField.py @@ -1,8 +1,3 @@ -""" - - -""" - from warnings import warn import opencsp.common.lib.render_control.RenderControlEnsemble as rce import opencsp.common.lib.render_control.RenderControlHeliostat as rch @@ -14,8 +9,13 @@ class RenderControlSolarField: """ Render control for solar fields. + + This class manages the rendering settings for solar fields, allowing customization of various + visual elements related to heliostats and their configurations. """ + # "ChatGPT 4o" assisted with generating this docstring. + def __init__( self, # draw_outline=True, # unimplemented @@ -27,7 +27,30 @@ def __init__( name_style=rctxt.default(color='k'), special_styles: dict[str, rch.RenderControlHeliostat] = None, ): - + """ + Render control for solar fields. + + This class manages the rendering settings for solar fields, allowing customization of various + visual elements related to heliostats and their configurations. + + Parameters + ---------- + clear_previous : bool, optional + Whether to remove any existing files in the designated output directory. By default, True. + draw_origin : bool, optional + Whether to draw the origin point of the solar field. By default, False. + draw_heliostats : bool, optional + Whether to draw the heliostats in the solar field. By default, True. + heliostat_styles : RenderControlHeliostat, optional + Styles for rendering the heliostats. By default, an instance of `RenderControlHeliostat()`. + draw_name : bool, optional + Whether to draw the names of the heliostats. By default, False (unimplemented). + name_style : RenderControlText, optional + Style for the names of the heliostats. By default, `rctxt.default(color='k')`. + special_styles : dict[str, RenderControlHeliostat], optional + A dictionary mapping heliostat names to their specialized rendering styles. By default, None. + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlSolarField, self).__init__() # self.draw_outline = draw_outline @@ -73,10 +96,37 @@ def add_special_names(self, heliostat_names: str | list, heliostat_style: rch.Re def default(): + """ + Create a default render control for solar fields. + + This function returns a `RenderControlSolarField` instance with default settings. + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlSolarField() def outline(color='k'): + """ + Create a render control that displays only the overall outline of the solar field. + + This function returns a `RenderControlSolarField` instance configured to draw only the outline. + + Parameters + ---------- + color : str, optional + Color for the outline. By default, 'k' (black). + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` configured to display only the outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Overall field outline only. return RenderControlSolarField( draw_outline=True, outline_style=rcps.outline(color=color), draw_heliostats=False, draw_name=False @@ -84,35 +134,154 @@ def outline(color='k'): def heliostat_blanks(color='k'): + """ + Create a render control that draws nothing for heliostats. + + This function returns a `RenderControlSolarField` instance configured to not draw any heliostats, + allowing for special rendering categories to be added later. + + Parameters + ---------- + color : str, optional + Color for the heliostat outlines. By default, 'k' (black). + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` with no heliostats drawn. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Draw nothing. Heliostats will be added as special rendering categories. return RenderControlSolarField(draw_heliostats=True, heliostat_styles=(rch.blank()), draw_name=False) def heliostat_names(color='k'): + """ + Create a render control that displays the names of the heliostats. + + This function returns a `RenderControlSolarField` instance configured to draw the heliostats + with their corresponding names. + + Parameters + ---------- + color : str, optional + Color for the heliostat names. By default, 'k' (black). + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` configured to display heliostat names. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlSolarField(draw_heliostats=True, heliostat_styles=rch.name(color=color), draw_name=False) def heliostat_centroids(color='k'): + """ + Create a render control that displays the centroids of the heliostats. + + This function returns a `RenderControlSolarField` instance configured to draw the centroids + of the heliostats. + + Parameters + ---------- + color : str, optional + Color for the centroid markers. By default, 'k' (black). + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` configured to display heliostat centroids. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlSolarField(draw_heliostats=True, heliostat_styles=(rch.centroid(color=color)), draw_name=False) def heliostat_centroids_names(color='k'): + """ + Create a render control that displays both the centroids and names of the heliostats. + + This function returns a `RenderControlSolarField` instance configured to draw the centroids + and names of the heliostats. + + Parameters + ---------- + color : str, optional + Color for the centroid markers and names. By default, 'k' (black). + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` configured to display both centroids and names. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlSolarField( draw_heliostats=True, heliostat_styles=(rch.centroid_name(color=color)), draw_name=False ) def heliostat_outlines(color='k'): + """ + Create a render control that displays outlines of the heliostats. + + This function returns a `RenderControlSolarField` instance configured to draw the outlines + of the heliostats. + + Parameters + ---------- + color : str, optional + Color for the heliostat outlines. By default, 'k' (black). + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` configured to display heliostat outlines. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlSolarField(draw_heliostats=True, heliostat_styles=(rch.outline(color=color)), draw_name=False) def heliostat_normals_outlines(color='k'): + """ + Create a render control that displays heliostat outlines with normal vectors. + + This function returns a `RenderControlSolarField` instance configured to draw the outlines + of the heliostats along with their normal vectors. + + Parameters + ---------- + color : str, optional + Color for the heliostat outlines and normal vectors. By default, 'k' (black). + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` configured to display heliostat outlines with normals. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlSolarField( draw_heliostats=True, heliostat_styles=(rch.normal_outline(color=color)), draw_name=False ) def heliostat_outlines_names(color='k'): + """ + Create a render control that displays heliostat outlines and names. + + This function returns a `RenderControlSolarField` instance configured to draw the outlines + of the heliostats along with their corresponding names. + + Parameters + ---------- + color : str, optional + Color for the heliostat outlines and names. By default, 'k' (black). + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` configured to display heliostat outlines and names. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlSolarField( draw_heliostats=True, heliostat_styles=(rch.name_outline(color=color)), draw_name=False ) @@ -121,6 +290,27 @@ def heliostat_outlines_names(color='k'): def heliostat_centroids_outlines_names( color='k', horizontalalignment='center', verticalalignment='center' # center, right, left ): # center, top, bottom, baseline, center_baseline + """ + Create a render control that displays heliostat centroids, outlines, and names. + + This function returns a `RenderControlSolarField` instance configured to draw the centroids, + outlines, and names of the heliostats. + + Parameters + ---------- + color : str, optional + Color for the centroid markers and outlines. By default, 'k' (black). + horizontalalignment : str, optional + Horizontal alignment of the name text. By default, 'center'. + verticalalignment : str, optional + Vertical alignment of the name text. By default, 'center'. + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` configured to display centroids, outlines, and names. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlSolarField( draw_heliostats=True, heliostat_styles=( @@ -133,6 +323,25 @@ def heliostat_centroids_outlines_names( def heliostat_vector_field(color='k', vector_length=9): + """ + Create a render control that displays a vector field for heliostats. + + This function returns a `RenderControlSolarField` instance configured to draw the heliostats + with normal vectors representing their orientations. + + Parameters + ---------- + color : str, optional + Color for the vector field. By default, 'k' (black). + vector_length : float, optional + Length of the vectors. By default, 9. + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` configured to display a vector field for heliostats. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlSolarField( draw_heliostats=True, heliostat_styles=(rch.normal(color=color, normal_vector_length=vector_length)), @@ -141,6 +350,25 @@ def heliostat_vector_field(color='k', vector_length=9): def heliostat_vector_field_outlines(color='k', vector_length=9): + """ + Create a render control that displays a vector field with outlines for heliostats. + + This function returns a `RenderControlSolarField` instance configured to draw the heliostats + with outlines and normal vectors representing their orientations. + + Parameters + ---------- + color : str, optional + Color for the outlines and vectors. By default, 'k' (black). + vector_length : float, optional + Length of the vectors. By default, 9. + + Returns + ------- + RenderControlSolarField + An instance of `RenderControlSolarField` configured to display a vector field with outlines. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlSolarField( # outline_style=rcps.outline(color=color), draw_heliostats=True, diff --git a/opencsp/common/lib/render_control/RenderControlTower.py b/opencsp/common/lib/render_control/RenderControlTower.py index 93582149f..a53c8bf0c 100755 --- a/opencsp/common/lib/render_control/RenderControlTower.py +++ b/opencsp/common/lib/render_control/RenderControlTower.py @@ -6,8 +6,13 @@ class RenderControlTower: """ Render control for towers. + + This class manages the rendering settings for towers, allowing customization of various visual + elements related to the tower's representation. """ + # "ChatGPT 4o" assisted with generating this docstring. + def __init__( self, centroid=False, @@ -19,25 +24,29 @@ def __init__( target: RenderControlPointSeq = None, ) -> None: """ - Controls for rendering a tower. + Render control for towers. + + This class manages the rendering settings for towers, allowing customization of various visual + elements related to the tower's representation. Parameters ---------- centroid : bool, optional - If True, centroid will be drawn on graph as origin of tower. Default is False. + If True, the centroid will be drawn on the graph as the origin of the tower. Default is False. draw_name : bool, optional - If True then the name will be drawn on graph. Default is False. - name_style : None | str - If draw_name = True, then styles name using RenderControlText. By default from RenderControlText, color 'black'. - draw_outline : bool - Draws outline of Tower using wire_frame style. Default is True. - point_styles : RenderControlPointSeq - Draws target as a point on the Tower. - wire_frame : RenderControlPointSeq - Outline style of Tower, that draws walls edges. Default is RenderControlSeq outline, color 'black', linewidth '1'. - target : RenderControlPointSeq - If target, draws a point on Tower. Default color is 'red', with shape 'x', markersize '6'. + If True, the name of the tower will be drawn on the graph. Default is False. + name_style : None | str, optional + If `draw_name` is True, styles the name using `RenderControlText`. By default, it uses the default style from `RenderControlText`, with color 'black'. + draw_outline : bool, optional + If True, draws the outline of the tower using the wire frame style. Default is True. + point_styles : RenderControlPointSeq, optional + Styles for drawing the target as a point on the tower. Default is None. + wire_frame : RenderControlPointSeq, optional + Outline style of the tower that draws the walls and edges. Default is `RenderControlPointSeq` outline with color 'black' and linewidth '1'. + target : RenderControlPointSeq, optional + If provided, draws a point on the tower. Default is a red 'x' marker with a size of 6. """ + # "ChatGPT 4o" assisted with generating this docstring. # default values if name_style is None: @@ -68,10 +77,34 @@ def style(self, any): def normal_tower(): + """ + Create a render control for a normal tower. + + This function returns a `RenderControlTower` instance configured to display the overall outline + of the tower. + + Returns + ------- + RenderControlTower + An instance of `RenderControlTower` configured for a normal tower outline. + """ + # "ChatGPT 4o" assisted with generating this docstring. # Overall tower outline only. return RenderControlTower() def no_target(): + """ + Create a render control for a tower outline without a target. + + This function returns a `RenderControlTower` instance configured to draw the tower outline + without any target point. + + Returns + ------- + RenderControlTower + An instance of `RenderControlTower` configured to display the tower outline without a target. + """ + # "ChatGPT 4o" assisted with generating this docstring. # tower outline with no target. return RenderControlTower(wire_frame=rcps.outline(color='g'), target=False) diff --git a/opencsp/common/lib/render_control/RenderControlTrajectoryAnalysis.py b/opencsp/common/lib/render_control/RenderControlTrajectoryAnalysis.py index 0a8931881..928ac4932 100644 --- a/opencsp/common/lib/render_control/RenderControlTrajectoryAnalysis.py +++ b/opencsp/common/lib/render_control/RenderControlTrajectoryAnalysis.py @@ -1,14 +1,13 @@ -""" - - -""" - - class RenderControlTrajectoryAnalysis: """ Render control for the UFACET pipeline step TrajectoryAnalysis. + + This class manages the rendering settings for the TrajectoryAnalysis step in the UFACET pipeline, + allowing customization of various visual elements related to the 3D trajectories of heliostats. """ + # "ChatGPT 4o" assisted with generating this docstring. + def __init__( self, clear_previous=True, # Remove any existing files in the designated output directory. @@ -25,6 +24,42 @@ def __init__( heliostats_3d_dpi=200, # Dpi for saving figure to disk. heliostats_3d_crop=True, # Whether to crop annotations outside image frame. ): + """ + Render control for the UFACET pipeline step TrajectoryAnalysis. + + This class manages the rendering settings for the TrajectoryAnalysis step in the UFACET pipeline, + allowing customization of various visual elements related to the 3D trajectories of heliostats. + + Parameters + ---------- + clear_previous : bool, optional + Whether to remove any existing files in the designated output directory. By default, True. + draw_heliostats_3d : bool, optional + Whether to draw the 3D video track figures for heliostats. By default, True. + heliostats_3d_points_marker : str, optional + Marker style for the 3D video track points. By default, 'o'. + heliostats_3d_points_markersize : float, optional + Size of the marker for 3D video track points. By default, 1.5. + heliostats_3d_points_color : str, optional + Color for the 3D video track points. By default, 'm' (magenta). + heliostats_3d_label_horizontalalignment : str, optional + Horizontal alignment for the heliostat label. By default, 'center'. + heliostats_3d_label_verticalalignment : str, optional + Vertical alignment for the heliostat label. By default, 'center'. + heliostats_3d_label_fontsize : int, optional + Font size for the heliostat label. By default, 6. + heliostats_3d_label_fontstyle : str, optional + Font style for the heliostat label. By default, 'normal'. + heliostats_3d_label_fontweight : str, optional + Font weight for the heliostat label. By default, 'bold'. + heliostats_3d_label_color : str, optional + Color for the heliostat label. By default, 'm' (magenta). + heliostats_3d_dpi : int, optional + DPI (dots per inch) for saving figures to disk. By default, 200. + heliostats_3d_crop : bool, optional + Whether to crop annotations outside the image frame. By default, True. + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlTrajectoryAnalysis, self).__init__() self.clear_previous = clear_previous @@ -46,8 +81,37 @@ def __init__( def default(color='m'): + """ + Create a default render control for trajectory analysis. + + This function returns a `RenderControlTrajectoryAnalysis` instance with default settings, + using the specified color for the points and labels. + + Parameters + ---------- + color : str, optional + Color for the 3D video track points and heliostat labels. By default, 'm' (magenta). + + Returns + ------- + RenderControlTrajectoryAnalysis + An instance of `RenderControlTrajectoryAnalysis` configured with default parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlTrajectoryAnalysis(heliostats_3d_points_color=color, heliostats_3d_label_color=color) def fast(): + """ + Create a fast render control for trajectory analysis. + + This function returns a `RenderControlTrajectoryAnalysis` instance configured to skip + drawing the 3D heliostat tracks, which can speed up the rendering process. + + Returns + ------- + RenderControlTrajectoryAnalysis + An instance of `RenderControlTrajectoryAnalysis` configured for fast rendering. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlTrajectoryAnalysis(draw_heliostats_3d=False) diff --git a/opencsp/common/lib/render_control/RenderControlVideo.py b/opencsp/common/lib/render_control/RenderControlVideo.py index c1a716213..1b79bfe47 100644 --- a/opencsp/common/lib/render_control/RenderControlVideo.py +++ b/opencsp/common/lib/render_control/RenderControlVideo.py @@ -1,4 +1,29 @@ class RenderControlVideo: + """ + A class to control the rendering of videos with customizable parameters. + + This class allows users to specify various settings for video rendering, including + framerate, resolution, codec, and bitrate options. It provides methods to retrieve + ffmpeg arguments for video processing and to calculate parameters for generating + videos from a set of images. + + Attributes + ---------- + framerate : int + The framerate for the video. + width : int or None + The width of the video. + height : int or None + The height of the video. + min_scale : bool + Indicates whether to apply minimum scaling. + codec : str + The codec used for encoding the video. + low_bitrate : bool + Indicates whether to use low bitrate encoding. + """ + + # "ChatGPT 4o" assisted with generating this docstring. def __init__( self, framerate: int = 30, @@ -8,16 +33,30 @@ def __init__( codec: str = 'H.264', low_bitrate: bool = False, ): - """_summary_ - - Args: - framerate (int, optional): Framerate for the video in frames per second, or None (uses source framerate). Defaults to 30. - codec (str, optional): How to encode new videos. Can be one of 'undefined', 'H.264', 'H.265', or 'copy'. Defaults to 'H.264'. - width (int): Sets the width of the video. None to scale relative to height. Defaults to None. - height (int): Sets the height of the video. None to scale relative to width. Defaults to None. - min_scale (bool): When true, width=min(width,curr) and height=min(height,curr). Defaults to true. - low_bitrate (bool, optional): Should videos be encoded for a reduced file size? If true, then this sets the '-crf' option. Defaults to False. """ + Initialize the RenderControlVideo object. + + Parameters + ---------- + framerate : int, optional + Framerate for the video in frames per second, or None (uses source framerate). Defaults to 30. + width : int, optional + Sets the width of the video. None to scale relative to height. Defaults to None. + height : int, optional + Sets the height of the video. None to scale relative to width. Defaults to None. + min_scale : bool, optional + When True, width=min(width, curr) and height=min(height, curr). Defaults to False. + codec : str, optional + How to encode new videos. Can be one of 'undefined', 'H.264', 'H.265', or 'copy'. Defaults to 'H.264'. + low_bitrate : bool, optional + Should videos be encoded for a reduced file size? If True, then this sets the '-crf' option. Defaults to False. + + Raises + ------ + RuntimeError + If an unrecognized codec option is provided or if low_bitrate is True with an undefined or copy codec. + """ + # "ChatGPT 4o" assisted with generating this docstring. self.framerate = framerate self.codec = codec self.width = width @@ -40,14 +79,20 @@ def _get_original_video_width_height(self, video_or_image_path_name_ext: str): return self._original_video_width_height def get_ffmpeg_args(self, video_or_image_path_name_ext: str = "") -> tuple[str, dict[str, str]]: - """Get the arguments and directories to be passed to ffmpeg. + """ + Get the arguments and directories to be passed to ffmpeg. - Args: - video_or_image_path_name_ext (str, optional): Needed for width or height relative to the original video. Defaults to "". + Parameters + ---------- + video_or_image_path_name_ext : str, optional + Needed for width or height relative to the original video. Defaults to "". - Returns: - tuple[str,str,str]: The arguments string to pass to ffmpeg. + Returns + ------- + tuple[str, dict[str, str]] + The arguments string to pass to ffmpeg and any additional options as a dictionary. """ + # "ChatGPT 4o" assisted with generating this docstring. ret: list[str] = [] if self.codec != 'undefined': @@ -95,11 +140,15 @@ def oheight(): return " ".join(ret), {} def get_frames_to_video_parameters(self): - """Get the duration for the desired framerate to generate a video from a set of images. + """ + Get the duration for the desired framerate to generate a video from a set of images. - Returns: - tuple[float,str]: How long each image should be shown for, and the ffmpeg files list line for that duration + Returns + ------- + tuple[float, str] + How long each image should be shown for, and the ffmpeg files list line for that duration. """ + # "ChatGPT 4o" assisted with generating this docstring. framerate = self.framerate if self.framerate != None else 25 duration = 1.0 / framerate duration_str = "duration %0.20F" % duration @@ -109,11 +158,41 @@ def get_frames_to_video_parameters(self): @classmethod def default(cls): + """ + Create a default instance of RenderControlVideo. + + Returns + ------- + RenderControlVideo + A default instance of the class with preset parameters. + """ + # "ChatGPT 4o" assisted with generating this docstring. return cls() @classmethod def power_point(cls, framerate=10, width=320, height=None, codec='H.264', low_bitrate=False): - """Returns a set of defaults suitable for embedding videos into powerpoint.""" + """ + Returns a set of defaults suitable for embedding videos into PowerPoint. + + Parameters + ---------- + framerate : int, optional + Framerate for the video in frames per second. Defaults to 10. + width : int, optional + Sets the width of the video. Defaults to 320. + height : int, optional + Sets the height of the video. Defaults to None. + codec : str, optional + How to encode new videos. Defaults to 'H.264'. + low_bitrate : bool, optional + Should videos be encoded for a reduced file size? Defaults to False. + + Returns + ------- + RenderControlVideo + An instance of RenderControlVideo with parameters suitable for PowerPoint. + """ + # "ChatGPT 4o" assisted with generating this docstring. return cls( framerate=framerate, width=width, height=height, min_scale=True, codec=codec, low_bitrate=low_bitrate ) diff --git a/opencsp/common/lib/render_control/RenderControlVideoTracks.py b/opencsp/common/lib/render_control/RenderControlVideoTracks.py index 37d206379..bf1568f18 100644 --- a/opencsp/common/lib/render_control/RenderControlVideoTracks.py +++ b/opencsp/common/lib/render_control/RenderControlVideoTracks.py @@ -1,14 +1,14 @@ -""" - - -""" - - class RenderControlVideoTracks: """ Render control for the UFACET pipeline step VideoTracks. + + This class manages the rendering of video tracks within the UFACET pipeline. + It provides options for customizing the appearance of video track markers and + labels, as well as controlling the output settings for the rendered figures. """ + # "ChatGPT 4o" assisted with generating this docstring. + def __init__( self, clear_previous=True, # Remove any existing files in the designated output directory. @@ -25,6 +25,44 @@ def __init__( video_tracks_dpi=200, # Dpi for saving figure to disk. video_tracks_crop=True, # Whether to crop annotations outside image frame. ): + """ + Render control for the UFACET pipeline step VideoTracks. + + This class manages the rendering of video tracks within the UFACET pipeline. + It provides options for customizing the appearance of video track markers and + labels, as well as controlling the output settings for the rendered figures. + + Parameters + ---------- + clear_previous : bool, optional + If True, removes any existing files in the designated output directory. + Defaults to True. + draw_video_tracks : bool, optional + If True, draws the video track figures. Defaults to True. + video_tracks_points_marker : str, optional + Marker style for video track points. Defaults to 'o'. + video_tracks_points_markersize : float, optional + Size of the marker for video track points. Defaults to 1.5. + video_tracks_points_color : str, optional + Color for video track points. Defaults to 'm'. + video_tracks_label_horizontalalignment : str, optional + Horizontal alignment for heliostat labels. Defaults to 'center'. + video_tracks_label_verticalalignment : str, optional + Vertical alignment for heliostat labels. Defaults to 'center'. + video_tracks_label_fontsize : int, optional + Font size for heliostat labels. Defaults to 6. + video_tracks_label_fontstyle : str, optional + Font style for heliostat labels. Defaults to 'normal'. + video_tracks_label_fontweight : str, optional + Font weight for heliostat labels. Defaults to 'bold'. + video_tracks_label_color : str, optional + Color for heliostat labels. Defaults to 'm'. + video_tracks_dpi : int, optional + Dots per inch (DPI) for saving figures to disk. Defaults to 200. + video_tracks_crop : bool, optional + If True, crops annotations that are outside the image frame. Defaults to True. + """ + # "ChatGPT 4o" assisted with generating this docstring. super(RenderControlVideoTracks, self).__init__() self.clear_previous = clear_previous @@ -46,8 +84,32 @@ def __init__( def default(color='m'): + """ + Create a default instance of RenderControlVideoTracks with specified color. + + Parameters + ---------- + color : str, optional + Color for video track points and labels. Defaults to 'm'. + + Returns + ------- + RenderControlVideoTracks + An instance of RenderControlVideoTracks with default settings + and the specified color. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlVideoTracks(video_tracks_points_color=color, video_tracks_label_color=color) def fast(): + """ + Create a fast instance of RenderControlVideoTracks with drawing disabled. + + Returns + ------- + RenderControlVideoTracks + An instance of RenderControlVideoTracks with drawing of video tracks disabled. + """ + # "ChatGPT 4o" assisted with generating this docstring. return RenderControlVideoTracks(draw_video_tracks=False) diff --git a/opencsp/test/test_DocStringsExist.py b/opencsp/test/test_DocStringsExist.py index 96f03bedf..23fac7005 100644 --- a/opencsp/test/test_DocStringsExist.py +++ b/opencsp/test/test_DocStringsExist.py @@ -13,26 +13,38 @@ import opencsp.app.target.target_color.target_color as target_color import opencsp.common.lib.camera.CameraTransform as CameraTransform -import opencsp.common.lib.camera.ImageAcquisition_DCAM_color as ImageAcquisition_DCAM_color -import opencsp.common.lib.camera.ImageAcquisition_MSMF as ImageAcquisition_MSMF -import opencsp.common.lib.camera.UCamera as UCamera -import opencsp.common.lib.cv.SpotAnalysis as SpotAnalysis -import opencsp.common.lib.deflectometry.ImageProjectionSetupGUI as ImageProjectionSetupGUI -import opencsp.common.lib.deflectometry.ParamsSlopeSolver as ParamsSlopeSolver -import opencsp.common.lib.deflectometry.ParamsSlopeSolverAbstract as ParamsSlopeSolverAbstract -import opencsp.common.lib.deflectometry.ParamsSlopeSolverParaboloid as ParamsSlopeSolverParaboloid -import opencsp.common.lib.deflectometry.ParamsSlopeSolverPlano as ParamsSlopeSolverPlano -import opencsp.common.lib.geometry.ReferenceFrame as ReferenceFrame -import opencsp.common.lib.geometry.TranslationXYZ as TranslationXYZ -import opencsp.common.lib.geometry.matrix_geometry_3d as matrix_geometry_3d -import opencsp.common.lib.opencsp_path.optical_analysis_data_path as optical_analysis_data_path -import opencsp.common.lib.process.ServerSynchronizer as ServerSynchronizer -import opencsp.common.lib.process.parallel_video_tools as parallel_video_tools -import opencsp.common.lib.render.PlotAnnotation as PlotAnnotation -import opencsp.common.lib.render.PowerpointSlide as PowerpointSlide -import opencsp.common.lib.render.general_plot as general_plot -import opencsp.common.lib.render.image_plot as image_plot -import opencsp.common.lib.render.pandas_plot as pandas_plot +import opencsp.common.lib.camera.ImageAcquisition_DCAM_color +import opencsp.common.lib.camera.ImageAcquisition_MSMF +import opencsp.common.lib.camera.UCamera +import opencsp.common.lib.cv.SpotAnalysis +import opencsp.common.lib.deflectometry.ImageProjectionSetupGUI +import opencsp.common.lib.deflectometry.ParamsSlopeSolver +import opencsp.common.lib.deflectometry.ParamsSlopeSolverAbstract +import opencsp.common.lib.deflectometry.ParamsSlopeSolverParaboloid +import opencsp.common.lib.deflectometry.ParamsSlopeSolverPlano +import opencsp.common.lib.geometry.ReferenceFrame +import opencsp.common.lib.geometry.TranslationXYZ +import opencsp.common.lib.geometry.matrix_geometry_3d +import opencsp.common.lib.opencsp_path.optical_analysis_data_path +import opencsp.common.lib.process.ServerSynchronizer +import opencsp.common.lib.process.parallel_video_tools +import opencsp.common.lib.render.PlotAnnotation +import opencsp.common.lib.render.PowerpointSlide +import opencsp.common.lib.render.general_plot +import opencsp.common.lib.render.image_plot +import opencsp.common.lib.render.pandas_plot +import opencsp.common.lib.file.CsvColumns +import opencsp.common.lib.render_control.RenderControlDeflectometryInstrument +import opencsp.common.lib.render_control.RenderControlEvaluateHeliostats3d +import opencsp.common.lib.render_control.RenderControlFramesNoDuplicates +import opencsp.common.lib.render_control.RenderControlHeliostatTracks +import opencsp.common.lib.render_control.RenderControlHeliostats3d +import opencsp.common.lib.render_control.RenderControlKeyCorners +import opencsp.common.lib.render_control.RenderControlKeyFramesGivenManual +import opencsp.common.lib.render_control.RenderControlKeyTracks +import opencsp.common.lib.render_control.RenderControlPowerpointPresentation +import opencsp.common.lib.render_control.RenderControlTrajectoryAnalysis +import opencsp.common.lib.render_control.RenderControlVideoTracks def test_docstrings_exist_for_methods(): @@ -252,6 +264,42 @@ def test_docstrings_exist_for_methods(): opencsp.common.lib.render.view_spec, ] + render_control_class_list = [ + opencsp.common.lib.render_control.RenderControlAxis, + opencsp.common.lib.render_control.RenderControlBcs, + opencsp.common.lib.render_control.RenderControlDeflectometryInstrument, + opencsp.common.lib.render_control.RenderControlEnsemble, + opencsp.common.lib.render_control.RenderControlEvaluateHeliostats3d, + opencsp.common.lib.render_control.RenderControlFacet, + opencsp.common.lib.render_control.RenderControlFacetEnsemble, + opencsp.common.lib.render_control.RenderControlFigure, + opencsp.common.lib.render_control.RenderControlFigureRecord, + opencsp.common.lib.render_control.RenderControlFramesNoDuplicates, + opencsp.common.lib.render_control.RenderControlFunctionXY, + opencsp.common.lib.render_control.RenderControlHeatmap, + opencsp.common.lib.render_control.RenderControlHeliostat, + opencsp.common.lib.render_control.RenderControlHeliostatTracks, + opencsp.common.lib.render_control.RenderControlHeliostats3d, + opencsp.common.lib.render_control.RenderControlIntersection, + opencsp.common.lib.render_control.RenderControlKeyCorners, + opencsp.common.lib.render_control.RenderControlKeyFramesGivenManual, + opencsp.common.lib.render_control.RenderControlKeyTracks, + opencsp.common.lib.render_control.RenderControlLightPath, + opencsp.common.lib.render_control.RenderControlMirror, + opencsp.common.lib.render_control.RenderControlPointSeq, + opencsp.common.lib.render_control.RenderControlPowerpointPresentation, + opencsp.common.lib.render_control.RenderControlPowerpointSlide, + opencsp.common.lib.render_control.RenderControlRayTrace, + opencsp.common.lib.render_control.RenderControlSolarField, + opencsp.common.lib.render_control.RenderControlSurface, + opencsp.common.lib.render_control.RenderControlText, + opencsp.common.lib.render_control.RenderControlTower, + opencsp.common.lib.render_control.RenderControlTrajectoryAnalysis, + opencsp.common.lib.render_control.RenderControlVideo, + opencsp.common.lib.render_control.RenderControlVideoFrames, + opencsp.common.lib.render_control.RenderControlVideoTracks, + ] + common_class_list = ( camera_class_list + csp_class_list @@ -264,6 +312,7 @@ def test_docstrings_exist_for_methods(): + photogrammetry_class_list + process_class_list + render_class_list + + render_control_class_list ) class_list = app_class_list + common_class_list @@ -288,6 +337,7 @@ def test_docstrings_exist_for_methods(): and not func.startswith("__") and not func.startswith("_") and not func.endswith("_UNVERIFIED") + and not func.endswith("_NOTWORKING") ] for method in method_list: