Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
fa3fc7d
✨ Add function to solve a cubic & quartic equation
Feb 6, 2023
e0da6c2
✨ Add torus primitive firstly
Feb 6, 2023
ff9efcc
✏️ fix typo
Feb 7, 2023
3f4eff8
🎨 change to use descartes-euler methd
Feb 7, 2023
b266689
🎨 alter solvers for cubic and quartic
Feb 8, 2023
bd9e062
🐛 fix bug code
Feb 9, 2023
b1842c6
🎨 add sorting function
Feb 9, 2023
16ab94a
🎨 add torus class to __init__ file
Feb 9, 2023
7ff6788
💩 🎨 improve code and some bugs remain
Feb 9, 2023
efe111d
🐛 Fix ray-torus interection implementation
Feb 10, 2023
f317700
Updated build_wheels.sh.
CnlPepper Feb 12, 2023
793e532
Update version number.
CnlPepper Feb 12, 2023
6143bdc
✨ add demo script using a torus primitive
Feb 13, 2023
6637665
Fix demos incompatibility with latest Raysect version.
vsnever Feb 13, 2023
66fdf70
Merge pull request #421 from vsnever/fix/demos
CnlPepper Feb 18, 2023
3019130
🩹 fix spectral rays in camera settings
Dec 18, 2023
893c4eb
🎨 ✏️ Fix formatting and typos in utility.pyx and torus.pyx
Dec 18, 2023
ea72675
add reverse method like `__radd__`, `__rmul__`, etc.
Jul 27, 2023
4095c99
fix inconsistent indentation
Jul 28, 2023
2d1a680
fix binary arithmetic operators in `math` module
Jul 28, 2023
e9800f3
add `noexcept` to `_edge_compare` function
Jul 28, 2023
245faf7
add ignoring `numpy` deplicated warning
Aug 2, 2023
b993ac6
change to return from raise
Jul 27, 2023
7a12a04
update cython version constraint in pyproject.toml
munechika-koyo Nov 27, 2024
80a6f5f
fix: replace `DEF` statements with `cdef enum`, `cdef const` and use …
munechika-koyo Jul 18, 2025
4bf12d8
refactor: remove redundant DEF constants for R_2_PI and R_4_PI
munechika-koyo Jul 18, 2025
a87eb2d
refactor: remove unused constants and clean up docstring formatting
munechika-koyo Jul 18, 2025
1ad5da5
chore: update cython version constraint to 3.1 in pyproject.toml
munechika-koyo Jul 18, 2025
4786b1f
Merge branch 'master' into development
CnlPepper Jul 19, 2025
cae19f3
Update copyright date.
CnlPepper Jul 19, 2025
fae8fb0
Implemented a tool to automatically generate meson.build files throug…
CnlPepper Jul 19, 2025
cee8e97
Tidy up.
CnlPepper Jul 19, 2025
efc79ff
Updated build.sh and clean.sh scripts.
CnlPepper Jul 19, 2025
8754c31
Updated the changelog.
CnlPepper Jul 19, 2025
1e4f01a
Added .meson-exclude to development scripts folders to prevent their …
CnlPepper Jul 19, 2025
0111aec
Added meson.build files.
CnlPepper Jul 19, 2025
0e03c3a
Initial draft of pyproject.toml.
CnlPepper Jul 19, 2025
e700c7b
Added directory filter to exclude __pycache__ folders (and autogenera…
CnlPepper Jul 19, 2025
14209f0
Deleted setup.py.
CnlPepper Jul 19, 2025
8bbcf04
Updated pyproject.toml.
CnlPepper Jul 19, 2025
9219087
Fixed readme definition in pyproject.toml.
CnlPepper Jul 19, 2025
c7d5336
Removed manifest file.
CnlPepper Jul 19, 2025
04a61bc
Investigating issue with wheel build and numpy.
CnlPepper Jul 19, 2025
36d32d9
Quick hack to see if we can get the CI functioning.
CnlPepper Jul 19, 2025
40dc2d7
Remove support for python 3.8.
CnlPepper Jul 19, 2025
6d29384
Changed plan regarding demos folder. The sdist will essentially be th…
CnlPepper Jul 19, 2025
9c4b844
Updated version number.
CnlPepper Jul 19, 2025
e41c1c3
Fixed typo in changelog.txt
CnlPepper Jul 19, 2025
3976caf
Minimum supported version of python now 3.9.
CnlPepper Jul 19, 2025
53f6c84
Switch to raw string to correct syntax warning on package import.
CnlPepper Jul 19, 2025
51deccc
Merge branch 'development' into feature/meson-python
CnlPepper Jul 19, 2025
7a52d81
Added a developer warning to the autogenerated meson.build files.
CnlPepper Jul 19, 2025
546b30b
Updated copyright.
CnlPepper Jul 19, 2025
5b96548
Merge branch 'development' into feature/meson-python
CnlPepper Jul 19, 2025
37c7f2c
Addressed uninitialised variable compilation warnings.
CnlPepper Jul 19, 2025
f02ffc2
Merge branch 'development' into feature/meson-python
CnlPepper Jul 19, 2025
fb31ca6
Merge remote-tracking branch 'munechika/cython_v3_support' into featu…
CnlPepper Jul 19, 2025
d91e083
Update cython version.
CnlPepper Jul 19, 2025
1df6f31
Update cython version.
CnlPepper Jul 19, 2025
30a764e
Update .gitignore to remove randomly added string.
CnlPepper Jul 20, 2025
1696d1f
Revised various segments of the code to both modernise it and support…
CnlPepper Jul 20, 2025
e4804b0
Revised various segments of the code to both modernise it and support…
CnlPepper Jul 20, 2025
2359eff
Revised various segments of the code to both modernise it and support…
CnlPepper Jul 20, 2025
e6a3c02
Add python 3.13 to the test matrix.
CnlPepper Jul 20, 2025
3bc16d2
Removed random text that was accidentally added to .gitignore.
CnlPepper Jul 20, 2025
ce4bff9
Renamed all instances of the word "targetted" with "targeted" to fix …
CnlPepper Jul 20, 2025
45f63d5
🐛 Fix intersection caching and indexing in Torus class
munechika-koyo Jul 21, 2025
052718c
Update documentation to include Parabola and Torus in geometric primi…
munechika-koyo Jul 22, 2025
5897707
Merge pull request #446 from raysect/feature/meson-python
CnlPepper Jul 22, 2025
28e605d
Add demo script for raysect geometric primitives.
munechika-koyo Jul 22, 2025
4c5c481
Update raysect_primitives.png image for including all geometric primi…
munechika-koyo Jul 22, 2025
b46559a
move raysect_primitives.py to demos/primitives
munechika-koyo Jul 22, 2025
e30c18f
Merge branch 'raysect:master' into feature/torus
munechika-koyo Jul 22, 2025
3453be6
Merge branch 'development' into feature/torus
munechika-koyo Jul 22, 2025
40bab61
Sort file and subdirectory lists to guarantee ordering when generati…
CnlPepper Jul 22, 2025
a5a571b
Merge branch 'refs/heads/development' into feature/cython3
CnlPepper Jul 22, 2025
3d1ee34
Regenerated meson.build files using new generator.
CnlPepper Jul 22, 2025
5dcec9b
Merge pull request #447 from raysect/feature/cython3
CnlPepper Jul 22, 2025
def00d1
Merge branch 'development' into feature/torus
munechika-koyo Jul 22, 2025
22aa40c
Add torus.pyx and torus.pxd to source files in meson.build
munechika-koyo Jul 22, 2025
462e055
Updated changelog, adding thanks to @munechika-koyo for their cython …
CnlPepper Jul 22, 2025
247ba4c
Merge pull request #419 from munechika-koyo/feature/torus
CnlPepper Jul 22, 2025
10f9380
Updated changelog with torus primitive.
CnlPepper Jul 22, 2025
66b7df3
Moved to setuptools-scm for automatic versioning.
CnlPepper Jul 22, 2025
027aca8
Add setuptools-scm to dependencies.
CnlPepper Jul 22, 2025
36f0122
Merge pull request #449 from raysect/feature/autoversion
CnlPepper Jul 22, 2025
24e6c5e
Update copyright date.
CnlPepper Jul 22, 2025
2effc00
Added missing full stops.
CnlPepper Jul 22, 2025
17c48e2
Refined notes on cython 3 migration.
CnlPepper Jul 22, 2025
8e275b3
Added meson dist script to copy the dynamically generated _version.py…
CnlPepper Jul 27, 2025
8b9181d
Added files accidentally excluded by .gitignore.
CnlPepper Jul 27, 2025
e371445
Merge pull request #451 from raysect/feature/build_refinement
CnlPepper Jul 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
strategy:
fail-fast: false
matrix:
numpy-version: ["oldest-supported-numpy", "numpy"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
numpy-version: ["numpy"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -21,8 +21,8 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: python -m pip install --prefer-binary setuptools "cython>=0.28,<3.0" "matplotlib>=3,<4" ${{ matrix.numpy-version }}
run: python -m pip install --prefer-binary meson-python meson ninja setuptools setuptools-scm "cython>=3.1" "matplotlib>=3,<4" ${{ matrix.numpy-version }}
- name: Build and install Raysect
run: dev/build.sh
run: dev/install_editable.sh
- name: Run tests
run: dev/test.sh
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ __pycache__/
# C extensions
*.so
*.c

# Distribution / packaging
/build/
.Python
env/
build/
venv/
develop-eggs/
dist/
downloads/
Expand Down Expand Up @@ -58,4 +60,5 @@ docs/build/
# PyBuilder
target/


# setuptools-scm
raysect/_version.py
26 changes: 26 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
Raysect Changelog
=================

Release 0.9.0 (TBD)
-------------------

Build changes:
* The legacy setuptools build system has been replaced with meson-python.
- The dev/build.sh and dev/clean.sh scripts have been updated to work with the new build system.
- A meson.build generator script is provided to automate the discovery of pyx, pxd,py and data files. Please see dev/generate_meson_files.py.
- When installed in editable mode, any modified pyx files will automatically trigger a rebuild when python attempts to import from the package. Please be aware that (as with the previous build system) changes to pxd files will require a clean rebuild of the project.
- A dev/install_editable.sh script is provided to simplify the installation of the package in editable mode with verbose build output enabled.
- Meson-python performs the build out of the project folder, so the project source folders will no longer be polluted with build artefacts.
- Cython build annotations are now always enabled, the annotation files can be found in the build folder under the build artefacts folder associated with each so file (*.so.p folder).
* The codebase has been migrated to Cython 3.
- This migration was made possible due to the contributions of Koyo Munechika (@munechika-koyo).

Python support:
* Raysect now requires Python v3.9 and above.
- From version v0.9.0 Raysect is dropping support for Python versions older than v3.9.
- Users of older versions of Python should remain using Raysect v0.8.1 and plan for a migration to v0.9.0+.

API changes:
* Corrected spelling of all classes, methods and functions where "targeted" was incorrectly spelt "targetted".

New:
* Added a torus primitive (contribute by Koyo Munechika).


Release 0.8.1 (12 Feb 2023)
---------------------------

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014-2021, Dr Alex Meakins, Raysect Project
Copyright (c) 2014-2025, Dr Alex Meakins, Raysect Project
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1341346.svg)](https://doi.org/10.5281/zenodo.1341346)
[![Build Status](https://travis-ci.com/raysect/source.svg?branch=master)](https://travis-ci.com/raysect/source)

<a name="logo"/>
<a href="https://www.raysect.org/" target="_blank">
Expand Down
2 changes: 1 addition & 1 deletion demos/materials/modifiers/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def emission_function(self, point, direction, spectrum, world, ray, primitive, t
wvl_range = spectrum.min_wavelength - spectrum.max_wavelength
shift = 2 * (spectrum.wavelengths - wvl_centre) / wvl_range
radius = sqrt(point.x**2 + point.y**2)
spectrum.samples += cos((shift + 5) * radius)**4
spectrum.samples[:] += cos((shift + 5) * radius)**4
return spectrum


Expand Down
2 changes: 1 addition & 1 deletion demos/materials/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def emission_function(self, point, direction, spectrum, world, ray, primitive, t
wvl_range = spectrum.min_wavelength - spectrum.max_wavelength
shift = 2 * (spectrum.wavelengths - wvl_centre) / wvl_range
radius = sqrt(point.x**2 + point.y**2)
spectrum.samples += cos((shift + 5) * radius)**4
spectrum.samples[:] += cos((shift + 5) * radius)**4
return spectrum


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import matplotlib.pyplot as plt
from math import atan2, sqrt, degrees

from raysect.core.math import Point3D, TargettedHemisphereSampler, TargettedSphereSampler
from raysect.core.math import Point3D, TargetedHemisphereSampler, TargetedSphereSampler


def display_samples(samples, title):
Expand Down Expand Up @@ -34,8 +34,8 @@ def display_samples(samples, title):
observation_point = Point3D(0, 0, 0)

# generate samplers
hemisphere = TargettedHemisphereSampler(targets)
sphere = TargettedSphereSampler(targets)
hemisphere = TargetedHemisphereSampler(targets)
sphere = TargetedSphereSampler(targets)

# sample for origin point and point at (0, 0, -10)
h_samples = hemisphere(observation_point, samples=samples)
Expand Down
8 changes: 4 additions & 4 deletions demos/observers/cornell_box_cooke_triplet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from raysect.optical import World, Node, translate, rotate, Point3D
from raysect.optical.material import Lambert, UniformSurfaceEmitter, AbsorbingSurface, Checkerboard
from raysect.optical.library import *
from raysect.optical.observer import TargettedCCDArray
from raysect.optical.observer import TargetedCCDArray
from raysect.optical.observer import RGBPipeline2D, BayerPipeline2D, PowerPipeline2D
from raysect.optical.observer import RGBAdaptiveSampler2D
from raysect.core.math import mm
Expand Down Expand Up @@ -184,9 +184,9 @@
rgb = RGBPipeline2D(display_unsaturated_fraction=0.96, name="sRGB")
sampler = RGBAdaptiveSampler2D(rgb, ratio=10, fraction=0.2, min_samples=1000, cutoff=0.01)

# CCD targetting all rays at last lens element for speed
ccd = TargettedCCDArray(
targetted_path_prob=1.0, targets=[l3],
# CCD targeting all rays at last lens element for speed
ccd = TargetedCCDArray(
targeted_path_prob=1.0, targets=[l3],
width=mm(35), pixels=(512, 512),
parent=image_plane, transform=translate(0, 0, 0)*rotate(0, 0, 180),
pipelines=[rgb]
Expand Down
4 changes: 2 additions & 2 deletions demos/observers/cornell_box_real_pinhole.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from raysect.optical import World, Node, translate, rotate, Point3D
from raysect.optical.material import Lambert, UniformSurfaceEmitter, NullMaterial
from raysect.optical.library import *
from raysect.optical.observer import RGBPipeline2D, BayerPipeline2D, PowerPipeline2D, TargettedCCDArray
from raysect.optical.observer import RGBPipeline2D, BayerPipeline2D, PowerPipeline2D, TargetedCCDArray
from raysect.optical.observer import RGBAdaptiveSampler2D


Expand Down Expand Up @@ -144,7 +144,7 @@

camera = Node(parent=world, transform=translate(0, 0, -3.3))
pinhole = Sphere(0.0005, camera, transform=translate(0, 0, 0), material=NullMaterial())
film = TargettedCCDArray(targetted_path_prob=1.0, targets=[pinhole], width=0.1, pixels=(512, 512), parent=camera,
film = TargetedCCDArray(targeted_path_prob=1.0, targets=[pinhole], width=0.1, pixels=(512, 512), parent=camera,
transform=translate(0, 0, -0.1207), pipelines=pipelines)
film.frame_sampler = sampler
film.pixel_samples = 250
Expand Down
7 changes: 5 additions & 2 deletions demos/observers/metal_with_lens.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from raysect.optical.library.metal import Gold, Silver, Copper, Titanium, Aluminium, Beryllium
from raysect.optical.material import Lambert, UniformSurfaceEmitter, AbsorbingSurface, NullMaterial
from raysect.optical.library import schott
from raysect.optical.observer import RGBPipeline2D, BayerPipeline2D, TargettedCCDArray, CCDArray, RGBAdaptiveSampler2D
from raysect.optical.observer import RGBPipeline2D, BayerPipeline2D, TargetedCCDArray, CCDArray, RGBAdaptiveSampler2D
from raysect.optical.colour import ciexyz_x, ciexyz_y, ciexyz_z


Expand Down Expand Up @@ -49,7 +49,7 @@
pipelines = [rgb, bayer]

# ccd = CCDArray(parent=camera, pipelines=pipelines)
ccd = TargettedCCDArray(targets=[aperture], parent=camera, pipelines=pipelines)
ccd = TargetedCCDArray(targets=[aperture], parent=camera, pipelines=pipelines)
ccd.frame_sampler = sampler
ccd.pixels = (180*2, 120*2) # (360, 240)
ccd.pixel_samples = 250
Expand All @@ -65,3 +65,6 @@
# ccd.pipelines[0].save("demo_metal_lens_{}.png".format(p))
print()
p += 1

ioff()
show()
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from raysect.primitive import Box
from raysect.optical import World, translate, Point3D, Node
from raysect.optical.observer import Pixel, TargettedPixel, PowerPipeline0D
from raysect.optical.observer import Pixel, TargetedPixel, PowerPipeline0D
from raysect.optical.material import UnitySurfaceEmitter


Expand All @@ -28,16 +28,16 @@
basic_pipeline = PowerPipeline0D(name="Basic Pixel Observer")
basic_pixel = Pixel(parent=world, pixel_samples=SAMPLES, pipelines=[basic_pipeline])

# setup targetted pixel
targetted_pipeline = PowerPipeline0D(name="Targeted Pixel Observer")
targetted_pixel = TargettedPixel(parent=world, targets=targets, pixel_samples=SAMPLES, pipelines=[targetted_pipeline])
targetted_pixel.targetted_path_prob = 1
# setup targeted pixel
targeted_pipeline = PowerPipeline0D(name="Targeted Pixel Observer")
targeted_pixel = TargetedPixel(parent=world, targets=targets, pixel_samples=SAMPLES, pipelines=[targeted_pipeline])
targeted_pixel.targeted_path_prob = 1

# render
ion()
basic_pixel.observe()
print()
targetted_pixel.observe()
targeted_pixel.observe()

ioff()
show()
21 changes: 9 additions & 12 deletions demos/optics/etendue_of_pinhole.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import matplotlib.pyplot as plt

from raysect.core import Point3D, Vector3D, rotate_basis, translate, Ray as CoreRay
from raysect.core.math.sampler import DiskSampler3D, RectangleSampler3D, TargettedHemisphereSampler
from raysect.core.math.sampler import DiskSampler3D, RectangleSampler3D, TargetedHemisphereSampler
from raysect.optical import World
from raysect.primitive import Box, Cylinder, Subtract
from raysect.optical.material import AbsorbingSurface, NullMaterial
Expand Down Expand Up @@ -35,8 +35,8 @@ def raytraced_etendue(distance, detector_radius=0.001, ray_count=100000, batches
sphere = target.bounding_sphere()
spheres = [(sphere.centre.transform(detector_transform), sphere.radius, 1.0)]

# instance targetted pixel sampler
targetted_sampler = TargettedHemisphereSampler(spheres)
# instance targeted pixel sampler
targeted_sampler = TargetedHemisphereSampler(spheres)

point_sampler = DiskSampler3D(detector_radius)

Expand All @@ -53,8 +53,8 @@ def raytraced_etendue(distance, detector_radius=0.001, ray_count=100000, batches
passed = 0.0
for origin in origins:

# obtain targetted vector sample
direction, pdf = targetted_sampler(origin, pdf=True)
# obtain targeted vector sample
direction, pdf = targeted_sampler(origin, pdf=True)
path_weight = R_2_PI * direction.z/pdf

origin = origin.transform(detector_transform)
Expand Down Expand Up @@ -110,12 +110,10 @@ def raytraced_etendue(distance, detector_radius=0.001, ray_count=100000, batches
raytraced_values = np.array(raytraced_values)
raytraced_errors = np.array(raytraced_errors)

plt.ion()

plt.figure()
ax = plt.gca()
ax.set_xscale("log", nonposx='clip')
ax.set_yscale("log", nonposy='clip')
ax.set_xscale("log", nonpositive='clip')
ax.set_yscale("log", nonpositive='clip')
plt.axhline(y=detector_etendue, linestyle='--', color='k', label='detector etendue')
plt.plot(distance_samples, analytic_values, label='analytic etendue')
plt.errorbar(distance_samples, raytraced_values, raytraced_errors, label='ray-traced etendue')
Expand All @@ -126,12 +124,11 @@ def raytraced_etendue(distance, detector_radius=0.001, ray_count=100000, batches

# plt.figure()
# ax = plt.gca()
# ax.set_xscale("log", nonposx='clip')
# ax.set_xscale("log", nonpositive='clip')
# plt.errorbar(distance_samples, np.abs(raytraced_values-analytic_values)/raytraced_values, raytraced_errors/raytraced_values)
# plt.xlim(0.001, 0.1)
# plt.ylim(0, 0.5)
# plt.xlabel('Distance between slit and detector (m)')
# plt.ylabel('Fractional error')
# plt.show()


plt.show()
6 changes: 3 additions & 3 deletions demos/optics/logging_trajectories.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

# for each sample direction trace a logging ray and plot the ray trajectory
plt.ion()
fig = plt.figure()
ax = fig.gca(projection='3d')
ax = plt.axes(projection='3d')

for u in np.linspace(-0.006, 0.006, 5):
for v in np.linspace(-0.012, 0.012, 11):
Expand All @@ -39,7 +38,8 @@
log_ray.trace(world)

p = [(start.x, start.y, start.z)]
for point in log_ray.log:
for intersection in log_ray.log:
point = intersection.hit_point
p.append((point.x, point.y, point.z))
p = np.array(p)

Expand Down
Loading