Skip to content

Commit

Permalink
Merge branch 'develop' into full_res_example
Browse files Browse the repository at this point in the history
  • Loading branch information
e10harvey authored Aug 27, 2024
2 parents 06e50ac + 293e0db commit 0b27247
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docs_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ jobs:
pip install -r requirements.txt
cd doc
pip install -r requirements.txt
sudo apt install -y pandoc
./make_docs.sh
7 changes: 3 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ build:
os: ubuntu-22.04
tools:
python: "3.10"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"
# Install pandoc for including jupyter notebooks in our generated docs
apt_packages:
- pandoc

# Build documentation in the "docs/" directory with Sphinx
sphinx:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Online Documentation
--------------------

Detailed contribution guidelines may be found in our [online documentation](
https://opencsp.readthedocs.io/en/main/contributing.html).
https://opencsp.readthedocs.io/en/latest/contributing.html).

Legal Disclaimer
----------------
Expand Down
7 changes: 6 additions & 1 deletion contrib/scripts/sensitive_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _is_binary_file(self, file_path: str, file_name_ext: str):
ext = ext.lower()
if ext == ".ipynb":
is_binary_file = True
if self._is_img_ext(ext):
elif self._is_img_ext(ext):
if ext in self._text_file_extensions:
is_binary_file = False
elif (f"{file_path}/{file_name_ext}" in self._text_file_path_name_exts) or (
Expand All @@ -118,6 +118,11 @@ def _is_binary_file(self, file_path: str, file_name_ext: str):
is_binary_file = False
else:
is_binary_file = True
elif ft.file_size(ft.join(file_path, file_name_ext)) > 1e6:
# assume any file > 1MB is a binary file, in order to prevent
# sensitive_strings from taking hours to check these files
# needlessly
is_binary_file = True
if not is_binary_file:
# attempt to parse the file as a text file
try:
Expand Down
3 changes: 2 additions & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
sphinx
sphinx-argparse
sphinx-rtd-theme
sphinx-rtd-theme
nbsphinx
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"sphinx.ext.todo",
"sphinxarg.ext",
"sphinx_rtd_theme",
"nbsphinx",
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
21 changes: 20 additions & 1 deletion doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ NumPy-style docstrings with bulleted lists. We require NumPy compliant docstring
Models, Public Classes, and Public Functions. For more internal and development-facing
documentation please use hash tags.

All documentation is verified to pass sphinx-build without errors via https://github.com/sandialabs/OpenCSP/blob/develop/.github/workflows/docs_check.yml.
Solely documentation that has a associated sphinx config in https://github.com/sandialabs/OpenCSP/tree/develop/doc/source will be included in this online documentation.
There are several different ways to include documentation in the sphinx config depending on what the source of documentation is. For general guidance, please see
https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html. For examples of how this is currently done in OpenCSP, please see any of the config.rst files in doc/source. A common
use-case is to include NewClass with its documented and undocumented non-private members, to do that you would add the following to
https://github.com/sandialabs/OpenCSP/blob/develop/doc/source/library_reference/app/sofast/config.rst:

.. code-block:: rst
opencsp.app.sofast.lib.NewClass
===============================
.. currentmodule:: opencsp.app.sofast.lib.NewClass
.. automodule:: opencsp.app.sofast.lib.NewClass
:members:
:undoc-members:
:show-inheritance:
We highly recommend using Visual Studio Code for development. If using VS Code,
please install the following plugins:

Expand Down Expand Up @@ -72,7 +91,7 @@ commits:
for FILE in $(git diff --cached --name-only | egrep '.*\.py$')
do
if [ -e $FILE ]; then
black $FILE -C -S
black $FILE --line-length 120 -C -S
git add $FILE
fi
done
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
"===================================="
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*Last updated May 21, 2024*"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -27,7 +20,7 @@
"- solar fields (to be renamed heliostat fields)\n",
"\n",
"It will also talk about using ray tracing with these objects.\n",
"<p style=\"color:green\"> There are TODO notes marked in green like this. </p>\n",
"<h3 style=\"color:green\"> There are TODO notes marked in green like this. </h3>\n",
"\n",
"If you are following along and altering the code to better understand what is going on that is great. There are some blocks that can only really run one time, and if you accidentally run that block when you should not have then just reload the doc. At worst it generally only takes about 2-3 minutes to run all the cells."
]
Expand Down Expand Up @@ -922,7 +915,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The algorithm used for ray tracing is explained in detail in [ReflectedRayAlgorithm.pdf](../../doc/common/lib/csp/ReflectedRayAlgorithm.pdf). <h3 style=\"color:green\"> TODO make the link to ray trace algo work</h3>\n",
"The algorithm used for ray tracing is explained in detail in TODO: ReflectedRayAlgorithm.pdf. <h3 style=\"color:green\"> TODO make the link to ray trace algo work</h3>\n",
"\n",
"OpenCSP ray tracing requires many points, the normal vectors at those points (to know how light sohuld reflect) and a light source. Any `RayTraceable` object will have a `survey_of_points` function. This function will give a list of points and normal vectors at those points for a given `Resolution`."
]
Expand Down Expand Up @@ -1294,7 +1287,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The intersection algorithm is explained in [IntersectionWithPlaneAlgorithm.pdf](../../doc/common/lib/csp/IntersectionWithPlaneAlgorithm.pdf) <h3 style=\"color:green\"> TODO make the link to intersection algo work</h3>\n",
"The intersection algorithm is explained in TODO:IntersectionWithPlaneAlgorithm.pdf <h3 style=\"color:green\"> TODO make the link to intersection algo work</h3>\n",
"\n",
"We want to know where the individual light rays intersect with some plane. We can use the ray traces from earlier: `trace` and `trace2` from the [`RayTrace` section](#raytrace-class). These are small ray traces, but we might want to analyse exactly where the rays intersect. Lets say we want to know how the reflections intersect with the $xy$ plane at $z=1$. We will have the first one be blue(where the point light source was at the focal point) and the second one be red (where the light source was about at the $2f$ point). "
]
Expand Down
10 changes: 9 additions & 1 deletion doc/source/example/csp/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ Optics and Ray tracing

.. automodule:: example.csp.example_optics_and_ray_tracing
:members:
:show-inheritance:
:show-inheritance:

Foundation Classes and Ray Tracing
==================================

.. toctree::
:maxdepth: 3

base_classes_and_ray_trace

0 comments on commit 0b27247

Please sign in to comment.