0.1.8
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
1"""
2Validation module for PyHelios.
3
4This module provides comprehensive parameter validation for all PyHelios operations,
5ensuring fail-fast behavior with clear error messages before reaching C++ code.
6
7Public API:
8 ValidationError: Exception for validation failures
9
10 Core validators:
11 validate_vec3, validate_rgb_color, validate_positive_value
12
13 Decorators:
14 validate_geometry_params
15 validate_plugin_params
16
17 Coercion functions:
18 coerce_to_vec3, coerce_to_vec2
19
20Following PyHelios's fail-fast philosophy, validation provides:
21- Clear, actionable error messages
22- Type coercion where safe (list to vec3)
23- Performance optimization via decorators
24- Comprehensive testing coverage
25"""
26
27from .exceptions import ValidationError
28from .core import (
29 validate_input,
30 is_finite_numeric,
31 coerce_to_vec3,
32 coerce_to_vec2,
33 validate_positive_value,
34 validate_non_negative_value
35)
36from .datatypes import (
37 validate_vec3,
38 validate_vec2,
39 validate_rgb_color,
40 validate_rgba_color,
41 validate_spherical_coord
42)
43from .geometry import (
44 validate_geometry_center,
45 validate_geometry_size2d,
46 validate_geometry_size3d,
47 validate_patch_params,
48 validate_triangle_params,
49 validate_sphere_params,
50 validate_tube_params,
51 validate_box_params
52)
53from .files import (
54 validate_file_path,
55 validate_directory_path
56)
57from .plugins import (
58 validate_wavelength_range,
59 validate_flux_value,
60 validate_ray_count,
61 validate_direction_vector,
62 validate_band_label,
63 validate_source_id,
64 validate_source_id_list,
65 validate_wpt_parameters,
66 validate_time_value,
67 validate_physical_quantity,
68 validate_tree_id,
69 validate_segment_resolution,
70 validate_angle_degrees,
71 validate_scaling_factor,
72 validate_filename,
73 validate_uuid_list,
74 validate_positive_integer_range,
75 validate_recursion_level,
76 validate_subdivision_count
77)
78from .plugin_decorators import (
79 # RadiationModel decorators
80 validate_radiation_band_params,
81 validate_collimated_source_params,
82 validate_sphere_source_params,
83 validate_sun_sphere_params,
84 validate_source_flux_multiple_params,
85 validate_get_source_flux_params,
86 validate_update_geometry_params,
87 validate_run_band_params,
88 validate_scattering_depth_params,
89 validate_min_scatter_energy_params,
90 # WeberPennTree decorators
91 validate_tree_uuid_params,
92 validate_recursion_params,
93 validate_trunk_segment_params,
94 validate_branch_segment_params,
95 validate_leaf_subdivisions_params,
96 # EnergyBalance decorators
97 validate_energy_run_params,
98 validate_energy_band_params,
99 validate_air_energy_params,
100 validate_evaluate_air_energy_params,
101 validate_output_data_params,
102 validate_print_report_params,
103 # Visualizer decorators
104 validate_build_geometry_params,
105 validate_print_window_params
106)
107
108__all__ = [
109 # Exceptions
110 'ValidationError',
111
112 # Core functions
113 'validate_input',
114 'is_finite_numeric',
115 'coerce_to_vec3',
116 'coerce_to_vec2',
117 'validate_positive_value',
118 'validate_non_negative_value',
119
120 # DataTypes validation
121 'validate_vec3',
122 'validate_vec2',
123 'validate_rgb_color',
124 'validate_rgba_color',
125 'validate_spherical_coord',
126
127 # Geometry validation
128 'validate_geometry_center',
129 'validate_geometry_size2d',
130 'validate_geometry_size3d',
131 'validate_patch_params',
132 'validate_triangle_params',
133 'validate_sphere_params',
134 'validate_tube_params',
135 'validate_box_params',
136
137 # File validation
138 'validate_file_path',
139 'validate_directory_path',
140
141 # Plugin validation
142 'validate_wavelength_range',
143 'validate_flux_value',
144 'validate_ray_count',
145 'validate_direction_vector',
146 'validate_band_label',
147 'validate_source_id',
148 'validate_source_id_list',
149 'validate_wpt_parameters',
150 'validate_time_value',
151 'validate_physical_quantity',
152 'validate_tree_id',
153 'validate_segment_resolution',
154 'validate_angle_degrees',
155 'validate_scaling_factor',
156 'validate_filename',
157 'validate_uuid_list',
158 'validate_positive_integer_range',
159 'validate_recursion_level',
160 'validate_subdivision_count',
161
162 # Plugin decorators
163 'validate_radiation_band_params',
164 'validate_collimated_source_params',
165 'validate_sphere_source_params',
166 'validate_sun_sphere_params',
167 'validate_source_flux_multiple_params',
168 'validate_get_source_flux_params',
169 'validate_update_geometry_params',
170 'validate_run_band_params',
171 'validate_scattering_depth_params',
172 'validate_min_scatter_energy_params',
173 'validate_tree_uuid_params',
174 'validate_recursion_params',
175 'validate_trunk_segment_params',
176 'validate_branch_segment_params',
177 'validate_leaf_subdivisions_params',
178 'validate_energy_run_params',
179 'validate_energy_band_params',
180 'validate_air_energy_params',
181 'validate_evaluate_air_energy_params',
182 'validate_output_data_params',
183 'validate_print_report_params',
184 'validate_build_geometry_params',
185 'validate_print_window_params'
186]