Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2160a35
Fix typos in class references and add some missing classes
munechika-koyo Aug 7, 2025
83d445b
Add custom CSS for responsive table styling and image aspect ratio pr…
munechika-koyo Aug 7, 2025
3853c64
Remove previous overriden theme css
munechika-koyo Aug 7, 2025
2e098d6
Update Sphinx configuration to set default pygments style and specify…
munechika-koyo Aug 7, 2025
932903c
Update Sphinx configuration to include custom static path and simplif…
munechika-koyo Aug 7, 2025
61b6a56
Update installation instructions to reflect Python 3.9+ requirement a…
munechika-koyo Aug 14, 2025
d307b55
Update installation instructions to use 'python -m pip' for installat…
munechika-koyo Aug 14, 2025
391669a
Fix typo: change 'demo' to 'demos'
munechika-koyo Aug 14, 2025
068d715
Remove unnecessary references to GitHub repository and Python Setup T…
munechika-koyo Aug 14, 2025
a9dfd70
Update testing instructions to use Python's built-in unittest framework
munechika-koyo Aug 14, 2025
76045c7
Fix formatting in installation documentation and enhance unittest fra…
munechika-koyo Aug 14, 2025
ee61f43
Remove unnecessary VSCode settings file
munechika-koyo Aug 19, 2025
5ed9a21
Merge pull request #460 from raysect/development
CnlPepper Aug 25, 2025
a22e73b
Merge remote-tracking branch 'upstream/master' into fix/document
munechika-koyo Aug 31, 2025
b2db75a
Merge branch 'development' into fix/document
munechika-koyo Aug 31, 2025
f388493
Remove obsolete documentation files
munechika-koyo Aug 31, 2025
8438661
Add :titlesonly: directive to API reference documentation
munechika-koyo Aug 31, 2025
e0886ba
Enhance LoggingRay docstrings
munechika-koyo Aug 31, 2025
18e519c
Refactor imports in logging_trajectories.py for clarity and remove un…
munechika-koyo Aug 31, 2025
02068ab
Add LoggingRay class to API documentation
munechika-koyo Aug 31, 2025
57df257
Add demonstration for Ray Logging Trajectories with visualizations
munechika-koyo Aug 31, 2025
e18dfe7
Fix docstrings
munechika-koyo Sep 1, 2025
3a58124
Fix duplication of links and targets
munechika-koyo Sep 1, 2025
fee5bce
Fix not-included warning
munechika-koyo Sep 1, 2025
10f6232
Remove trailing blank lines
munechika-koyo Sep 1, 2025
7692f70
Add intersphinx extension and configuration for external documentatio…
munechika-koyo Sep 1, 2025
64eb59d
Add :titlesonly: option for math docs
munechika-koyo Sep 1, 2025
374ed1e
Add plotting script for Aluminium BRDF and update documentation refer…
munechika-koyo Sep 1, 2025
cbd541e
Add 3D surface BRDF plotting script and update documentation reference
munechika-koyo Sep 1, 2025
a4540e0
Refactor BRDF plotting demo to use subplots for multiple light angles
munechika-koyo Sep 1, 2025
03507a2
Update BRDF surface 3D plots image created by renewed demo
munechika-koyo Sep 1, 2025
5d83c66
Fix indentation in LoggingRay usage examples for consistency
munechika-koyo Sep 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions demos/materials/plotting_brdfs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import matplotlib.pyplot as plt
import numpy as np

from raysect.core import AffineMatrix3D, Point3D, Vector3D
from raysect.optical import Ray, World
from raysect.optical.library.metal import RoughAluminium
from raysect.optical.material import UnitySurfaceEmitter
from raysect.primitive import Sphere

# Create scene graph
world = World()
ray = Ray(min_wavelength=500, max_wavelength=500.1, bins=1)
sphere = Sphere(100, parent=world, material=UnitySurfaceEmitter())

# Define Consts.
origin = Point3D(0, 0, 0)
material = RoughAluminium(0.25)
thetas = np.linspace(-90, 90, 100)

plt.ion()
for light_angle in [0, -25, -45, -70]:
light_position = Point3D(
np.sin(np.deg2rad(light_angle)), 0, np.cos(np.deg2rad(light_angle))
)
light_direction = origin.vector_to(light_position).normalise()

brdfs = []
for theta_step in thetas:
detector_position = Point3D(
np.sin(np.deg2rad(theta_step)), 0, np.cos(np.deg2rad(theta_step))
)
detector_direction = origin.vector_to(detector_position).normalise()

# Calculate spectrum
spectrum = material.evaluate_shading(
world,
ray,
light_direction,
detector_direction,
origin,
origin,
False,
AffineMatrix3D(),
AffineMatrix3D(),
None,
)
brdfs.append(spectrum.samples[0])

plt.plot(thetas, brdfs, label="{} degrees".format(light_angle))

