API Reference
Complete API documentation for all modules in L-SURF.
- Geometry Module
- Simulation Module
- Materials Module
- Module Structure
- Classes
- Constants
- Functions
MaterialFieldHomogeneousMaterialSimpleInhomogeneousModelGridInhomogeneousModelFullInhomogeneousModelExponentialAtmospherecreate_exponential_atmosphere()DuctAtmospherecreate_duct_atmosphere()sellmeier_refractive_index()cauchy_refractive_index()create_sellmeier_material()create_cauchy_material()device_sellmeier_equation()device_cauchy_equation()- Material Classes
- Inhomogeneous Material Base Classes
- Predefined Materials
- Atmosphere Implementations
- Dispersion Functions
- Material Classes
- Pre-defined Materials
- Dispersion Models
- Factory Functions
- Examples
- Sources Module
- Surfaces Module
- Surface Types
- Protocol
SurfaceSurfaceRoleGPUSurfaceSurfaceTypeInforegister_surface_type()get_surface_type()get_surface_type_id()get_surface_class()is_gpu_capable()list_surface_types()surface_type_exists()GeometryInforegister_geometry()get_geometry_info()get_geometry_id()list_geometries()geometry_exists()PlaneSurfaceSphereSurfaceRecordingSphereSurfaceLocalRecordingSphereSurfaceGPUGerstnerWaveSurfaceGPUCurvedWaveSurfaceGPUMultiCurvedWaveSurfaceBoundedPlaneSurfaceAnnularPlaneSurfaceGerstnerWaveSurfaceCurvedWaveSurfaceGerstnerWaveParams- Surface Classes
- Detectors Module
- Module Structure
- Primary Classes
- Available Detectors
- Analysis Functions
- Interface
DetectorResultDetectorProtocolAccumulatingDetectorProtocolExtendedDetectorProtocolDetectorDetectionEventSphericalDetectorPlanarDetectorDirectionalDetectorRecordingSphereDetectorLocalRecordingSphereDetectorRecordingSphereBaseRecordingSphereLocalRecordingSpherecompute_angular_distribution()compute_time_distribution()compute_intensity_distribution()compute_wavelength_distribution()compute_statistics()detect_multi_spherical_gpu()detect_multi_position_gpu()ConstantSizeDetectorRingscreate_default_detector_rings()- Detector Classes
- Detection Analysis
- Propagation Module
- Interactions Module
- Visualization Module
- Modules
get_color_mapping()get_projection_config()wavelength_to_color()setup_axis_grid()add_colorbar()create_figure()save_figure()plot_ray_paths_projection()plot_ray_endpoints_scatter()plot_ray_endpoints_histogram()plot_surface_profile()plot_bounce_points()plot_incoming_rays()plot_reflected_rays()plot_multi_bounce_paths()create_ray_overview_figure()plot_production_ray_overview()plot_wave_surface_detail()plot_ray_paths_with_surface()plot_fresnel_reflection()plot_brewster_validation()plot_polarization_vector_components()plot_polarization_ellipse()plot_polarization_vs_elevation()plot_fresnel_reflectance_curves()plot_measured_polarization_reflectance()get_ray_coordinates()plot_ray_paths_2d()plot_ray_endpoints()plot_beam_slice()plot_wavelength_histogram()plot_wavelength_intensity_histogram()plot_detection_counts()plot_detection_efficiency()plot_mean_arrival_time()plot_timing_distribution()plot_arrival_angle_distribution()plot_angular_histogram()create_wavelength_figure()create_beam_profile_figure()create_detector_scan_figure()plot_detector_scan_results()plot_statistics_evolution()plot_beam_profile()plot_wavelength_distribution()create_ocean_simulation_figures()plot_geometry_schematic()plot_ocean_intersections_top_view()plot_3d_intersection_scatter()plot_pareto_front()plot_energy_density_map()plot_mollweide_detector_projection()plot_time_spread_comparison()plot_arrival_time_distributions()plot_time_spread_geometry_side()plot_beam_footprint_top()plot_arrival_time_histogram()plot_footprint_arrival_times()plot_time_spread_vs_divergence()create_time_spread_schematic()create_arrival_time_figure()plot_ray_trajectories()plot_refractive_index_profile()plot_trajectory_offset()plot_horizontal_ray_deviation()create_atmospheric_refraction_figure()create_atmospheric_refraction_figure_with_offset()plot_trajectory_comparison()save_atmospheric_figure()plot_homogeneous_absorption()plot_exponential_atmosphere_absorption()plot_spectral_atmosphere_absorption()plot_geometry_analysis()plot_ring_side_view()plot_ring_overview()plot_ring_azimuth_heatmap()plot_timing_heatmap()plot_per_ring_timing_distributions()plot_spread_analysis()plot_polar_irradiance()plot_ring_time_spread_comparison()plot_constant_size_timing_analysis()plot_constant_size_timing_distributions()compute_ring_azimuth_maps()compute_ring_spread_stats()compute_constant_size_bin_stats()- Submodules
- Utilities Module
Module Overview
Simulation Framework
- Geometry Module
GeometryBuilder for constructing simulation geometries with named media.
- Simulation Module
Simulation class and SimulationConfig for running ray tracing simulations.
- Propagation Module
Ray propagation engines including GPU-accelerated gradient propagators.
Core Modules
- Materials Module
Material property definitions including refractive indices, dispersion models, and atmospheric profiles.
- Sources Module
Ray generation from various source types (point, collimated, diverging, gaussian).
- Surfaces Module
Surface geometry and ray-surface intersection (planar, spherical, wave surfaces).
- Detectors Module
Detection and analysis of rays at specified locations.
- Interactions Module
High-level functions for processing ray-surface interactions.
- Visualization Module
Plotting and visualization tools for ray paths, detections, and distributions.
- Utilities Module
Supporting utilities for ray data structures and Fresnel calculations.
Quick Reference
Setting Up a Simulation
import lsurf as sr
from lsurf.geometry import GeometryBuilder
from lsurf.simulation import Simulation, SimulationConfig
from lsurf.surfaces import SphereSurface, PlaneSurface, SurfaceRole
# Build geometry
geometry = (
GeometryBuilder()
.register_medium("air", sr.AIR_STP)
.register_medium("water", sr.WATER)
.set_background("air")
.add_surface(ocean_surface, front="air", back="water")
.add_detector(detector_plane)
.build()
)
# Configure and run
config = SimulationConfig(step_size=100.0, max_bounces=5)
sim = Simulation(geometry, config)
result = sim.run(rays)
Creating Objects
import lsurf as sr
from lsurf.surfaces import SurfaceRole
# Materials
material = sr.WATER
atmosphere = sr.ExponentialAtmosphere(n_sea_level=1.000293)
custom = sr.create_sellmeier_material(B1=1.03961212, ...)
# Sources
source = sr.CollimatedBeam(center=(0,0,1), direction=(0,0,-1), ...)
# Surfaces (with roles)
surface = sr.PlaneSurface(
point=(0,0,0), normal=(0,0,1),
role=SurfaceRole.OPTICAL, name="surface"
)
# Detectors
detector = sr.PlaneSurface(
point=(0,0,10), normal=(0,0,1),
role=SurfaceRole.DETECTOR, name="detector"
)
Processing Results
result = sim.run(rays)
# Access detected rays
detected = result.detected
print(f"Detected: {detected.num_rays}")
print(f"Times: {detected.times}")
print(f"Positions: {detected.positions}")
# Statistics
stats = result.statistics
print(f"Rays detected: {stats.rays_detected}")
print(f"Rays absorbed: {stats.rays_absorbed}")
print(f"Bounces completed: {stats.bounces_completed}")
# Per-detector breakdown
for name, count in result.detections_per_surface.items():
print(f" {name}: {count}")
Simple Surface Interaction
For quick tests without full simulation:
# Direct surface interaction
reflected, refracted = sr.process_surface_interaction(
rays, surface, wavelength=532e-9
)
Visualization
from lsurf.visualization import (
plot_ray_paths_projection,
plot_detection_counts,
create_detector_scan_figure,
)
fig = plot_ray_paths_projection(
rays=initial_rays,
reflected_rays=reflected,
surface=surface,
)
Logging
import lsurf as sr
sr.configure_logging("INFO") # Simulation summaries
sr.configure_logging("DEBUG") # Per-bounce details