Skip to content

Commit

Permalink
doc: Update RST for csp
Browse files Browse the repository at this point in the history
  • Loading branch information
e10harvey committed Dec 12, 2024
1 parent 58de5d8 commit 631993f
Show file tree
Hide file tree
Showing 7 changed files with 302 additions and 31 deletions.
257 changes: 257 additions & 0 deletions doc/source/library_reference/common/lib/csp/config.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
Facet
=====

.. currentmodule:: opencsp.common.lib.csp.Facet

.. automodule:: opencsp.common.lib.csp.Facet
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.FacetEnsemble

.. automodule:: opencsp.common.lib.csp.FacetEnsemble
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

Heliostat
=========

.. currentmodule:: opencsp.common.lib.csp.HeliostatAbstract

.. automodule:: opencsp.common.lib.csp.HeliostatAbstract
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.HeliostatAzEl

.. automodule:: opencsp.common.lib.csp.HeliostatAzEl
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.HeliostatConfiguration

.. automodule:: opencsp.common.lib.csp.HeliostatConfiguration
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

LightPath
=========

.. currentmodule:: opencsp.common.lib.csp.LightPath

.. automodule:: opencsp.common.lib.csp.LightPath
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.LightPathEnsemble

.. automodule:: opencsp.common.lib.csp.LightPathEnsemble
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

LightSource
===========

.. currentmodule:: opencsp.common.lib.csp.LightSource

.. automodule:: opencsp.common.lib.csp.LightSource
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.LightSourcePoint

.. automodule:: opencsp.common.lib.csp.LightSourcePoint
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.LightSourceSun

.. automodule:: opencsp.common.lib.csp.LightSourceSun
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

Mirror
======

.. currentmodule:: opencsp.common.lib.csp.MirrorAbstract

.. automodule:: opencsp.common.lib.csp.MirrorAbstract
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.MirrorParametric

.. automodule:: opencsp.common.lib.csp.MirrorParametric
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.MirrorParametricRectangular

.. automodule:: opencsp.common.lib.csp.MirrorParametricRectangular
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.MirrorPoint

.. automodule:: opencsp.common.lib.csp.MirrorPoint
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

RayTrace and OpticOrientation
=============================

.. currentmodule:: opencsp.common.lib.csp.OpticOrientationAbstract

.. automodule:: opencsp.common.lib.csp.OpticOrientationAbstract
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.RayTrace

.. automodule:: opencsp.common.lib.csp.RayTrace
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.RayTraceable

.. automodule:: opencsp.common.lib.csp.RayTraceable
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

Scene
=====

.. currentmodule:: opencsp.common.lib.csp.Scene

.. automodule:: opencsp.common.lib.csp.Scene
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

SolarField
==========

.. currentmodule:: opencsp.common.lib.csp.SolarField

.. automodule:: opencsp.common.lib.csp.SolarField
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

Tower
=====

.. currentmodule:: opencsp.common.lib.csp.Tower

.. automodule:: opencsp.common.lib.csp.Tower
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

Sun
===

.. currentmodule:: opencsp.common.lib.csp.sun_position

.. automodule:: opencsp.common.lib.csp.sun_position
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.sun_track

.. automodule:: opencsp.common.lib.csp.sun_track
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

Plotting
========

.. currentmodule:: opencsp.common.lib.csp.StandardPlotOutput

.. automodule:: opencsp.common.lib.csp.StandardPlotOutput
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.VisualizeOrthorectifiedSlopeAbstract

.. automodule:: opencsp.common.lib.csp.VisualizeOrthorectifiedSlopeAbstract
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise

.. currentmodule:: opencsp.common.lib.csp.visualize_orthorectified_image

.. automodule:: opencsp.common.lib.csp.visualize_orthorectified_image
:members:
:special-members: __init__
:undoc-members:
:show-inheritance:
:member-order: groupwise
9 changes: 9 additions & 0 deletions doc/source/library_reference/common/lib/csp/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CSP
====

This is a collection of CSP utilities for OpenCSP.

.. toctree::
:maxdepth: 1

config.rst
3 changes: 2 additions & 1 deletion doc/source/library_reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ This section describes the OpenCSP classes and interfaces.
app/camera_calibration/index.rst
app/scene_reconstruction/index.rst
common/lib/cv/index.rst
common/lib/camera/index.rst
common/lib/camera/index.rst
common/lib/csp/index.rst
35 changes: 18 additions & 17 deletions opencsp/common/lib/csp/HeliostatAbstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@
class HeliostatAbstract(RayTraceable, OpticOrientationAbstract, ABC):
"""
Heliostat representation.
Parameters:
-----------
facet_ensemble: FacetEnsemble
List of facets, in order from top-left to bottom-right (row major order).
The facet names should be their position in the list (1-indexed).
Parameters
----------
facet_ensemble: FacetEnsemble
List of facets, in order from top-left to bottom-right (row major order).
The facet names should be their position in the list (1-indexed).
"""