plt.xlabel("Observation Angle (degrees)")
plt.ylabel("BRDF() (probability density)")
plt.legend()
plt.title("The Aluminium BRDF VS observation angle")


def plot_brdf(light_angle):
light_position = Point3D(
np.sin(np.deg2rad(light_angle)), 0, np.cos(np.deg2rad(light_angle))
)
light_direction = origin.vector_to(light_position).normalise()

phis = np.linspace(0, 360, 200)
num_phis = len(phis)
thetas = np.linspace(0, 90, 100)
num_thetas = len(thetas)

values = np.zeros((num_thetas, num_phis))
for i, j in np.ndindex(num_thetas, num_phis):
theta = np.deg2rad(thetas[i])
phi = np.deg2rad(phis[j])
outgoing = Vector3D(
np.cos(phi) * np.sin(theta), np.sin(phi) * np.sin(theta), np.cos(theta)
)

# Calculate spectrum
spectrum = material.evaluate_shading(
world,
ray,
light_direction,
outgoing,
origin,
origin,
False,
AffineMatrix3D(),
AffineMatrix3D(),
None,
)
values[i, j] = spectrum.samples[0]

fig, ax = plt.subplots(subplot_kw=dict(projection="polar"))
cs = ax.contourf(np.deg2rad(phis), thetas, values, extend="both")
cs.cmap.set_under("k")
plt.title("Light angle: {} degrees".format(light_angle))


plot_brdf(0)
plot_brdf(-25)
plot_brdf(-45)
plot_brdf(-60)
plt.ioff()
plt.show()
72 changes: 72 additions & 0 deletions demos/materials/plotting_brdfs_3d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import matplotlib.pyplot as plt
import numpy as np

from raysect.core import AffineMatrix3D, Point3D, Vector3D
from raysect.optical import Ray, World
from raysect.optical.library.metal import RoughAluminium
from raysect.optical.material import UnitySurfaceEmitter
from raysect.primitive import Sphere

# Create scene graph
world = World()
ray = Ray(min_wavelength=499, max_wavelength=501, bins=1)
sphere = Sphere(100, parent=world, material=UnitySurfaceEmitter())

# Define Consts.
origin = Point3D(0, 0, 0)
material = RoughAluminium(0.25)


def calculate_brdf_surface(light_vector):
thetas = np.arange(0, 91, step=5)
phis = np.arange(0, 361, step=10)
num_thetas = len(thetas)
num_phis = len(phis)
thetas, phis = np.meshgrid(thetas, phis)

X = np.zeros((num_phis, num_thetas))
Y = np.zeros((num_phis, num_thetas))
Z = np.zeros((num_phis, num_thetas))

for i, j in np.ndindex(num_phis, num_thetas):
theta = np.deg2rad(thetas[i, j])
phi = np.deg2rad(phis[i, j])
outgoing = Vector3D(
np.cos(phi) * np.sin(theta), np.sin(phi) * np.sin(theta), np.cos(theta)
)

# Calculate spectrum
spectrum = material.evaluate_shading(
world,
ray,
light_direction,
outgoing,
origin,
origin,
False,
AffineMatrix3D(),
AffineMatrix3D(),
None,
)
radius = spectrum.samples[0]
X[i, j] = radius * np.cos(phi) * np.sin(theta)
Y[i, j] = radius * np.sin(phi) * np.sin(theta)
Z[i, j] = radius * np.cos(theta)

return X, Y, Z


fig, axes = plt.subplots(2, 2, subplot_kw={"projection": "3d"}, layout="constrained")

for ax, light_angle in zip(axes.flatten(), [0, -10, -25, -45], strict=True):
light_position = Point3D(
np.sin(np.deg2rad(light_angle)), 0, np.cos(np.deg2rad(light_angle))
)
light_direction = origin.vector_to(light_position).normalise()
X, Y, Z = calculate_brdf_surface(light_direction)
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap="viridis", edgecolor="none")
ax.set_xlim(-1, 1)
ax.set_ylim(-1, 1)
ax.set_title(f"Light angle {light_angle} degrees")

plt.show()
17 changes: 9 additions & 8 deletions demos/optics/logging_trajectories.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@

# External imports
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np

# Raysect imports
from raysect.optical import World, translate, rotate, Point3D, d65_white, Ray, Vector3D
from raysect.optical.material.absorber import AbsorbingSurface
from raysect.optical import Point3D, Vector3D, World, translate
from raysect.optical.library import schott
from raysect.primitive import Sphere, Box
from raysect.optical.loggingray import LoggingRay
from raysect.primitive.lens.spherical import *

from raysect.optical.material.absorber import AbsorbingSurface
from raysect.primitive import Box
from raysect.primitive.lens.spherical import BiConvex

world = World()