def __init__(
Expand Down Expand Up @@ -129,18 +130,18 @@ def movement_transform(self, config: HeliostatConfiguration) -> TransformXYZ:
Example
-------
```python
# override movement_transform in HeliostatAbstract
def movement_transform(self, az_angle: float, el_angle: float):
'''possible movement_transform for an oversimplified
azimuth and elevation based heliostat.'''
az_rotation = Rotation.from_euler('z', az_angle)
transform_az = TransformXYZ.from_R(az_rotation)
el_rotation = # rotate about the proper vector
transform_el = TransformXYZ.from_R(el_rotation)
composite_transform = transform_el * transform_az
return composite_transform
```
.. code-block:: python
# override movement_transform in HeliostatAbstract
def movement_transform(self, az_angle: float, el_angle: float):
'''possible movement_transform for an oversimplified
azimuth and elevation based heliostat.'''
az_rotation = Rotation.from_euler('z', az_angle)
transform_az = TransformXYZ.from_R(az_rotation)
el_rotation = # rotate about the proper vector
transform_el = TransformXYZ.from_R(el_rotation)
composite_transform = transform_el * transform_az
return composite_transform
"""
...

Expand Down
16 changes: 8 additions & 8 deletions opencsp/common/lib/csp/OpticOrientationAbstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@ class OpticOrientationAbstract(ABC):
orientations, and can contain child objects (that also extend OpticOrientationAbstract)
that transform with it.
Core Attributes:
----------------
Core Attributes
---------------
`self._parent`: `OpticOrientationAbstract`
- This is the `OpticOrientationAbstract` object that contains the self.
This is the `OpticOrientationAbstract` object that contains the self.
If `self` is the largest object then this attribute will be `None`.
If an object already has a parent, then it cannot be added to another object as a child.
This should be accessed via the `@property` method `self.parent`.
`self._self_to_parent_transform`: `TransformXYZ`
- This is the relatice transformation from the `self` coordinate frame to
This is the relatice transformation from the `self` coordinate frame to
the `self._parent` frame.
(`@property`) `self.children`: `list[OpticOrientationAbstract]`
- This property is an abstract method that must be implemented by all deriving classes.
There should not be a setter for this atribute. Ideally, there is little information that
is stored in two places. However, for both parents and children to find eachother,
This property is an abstract method that must be implemented by all deriving classes.
There should not be a setter for this attribute. Ideally, there is little information that
is stored in two places. However, for both parents and children to find each other,
the information about children must be stored in the parent. When implementing `self.children`,
ensure that children hold reference to parents.
Derived Attributes
------------------
Other attributes of a `OpticOrientationAbstract` are caluculated based on the other information
Other attributes of a `OpticOrientationAbstract` are calculated based on the other information
in the core attributes.
- `_children_to_self_transform`
Expand Down
11 changes: 7 additions & 4 deletions opencsp/common/lib/csp/RayTrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,14 @@ def calc_reflected_ray(normal_v: Vxyz, incoming_v: Vxyz) -> Vxyz:
Notes
-----
The algorithm for reflection is based on the formula:
\[
\text{reflected\_ray} = \text{incoming\_ray} - 2 \cdot (\text{normal} \cdot \text{incoming\_ray}) \cdot \text{normal}
\]
norm_v and inc_v must broadcast together.
.. code-block:: text
\[
\text{reflected\_ray} = \text{incoming\_ray} - 2 \cdot (\text{normal} \cdot \text{incoming\_ray}) \cdot \text{normal}
\]
norm_v and inc_v must broadcast together.
"""
# "ChatGPT 4o-mini" assisted with generating this docstring.
# Process input vector
Expand Down
2 changes: 1 addition & 1 deletion opencsp/common/lib/csp/StandardPlotOutput.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Class used to display/save the suite of standard output plots after measuring a CSP Mirror/FacetEnsemble.
"""Class used to display/save the suite of standard output plots after measuring a COutSP Mirror/FacetEnsemble.
"""

from dataclasses import dataclass, field
Expand Down

0 comments on commit 631993f

Please sign in to comment.