Expand Down Expand Up @@ -46,5 +42,10 @@
ax.plot(p[:, 0], p[:, 1], p[:, 2], 'k-')
ax.plot(p[:, 0], p[:, 1], p[:, 2], 'r.')

ax.set(
xlabel="$X$",
ylabel="$Y$",
zlabel="$Z$",
)
plt.ioff()
plt.show()
4 changes: 2 additions & 2 deletions docs/source/api_reference/core/core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Raysect Core
The core module of raysect is made up of math, acceleration, and scenegraph classes.

.. toctree::
:titlesonly:

core_classes
math
raysect_core_scenegraph
spatial_acceleration
render_engines
utilities


2 changes: 2 additions & 0 deletions docs/source/api_reference/core/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Math Module
===========

.. toctree::
:titlesonly:

points_and_vectors
affinematrix
functions
Expand Down
17 changes: 0 additions & 17 deletions docs/source/api_reference/core/raysect_core_kdtree.rst

This file was deleted.

8 changes: 6 additions & 2 deletions docs/source/api_reference/optical/main_optical_classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Optical Rays
:members:
:show-inheritance:

.. autoclass:: raysect.optical.loggingray.LoggingRay
:members:
:show-inheritance:

Spectral Functions
------------------

Expand Down Expand Up @@ -39,7 +43,7 @@ The CIE 1931 colour spaces define quantitatively the link between pure physical
relationships between the spectrum and perceivable colours are based on the sensitivity
curves for the three different cone cells in the human eye. Raysect implements three X,
Y, Z normalised spectral functions from the CIE 1931 Standard Colorimetric Observer. For
more information see `Wikipedia <https://en.wikipedia.org/wiki/CIE_1931_color_space>`_.
more information see `Wikipedia <https://en.wikipedia.org/wiki/CIE_1931_color_space>`__.

.. data:: raysect.optical.colour.ciexyz_x

Expand Down Expand Up @@ -68,7 +72,7 @@ more information see `Wikipedia <https://en.wikipedia.org/wiki/CIE_1931_color_sp

Raysect also supports conversion of CIE colour space values to standard sRGB colour space
as defined by HP and Microsoft in 1996 as per IEC 61966-2-1:1999. For more information
see `Wikipedia <https://en.wikipedia.org/wiki/SRGB>`_.
see `Wikipedia <https://en.wikipedia.org/wiki/SRGB>`__.

.. autofunction:: raysect.optical.colour.ciexyz_to_srgb

Expand Down
10 changes: 8 additions & 2 deletions docs/source/api_reference/optical/observers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ properties of all observers and the overall observing workflow.
:members:
:show-inheritance:

.. autoclass:: raysect.optical.observer.nonimaging.targetted_pixel.TargettedPixel
.. autoclass:: raysect.optical.observer.nonimaging.targeted_pixel.TargetedPixel
:members:
:show-inheritance:

Expand Down Expand Up @@ -76,8 +76,14 @@ properties of all observers and the overall observing workflow.
:members:
:show-inheritance:

.. autoclass:: raysect.optical.observer.imaging.vector.VectorCamera
.. autoclass:: raysect.optical.observer.imaging.targeted_ccd.TargetedCCDArray
:members:
:show-inheritance:

.. autoclass:: raysect.optical.observer.imaging.vector.VectorCamera
:members:
:show-inheritance:

.. autoclass:: raysect.optical.observer.imaging.opencv.OpenCVCamera
:members:
:show-inheritance:
2 changes: 2 additions & 0 deletions docs/source/api_reference/optical/optical.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Optical Module
==============

.. toctree::
:titlesonly:

main_optical_classes
observers
pipelines
Expand Down
7 changes: 2 additions & 5 deletions docs/source/api_reference/optical/optical_surfaces.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ Emitters
.. autoclass:: raysect.optical.material.emitter.UniformSurfaceEmitter
:show-inheritance:

.. autoclass:: raysect.optical.material.AnisotropicSurfaceEmitter
.. autoclass:: raysect.optical.material.emitter.AnisotropicSurfaceEmitter
:show-inheritance:

.. autoclass:: raysect.optical.material.Checkerboard
.. autoclass:: raysect.optical.material.emitter.Checkerboard
:show-inheritance:

Lambertian
Expand Down Expand Up @@ -71,9 +71,6 @@ Debugging

This module contains materials to aid with debugging and creating test scenes.

.. autoclass:: raysect.optical.material.emitter.Checkerboard
:show-inheritance:

.. autoclass:: raysect.optical.material.debug.Light
:show-inheritance:

Expand Down
5 changes: 2 additions & 3 deletions docs/source/api_reference/primitives/primitives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ Primitives Module
=================

.. toctree::
:titlesonly:

geometric_primitives
meshes
csg_operations
optical_elements



10 changes: 0 additions & 10 deletions docs/source/architecture.rst

This file was deleted.

Loading