![]() |
0.1.33
|
High-level interface for radiation modeling and ray tracing. More...
High-level interface for radiation modeling and ray tracing.
This class provides a user-friendly wrapper around the native Helios radiation plugin with automatic plugin availability checking and graceful error handling.
Definition at line 429 of file RadiationModel.py.
Public Member Functions | |
| __init__ (self, Context context) | |
| Initialize RadiationModel with graceful plugin handling. | |
| __enter__ (self) | |
| Context manager entry. | |
| __exit__ (self, exc_type, exc_value, traceback) | |
| Context manager exit with proper cleanup. | |
| __del__ (self) | |
| Destructor to ensure GPU resources freed even without 'with' statement. | |
| get_native_ptr (self) | |
| Get native pointer for advanced operations. | |
| getNativePtr (self) | |
| Get native pointer for advanced operations. | |
| disableMessages (self) | |
| Disable RadiationModel status messages. | |
| enableMessages (self) | |
| Enable RadiationModel status messages. | |
| addRadiationBand (self, str band_label, float wavelength_min=None, float wavelength_max=None) | |
| Add radiation band with optional wavelength bounds. | |
| copyRadiationBand (self, str old_label, str new_label, float wavelength_min=None, float wavelength_max=None) | |
| Copy existing radiation band to new label, optionally with new wavelength range. | |
| int | addCollimatedRadiationSource (self, direction=None) |
| Add collimated radiation source. | |
| int | addSphereRadiationSource (self, position, float radius) |
| Add spherical radiation source. | |
| int | addSunSphereRadiationSource (self, float radius, float zenith, float azimuth, float position_scaling=1.0, float angular_width=0.53, float flux_scaling=1.0) |
| Add sun sphere radiation source. | |
| setSourcePosition (self, int source_id, position) | |
| Set position of a radiation source. | |
| int | addRectangleRadiationSource (self, position, size, rotation) |
| Add a rectangle (planar) radiation source. | |
| int | addDiskRadiationSource (self, position, float radius, rotation) |
| Add a disk (circular planar) radiation source. | |
| setSourceSpectrum (self, source_id, spectrum) | |
| Set radiation spectrum for source(s). | |
| setSourceSpectrumIntegral (self, int source_id, float source_integral, float wavelength_min=None, float wavelength_max=None) | |
| Set source spectrum integral value. | |
| float | integrateSpectrum (self, object_spectrum, float wavelength_min=None, float wavelength_max=None, int source_id=None, camera_spectrum=None) |
| Integrate spectrum with optional source/camera spectra and wavelength range. | |
| float | integrateSourceSpectrum (self, int source_id, float wavelength_min, float wavelength_max) |
| Integrate source spectrum over wavelength range. | |
| scaleSpectrum (self, str existing_label, new_label_or_scale, float scale_factor=None) | |
| Scale spectrum in-place or to new label. | |
| scaleSpectrumRandomly (self, str existing_label, str new_label, float min_scale, float max_scale) | |
| Scale spectrum with random factor and store as new label. | |
| blendSpectra (self, str new_label, List[str] spectrum_labels, List[float] weights) | |
| Blend multiple spectra with specified weights. | |
| blendSpectraRandomly (self, str new_label, List[str] spectrum_labels) | |
| Blend multiple spectra with random weights. | |
| interpolateSpectrumFromPrimitiveData (self, List[int] primitive_uuids, List[str] spectra_labels, List[float] values, str primitive_data_query_label, str primitive_data_radprop_label) | |
| Interpolate spectral properties based on primitive data values. | |
| interpolateSpectrumFromObjectData (self, List[int] object_ids, List[str] spectra_labels, List[float] values, str object_data_query_label, str primitive_data_radprop_label) | |
| Interpolate spectral properties based on object data values. | |
| setDirectRayCount (self, str band_label, int ray_count) | |
| Set direct ray count for radiation band. | |
| setDiffuseRayCount (self, str band_label, int ray_count) | |
| Set diffuse ray count for radiation band. | |
| setDiffuseRadiationFlux (self, str label, float flux) | |
| Set diffuse radiation flux for band. | |
| setDiffuseRadiationExtinctionCoeff (self, str label, float K, peak_direction) | |
| Set diffuse radiation extinction coefficient with directional bias. | |
| float | getDiffuseFlux (self, str band_label) |
| Get diffuse flux for band. | |
| setDiffuseSpectrum (self, band_label, str spectrum_label) | |
| Set diffuse spectrum from global data label. | |
| setDiffuseSpectrumIntegral (self, float spectrum_integral, float wavelength_min=None, float wavelength_max=None, str band_label=None) | |
| Set diffuse spectrum integral. | |
| setSourceFlux (self, source_id, str label, float flux) | |
| Set source flux for single source or multiple sources. | |
| float | getSourceFlux (self, int source_id, str label) |
| Get source flux for band. | |
| updateGeometry (self, Optional[List[int]] uuids=None) | |
| Update geometry in radiation model. | |
| runBand (self, band_label) | |
| Run radiation simulation for single band or multiple bands. | |
| List[float] | getTotalAbsorbedFlux (self) |
| Get absorbed radiation flux density for all primitives, summed over all bands. | |
| Union["np.ndarray", Dict[str, "np.ndarray"]] | getAbsorbedFlux (self, Union[str, List[str]] band_label, Optional[List[int]] uuids=None) |
| Get per-band absorbed radiation flux density, aligned to UUIDs. | |
| bool | doesBandExist (self, str label) |
| Check if a radiation band exists. | |
| deleteRadiationSource (self, int source_id) | |
| Delete a radiation source. | |
| getSourcePosition (self, int source_id) | |
| Get position of a radiation source. | |
| float | getSkyEnergy (self) |
| Get total sky energy. | |
| float | calculateGtheta (self, view_direction) |
| Calculate G-function (geometry factor) for given view direction. | |
| optionalOutputPrimitiveData (self, str label) | |
| Enable optional primitive data output. | |
| enforcePeriodicBoundary (self, str boundary) | |
| Enforce periodic boundary conditions. | |
| setScatteringDepth (self, str label, int depth) | |
| Set scattering depth for radiation band. | |
| setMinScatterEnergy (self, str label, float energy) | |
| Set minimum scatter energy for radiation band. | |
| disableEmission (self, str label) | |
| Disable emission for radiation band. | |
| enableEmission (self, str label) | |
| Enable emission for radiation band. | |
| addRadiationCamera (self, str camera_label, List[str] band_labels, position, lookat_or_direction, camera_properties=None, int antialiasing_samples=100) | |
| Add a radiation camera to the simulation. | |
| addSIFCamera (self, str camera_label, List[str] emission_band_labels, position, lookat_or_direction, camera_properties=None, int antialiasing_samples=100) | |
| Add a solar-induced chlorophyll fluorescence (SIF) camera. | |
| bool | isSIFCamera (self, str camera_label) |
Return True if the camera was registered via :meth:addSIFCamera (vs. | |
| None | enableCameraFluxSmoothing (self, float crease_angle_degrees=30.0) |
| Reconstruct camera images by interpolating outgoing flux across each facet. | |
| None | disableCameraFluxSmoothing (self) |
| Reconstruct camera images by holding the outgoing flux constant across each facet. | |
| bool | isCameraFluxSmoothingEnabled (self) |
| Return True if camera images are reconstructed by interpolating flux across each facet. | |
| float | getCameraFluxSmoothingCreaseAngle (self) |
| Return the crease angle in degrees used by camera flux smoothing. | |
| setCameraPosition (self, str camera_label, position) | |
| Set camera position. | |
| getCameraPosition (self, str camera_label) | |
| Get camera position. | |
| setCameraLookat (self, str camera_label, lookat) | |
| Set camera lookat point. | |
| getCameraLookat (self, str camera_label) | |
| Get camera lookat point. | |
| setCameraOrientation (self, str camera_label, direction) | |
| Set camera orientation. | |
| getCameraOrientation (self, str camera_label) | |
| Get camera orientation. | |
| List[str] | getAllCameraLabels (self) |
| Get all camera labels. | |
| setCameraSpectralResponse (self, str camera_label, str band_label, str global_data) | |
| Set camera spectral response from global data. | |
| setCameraSpectralResponseFromLibrary (self, str camera_label, str camera_library_name) | |
| Set camera spectral response from standard camera library. | |
| List[float] | getCameraPixelData (self, str camera_label, str band_label) |
| Get camera pixel data for specific band. | |
| setCameraPixelData (self, str camera_label, str band_label, List[float] pixel_data) | |
| Set camera pixel data for specific band. | |
| addRadiationCameraFromLibrary (self, str camera_label, str library_camera_label, position, lookat, int antialiasing_samples=1, Optional[List[str]] band_labels=None) | |
| Add radiation camera loading all properties from camera library. | |
| updateCameraParameters (self, str camera_label, CameraProperties camera_properties) | |
| Update camera parameters for an existing camera. | |
| enableCameraMetadata (self, camera_labels) | |
| Enable automatic JSON metadata file writing for camera(s). | |
| str | writeCameraImage (self, str camera, List[str] bands, str imagefile_base, str image_path="./", int frame=-1, float flux_to_pixel_conversion=1.0) |
| Write camera image to file and return output filename. | |
| str | writeNormCameraImage (self, str camera, List[str] bands, str imagefile_base, str image_path="./", int frame=-1) |
| Write normalized camera image to file and return output filename. | |
| writeCameraImageData (self, str camera, str band, str imagefile_base, str image_path="./", int frame=-1) | |
| Write camera image data to file (ASCII format). | |
| writePrimitiveDataLabelMap (self, str camera, str primitive_data_label, str imagefile_base, str image_path="./", int frame=-1, float padvalue=float('nan')) | |
| Write a per-pixel primitive-data label map for a camera to a text file. | |
| writeObjectDataLabelMap (self, str camera, str object_data_label, str imagefile_base, str image_path="./", int frame=-1, float padvalue=float('nan')) | |
| Write a per-pixel object-data label map for a camera to a text file. | |
| 'np.ndarray' | getPrimitiveDataLabelMap (self, str camera, str primitive_data_label, float padvalue=float('nan')) |
| Return a per-pixel primitive-data label map for a camera as a NumPy array. | |
| 'np.ndarray' | getObjectDataLabelMap (self, str camera, str object_data_label, float padvalue=float('nan')) |
| Return a per-pixel object-data label map for a camera as a NumPy array. | |
| writeImageBoundingBoxes (self, str camera_label, primitive_data_labels=None, object_data_labels=None, object_class_ids=None, str image_file="", str classes_txt_file="classes.txt", str image_path="./") | |
| Write image bounding boxes for object detection training. | |
| writeImageSegmentationMasks (self, str camera_label, primitive_data_labels=None, object_data_labels=None, object_class_ids=None, str json_filename="", str image_file="", bool append_file=False) | |
| Write image segmentation masks in COCO JSON format. | |
| str | autoCalibrateCameraImage (self, str camera_label, str red_band_label, str green_band_label, str blue_band_label, str output_file_path, bool print_quality_report=False, str algorithm="MATRIX_3X3_AUTO", str ccm_export_file_path="") |
| Auto-calibrate camera image with color correction and return output filename. | |
| dict | getPluginInfo (self) |
| Get information about the radiation plugin. | |
| writeCameraImageDataEXR (self, str camera, band, str imagefile_base, str image_path="./", int frame=-1) | |
| Write camera pixel data to an EXR file with lossless float compression. | |
| writeDepthImageData (self, str camera_label, str imagefile_base, str image_path="./", int frame=-1) | |
| Write depth image data to an ASCII text file. | |
| writeDepthImageDataEXR (self, str camera_label, str imagefile_base, str image_path="./", int frame=-1) | |
| Write depth image data to an EXR file with lossless float compression. | |
| writeNormDepthImage (self, str camera_label, str imagefile_base, float max_depth, str image_path="./", int frame=-1) | |
| Write normalized depth image as grayscale JPEG. | |
| str | getBackendName (self) |
| Get the name of the active ray tracing backend. | |
Static Public Member Functions | |
| bool | probeAnyGPUBackend () |
| Probe whether any compiled-in GPU backend is available on this system. | |
| bool | gpuBackendsDisabledByEnvironment () |
Check whether GPU backends are vetoed by the HELIOS_NO_GPU environment variable. | |
Public Attributes | |
| context = context | |
| radiation_model = None | |
Protected Member Functions | |
| _check_context_alive (self) | |
| Raise if the owning Context has been destroyed (see Context.check_context_alive). | |
| _warn_if_bounded_bands_with_camera_response (self, str camera_label, List[str] band_labels, str operation) | |
| Warn when bands have explicit wavelength bounds and the camera has a spectral response. | |
| _check_camera_has_pixel_data (self, str camera, List[str] bands, str operation) | |
| Raise an actionable error if a camera/band has no rendered pixel data. | |
| _check_image_was_written (self, str filename, str camera, List[str] bands, str image_path, str operation) | |
| Raise if the native layer reported a failed write via an empty filename. | |
Protected Attributes | |
| bool | _geometry_updated = False |
| bool | _geometry_subset = False |
| _bounded_bands = set() | |
| pyhelios.RadiationModel.RadiationModel.__init__ | ( | self, | |
| Context | context ) |
Initialize RadiationModel with graceful plugin handling.
| context | Helios Context instance |
| TypeError | If context is not a Context instance |
| RadiationModelError | If radiation plugin is not available |
Definition at line 441 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.__del__ | ( | self | ) |
Destructor to ensure GPU resources freed even without 'with' statement.
Definition at line 645 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.__enter__ | ( | self | ) |
Context manager entry.
Definition at line 630 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.__exit__ | ( | self, | |
| exc_type, | |||
| exc_value, | |||
| traceback ) |
Context manager exit with proper cleanup.
Definition at line 634 of file RadiationModel.py.
|
protected |
Raise an actionable error if a camera/band has no rendered pixel data.
A camera's pixel data is populated only by ``runBand()``, and only for the bands passed to that call and for cameras that already existed when it ran. Requesting an image for an unrendered camera/band otherwise reaches the native layer as a bare ``invalid map<K, T> key`` from ``std::map::at`` -- see GitHub issue #4. This preflight turns that into a message naming the camera, the band, and the call the user is missing. This check is load-bearing rather than merely cosmetic, and must not be removed on the grounds that helios-core v1.3.79 addressed the same case upstream. The upstream change makes the native call return an empty filename instead of throwing, so without this preflight an unrendered camera would look like a successful write that produced no file. :meth:`_check_image_was_written` is the backstop for the failure modes this preflight cannot see, such as an unwritable output directory.
Definition at line 574 of file RadiationModel.py.
|
protected |
Raise if the owning Context has been destroyed (see Context.check_context_alive).
Definition at line 513 of file RadiationModel.py.
|
protected |
Raise if the native layer reported a failed write via an empty filename.
helios-core v1.3.79 changed ``writeCameraImage``/``writeNormCameraImage`` to return an empty string on failure rather than throwing, so no exception and no error code reaches Python. Returning that empty string to the caller -- or logging it as "written to: " -- would present a write that produced no file as a success, which the fail-fast policy forbids. :meth:`_check_camera_has_pixel_data` already rejects the unrendered-camera and unrendered-band cases before the native call, so by the time an empty filename gets here the likeliest cause is an output directory that does not exist or cannot be written.
Definition at line 616 of file RadiationModel.py.
|
protected |
Warn when bands have explicit wavelength bounds and the camera has a spectral response.
The two combined silently produce wrong colors. Helios computes camera pixels by integrating surface reflectance against the camera's spectral response curve, but computes SCATTERED flux by integrating over the band's wavelength bounds instead. When bounds are absent Helios deliberately falls back to the camera-weighted average for scattering, so both paths agree; setting bounds breaks that agreement.
With scattering enabled most camera-visible light is scattered, so the image carries band-limited color the camera never expected. Low-chroma natural surfaces are hit hardest: a measured soil spectrum whose true red/green ratio is 1.2 renders at 2.6 – brown soil comes out pink – while saturated colorboard-style spectra survive and look fine, which makes the problem easy to miss.
Nothing errors and no output looks obviously broken, so this is a warning at the point the camera is created rather than a failure.
Definition at line 538 of file RadiationModel.py.
| int pyhelios.RadiationModel.RadiationModel.addCollimatedRadiationSource | ( | self, | |
| direction = None ) |
Add collimated radiation source.
| direction | Optional direction vector. Can be tuple (x, y, z), vec3, or None for default direction. |
Definition at line 744 of file RadiationModel.py.
| int pyhelios.RadiationModel.RadiationModel.addDiskRadiationSource | ( | self, | |
| position, | |||
| float | radius, | ||
| rotation ) |
Add a disk (circular planar) radiation source.
Disk sources are useful for modeling circular light sources such as spotlights, circular LED arrays, or solar simulators.
| position | Center position as vec3 or list [x, y, z] |
| radius | Disk radius |
| rotation | Rotation vector as vec3 or list [rx, ry, rz] (Euler angles in radians) |
Definition at line 907 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.addRadiationBand | ( | self, | |
| str | band_label, | ||
| float | wavelength_min = None, | ||
| float | wavelength_max = None ) |
Add radiation band with optional wavelength bounds.
| band_label | Name/label for the radiation band |
| wavelength_min | Optional minimum wavelength (nm) |
| wavelength_max | Optional maximum wavelength (nm) |
Definition at line 683 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.addRadiationCamera | ( | self, | |
| str | camera_label, | ||
| List[str] | band_labels, | ||
| position, | |||
| lookat_or_direction, | |||
| camera_properties = None, | |||
| int | antialiasing_samples = 100 ) |
Add a radiation camera to the simulation.
| camera_label | Unique label string for the camera |
| band_labels | List of radiation band labels for the camera |
| position | Camera position as vec3 object |
| lookat_or_direction | Either:
|
| camera_properties | CameraProperties instance or None for defaults |
| antialiasing_samples | Number of antialiasing samples (default: 100) |
| ValidationError | If parameters are invalid or have wrong types |
| RadiationModelError | If camera creation fails |
Definition at line 1885 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.addRadiationCameraFromLibrary | ( | self, | |
| str | camera_label, | ||
| str | library_camera_label, | ||
| position, | |||
| lookat, | |||
| int | antialiasing_samples = 1, | ||
| Optional[List[str]] | band_labels = None ) |
Add radiation camera loading all properties from camera library.
Loads camera intrinsic parameters (resolution, FOV, sensor size) and spectral response data from the camera library XML file. This is the recommended way to create realistic cameras with proper spectral responses.
| camera_label | Label for the camera instance |
| library_camera_label | Label of camera in library (e.g., "Canon_20D", "iPhone11", "NikonD700") |
| position | Camera position as vec3 or (x, y, z) tuple |
| lookat | Lookat point as vec3 or (x, y, z) tuple |
| antialiasing_samples | Number of ray samples per pixel. Default: 1 |
| band_labels | Optional custom band labels. If None, uses library defaults. |
| RadiationModelError | If operation fails |
| ValueError | If parameters are invalid |
Definition at line 2443 of file RadiationModel.py.
| int pyhelios.RadiationModel.RadiationModel.addRectangleRadiationSource | ( | self, | |
| position, | |||
| size, | |||
| rotation ) |
Add a rectangle (planar) radiation source.
Rectangle sources are ideal for modeling artificial lighting such as LED panels, grow lights, or window light sources.
| position | Center position as vec3 or list [x, y, z] |
| size | Rectangle dimensions as vec2 or list [width, height] |
| rotation | Rotation vector as vec3 or list [rx, ry, rz] (Euler angles in radians) |
Definition at line 876 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.addSIFCamera | ( | self, | |
| str | camera_label, | ||
| List[str] | emission_band_labels, | ||
| position, | |||
| lookat_or_direction, | |||
| camera_properties = None, | |||
| int | antialiasing_samples = 100 ) |
Add a solar-induced chlorophyll fluorescence (SIF) camera.
Each band in ``emission_band_labels`` must already exist (added via :meth:`addRadiationBand`); those bands are flagged internally as SIF-emitting and use the Fluspect-B leaf-fluorescence kernel for emission instead of Stefan-Boltzmann. Helios auto-creates internal radiation bands covering 400-750 nm at the resolution specified by ``camera_properties.excitation_bin_width_nm``.
| camera_label | Unique label for the camera. |
| emission_band_labels | List of pre-existing radiation band labels to drive with SIF emission. |
| position | Camera position as a vec3. |
| lookat_or_direction | Either a vec3 lookat point or a SphericalCoord viewing direction. |
| camera_properties | :class:SIFCameraProperties instance. If None defaults are used (10 nm excitation bins, no excitation scattering). |
| antialiasing_samples | Antialiasing samples per pixel (>= 1, default 100). |
| RadiationModelError | If the underlying SIF camera cannot be added (e.g., an emission band was already bound to a different excitation bin width). |
| NotImplementedError | If running against helios-core older than v1.3.72. |
Definition at line 1980 of file RadiationModel.py.
| int pyhelios.RadiationModel.RadiationModel.addSphereRadiationSource | ( | self, | |
| position, | |||
| float | radius ) |
Add spherical radiation source.
| position | Position of the source. Can be tuple (x, y, z) or vec3. |
| radius | Radius of the spherical source |
Definition at line 789 of file RadiationModel.py.
| int pyhelios.RadiationModel.RadiationModel.addSunSphereRadiationSource | ( | self, | |
| float | radius, | ||
| float | zenith, | ||
| float | azimuth, | ||
| float | position_scaling = 1.0, | ||
| float | angular_width = 0.53, | ||
| float | flux_scaling = 1.0 ) |
Add sun sphere radiation source.
| radius | Radius of the sun sphere |
| zenith | Zenith angle (degrees) |
| azimuth | Azimuth angle (degrees) |
| position_scaling | Position scaling factor |
| angular_width | Angular width of the sun (degrees) |
| flux_scaling | Flux scaling factor |
Definition at line 817 of file RadiationModel.py.
| str pyhelios.RadiationModel.RadiationModel.autoCalibrateCameraImage | ( | self, | |
| str | camera_label, | ||
| str | red_band_label, | ||
| str | green_band_label, | ||
| str | blue_band_label, | ||
| str | output_file_path, | ||
| bool | print_quality_report = False, | ||
| str | algorithm = "MATRIX_3X3_AUTO", | ||
| str | ccm_export_file_path = "" ) |
Auto-calibrate camera image with color correction and return output filename.
| camera_label | Camera label |
| red_band_label | Red band label |
| green_band_label | Green band label |
| blue_band_label | Blue band label |
| output_file_path | Output file path |
| print_quality_report | Whether to print quality report |
| algorithm | Color correction algorithm ("DIAGONAL_ONLY", "MATRIX_3X3_AUTO", "MATRIX_3X3_FORCE") |
| ccm_export_file_path | Path to export color correction matrix (optional) |
| RadiationModelError | If auto-calibration fails |
| TypeError | If parameters have incorrect types |
| ValueError | If algorithm is not valid |
Definition at line 3106 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.blendSpectra | ( | self, | |
| str | new_label, | ||
| List[str] | spectrum_labels, | ||
| List[float] | weights ) |
Blend multiple spectra with specified weights.
Creates weighted combination of spectra, useful for mixing material properties or creating composite light sources.
| new_label | New global data label for blended spectrum |
| spectrum_labels | List of spectrum labels to blend |
| weights | List of weights (must sum to reasonable values, same length as labels) |
Definition at line 1132 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.blendSpectraRandomly | ( | self, | |
| str | new_label, | ||
| List[str] | spectrum_labels ) |
Blend multiple spectra with random weights.
Creates random combinations of spectra, useful for generating diverse material properties in stochastic simulations.
| new_label | New global data label for blended spectrum |
| spectrum_labels | List of spectrum labels to blend |
Definition at line 1161 of file RadiationModel.py.
| float pyhelios.RadiationModel.RadiationModel.calculateGtheta | ( | self, | |
| view_direction ) |
Calculate G-function (geometry factor) for given view direction.
The G-function describes the geometric relationship between leaf area distribution and viewing direction, important for canopy radiation modeling. The G-function is computed from the geometry currently loaded in the radiation model. If no geometry has been built yet, this method builds it automatically (with a warning) so the query operates on the current context geometry. If the result is still undefined (no primitives / zero leaf area), a RuntimeError is raised rather than silently returning NaN. A subset built by ``updateGeometry(uuids)`` is never widened by this method: the G-function is reported over the subset the caller selected.
| view_direction | View direction as vec3 or list/tuple [x, y, z] |
| RuntimeError | If the context has no geometry (or zero total leaf area), so the G-function is undefined. |
Definition at line 1755 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.copyRadiationBand | ( | self, | |
| str | old_label, | ||
| str | new_label, | ||
| float | wavelength_min = None, | ||
| float | wavelength_max = None ) |
Copy existing radiation band to new label, optionally with new wavelength range.
| old_label | Existing band label to copy |
| new_label | New label for the copied band |
| wavelength_min | Optional minimum wavelength for new band (nm) |
| wavelength_max | Optional maximum wavelength for new band (nm) |
Definition at line 716 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.deleteRadiationSource | ( | self, | |
| int | source_id ) |
Delete a radiation source.
| source_id | ID of the radiation source to delete |
Definition at line 1677 of file RadiationModel.py.
| None pyhelios.RadiationModel.RadiationModel.disableCameraFluxSmoothing | ( | self | ) |
Reconstruct camera images by holding the outgoing flux constant across each facet.
This is the default. Each pixel reports the outgoing flux of the primitive behind it.
| RadiationModelError | If the call fails |
| RuntimeError | If the native library predates helios-core v1.3.84 |
Definition at line 2122 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.disableEmission | ( | self, | |
| str | label ) |
Disable emission for radiation band.
Definition at line 1843 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.disableMessages | ( | self | ) |
Disable RadiationModel status messages.
Definition at line 664 of file RadiationModel.py.
| bool pyhelios.RadiationModel.RadiationModel.doesBandExist | ( | self, | |
| str | label ) |
Check if a radiation band exists.
| label | Name/label of the radiation band to check |
Definition at line 1660 of file RadiationModel.py.
| None pyhelios.RadiationModel.RadiationModel.enableCameraFluxSmoothing | ( | self, | |
| float | crease_angle_degrees = 30.0 ) |
Reconstruct camera images by interpolating outgoing flux across each facet.
Averages each primitive's outgoing flux onto the mesh vertices it shares with its neighbours and interpolates it back across the facet, so a coarsely tessellated curved surface reads as a curve rather than as a set of flat panels. This applies to Tube, Sphere, Cone, Polymesh, Tile and AdaptiveTile objects. A Box, a Disk, and any primitive belonging to no object are left alone, since their faces are genuinely flat. A polymesh must carry the face table that :meth:`Context.loadOBJ` and :meth:`Context.loadPLY` retain; one assembled from loose primitives by :meth:`Context.addPolymeshObject` has no topology and is left alone. Smoothing is off by default and should be enabled deliberately: it changes what the camera reports. A pixel no longer carries the outgoing flux of the primitive behind it, but a blend of that primitive's value with its neighbours', so pixel values no longer correspond exactly to the ``radiation_flux_*`` primitive data. The radiation solve, those primitive data values, and the pixel-label and depth images are all unchanged.
| crease_angle_degrees | Angle between adjacent facet normals above which a shared edge is treated as a hard crease, so flux is not averaged across it. Applies to polymesh objects only; the curved object types are smooth by construction and are never creased. Must be between 0 and 180 degrees. Defaults to 30. |
| RadiationModelError | If the crease angle is out of range or the call fails |
| RuntimeError | If the native library predates helios-core v1.3.84 |
updateGeometry.Definition at line 2094 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.enableCameraMetadata | ( | self, | |
| camera_labels ) |
Enable automatic JSON metadata file writing for camera(s).
When enabled, writeCameraImage() automatically creates a JSON metadata file alongside the image containing comprehensive camera and scene information.
| camera_labels | Single camera label (str) or list of camera labels (List[str]) |
| RadiationModelError | If operation fails |
| ValueError | If parameters are invalid |
Definition at line 2544 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.enableEmission | ( | self, | |
| str | label ) |
Enable emission for radiation band.
Definition at line 1850 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.enableMessages | ( | self | ) |
Enable RadiationModel status messages.
Definition at line 670 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.enforcePeriodicBoundary | ( | self, | |
| str | boundary ) |
Enforce periodic boundary conditions.
Periodic boundaries are useful for large-scale simulations to reduce edge effects by wrapping radiation at domain boundaries.
| boundary | Boundary specification string (e.g., "xy", "xyz", "x", "y", "z") |
Definition at line 1819 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.get_native_ptr | ( | self | ) |
Get native pointer for advanced operations.
Definition at line 655 of file RadiationModel.py.
| Union["np.ndarray", Dict[str, "np.ndarray"]] pyhelios.RadiationModel.RadiationModel.getAbsorbedFlux | ( | self, | |
| Union[str, List[str]] | band_label, | ||
| Optional[List[int]] | uuids = None ) |
Get per-band absorbed radiation flux density, aligned to UUIDs.
``runBand()`` stores each band's result as ``radiation_flux_<band>`` primitive the **total** absorbed flux density for that band, i.e. direct plus diffuse plus scattered contributions. This method reads that data back keyed by UUID, so element ``i`` of the result always belongs to ``uuids[i]``. Prefer this over :meth:`getTotalAbsorbedFlux`, which sums over every band (double-counting overlapping bands such as PAR/NIR/SW) and whose ordering does not correspond to ``context.getAllUUIDs()``.
| band_label | Band name, or a list of band names to fetch at once. |
| uuids | Primitives to query, defaulting to context.getAllUUIDs(). Results follow this list's order. |
| RadiationModelError | If a band does not exist, or if ``runBand()`` has not been run for it. |
Definition at line 1577 of file RadiationModel.py.
| List[str] pyhelios.RadiationModel.RadiationModel.getAllCameraLabels | ( | self | ) |
Get all camera labels.
Definition at line 2300 of file RadiationModel.py.
| str pyhelios.RadiationModel.RadiationModel.getBackendName | ( | self | ) |
Get the name of the active ray tracing backend.
Definition at line 3304 of file RadiationModel.py.
| float pyhelios.RadiationModel.RadiationModel.getCameraFluxSmoothingCreaseAngle | ( | self | ) |
Return the crease angle in degrees used by camera flux smoothing.
This is the value last passed to :meth:`enableCameraFluxSmoothing`, or 30.0 if it has never been called.
| RuntimeError | If the native library predates helios-core v1.3.84 |
Definition at line 2154 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.getCameraLookat | ( | self, | |
| str | camera_label ) |
Get camera lookat point.
| camera_label | Camera label string |
Definition at line 2238 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.getCameraOrientation | ( | self, | |
| str | camera_label ) |
Get camera orientation.
| camera_label | Camera label string |
Definition at line 2281 of file RadiationModel.py.
| List[float] pyhelios.RadiationModel.RadiationModel.getCameraPixelData | ( | self, | |
| str | camera_label, | ||
| str | band_label ) |
Get camera pixel data for specific band.
Retrieves raw pixel values for programmatic access and analysis.
| camera_label | Camera label |
| band_label | Band label |
Definition at line 2369 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.getCameraPosition | ( | self, | |
| str | camera_label ) |
Get camera position.
| camera_label | Camera label string |
Definition at line 2197 of file RadiationModel.py.
| float pyhelios.RadiationModel.RadiationModel.getDiffuseFlux | ( | self, | |
| str | band_label ) |
Get diffuse flux for band.
| band_label | Band label |
Definition at line 1323 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.getNativePtr | ( | self | ) |
Get native pointer for advanced operations.
(Legacy naming for compatibility)
Definition at line 659 of file RadiationModel.py.
| 'np.ndarray' pyhelios.RadiationModel.RadiationModel.getObjectDataLabelMap | ( | self, | |
| str | camera, | ||
| str | object_data_label, | ||
| float | padvalue = float('nan') ) |
Return a per-pixel object-data label map for a camera as a NumPy array.
Convenience wrapper around :meth:`writeObjectDataLabelMap`; see :meth:`getPrimitiveDataLabelMap` for behaviour. The label map is written to a temporary file, loaded with ``numpy.loadtxt``, and returned as a 2D ``(height, width)`` array with ``padvalue`` (NaN by default) for background pixels. The file does not persist.
| camera | Camera label |
| object_data_label | Object data label to map (float/double/uint/int) |
| padvalue | Value used for empty/background pixels (default: NaN) |
(height, width) (row-major).| RadiationModelError | If the label map generation fails |
| TypeError | If parameters have incorrect types |
Definition at line 2863 of file RadiationModel.py.
| dict pyhelios.RadiationModel.RadiationModel.getPluginInfo | ( | self | ) |
Get information about the radiation plugin.
Definition at line 3149 of file RadiationModel.py.
| 'np.ndarray' pyhelios.RadiationModel.RadiationModel.getPrimitiveDataLabelMap | ( | self, | |
| str | camera, | ||
| str | primitive_data_label, | ||
| float | padvalue = float('nan') ) |
Return a per-pixel primitive-data label map for a camera as a NumPy array.
Convenience wrapper around :meth:`writePrimitiveDataLabelMap` for the common use case of per-pixel masking in Python: the label map is written to a temporary file, loaded with ``numpy.loadtxt``, and returned as a 2D array. The file does not persist.
| camera | Camera label |
| primitive_data_label | Primitive data label to map (float/double/uint/int) |
| padvalue | Value used for empty/background pixels (default: NaN) |
(height, width) (row-major) holding the primitive-data value at each pixel, with padvalue (NaN by default) where no labelled geometry was seen.| RadiationModelError | If the label map generation fails |
| TypeError | If parameters have incorrect types |
Definition at line 2826 of file RadiationModel.py.
| float pyhelios.RadiationModel.RadiationModel.getSkyEnergy | ( | self | ) |
Get total sky energy.
Definition at line 1719 of file RadiationModel.py.
| float pyhelios.RadiationModel.RadiationModel.getSourceFlux | ( | self, | |
| int | source_id, | ||
| str | label ) |
Get source flux for band.
Definition at line 1400 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.getSourcePosition | ( | self, | |
| int | source_id ) |
Get position of a radiation source.
| source_id | ID of the radiation source |
Definition at line 1699 of file RadiationModel.py.
| List[float] pyhelios.RadiationModel.RadiationModel.getTotalAbsorbedFlux | ( | self | ) |
Get absorbed radiation flux density for all primitives, summed over all bands.
.. warning::
**The returned values cannot be matched to UUIDs by position.** They are
ordered by the radiation model's internal primitive ordering (grouped by
parent object, built during :meth:`updateGeometry`), which is *not* the
order of ``context.getAllUUIDs()`` -- that iterates an unordered map and
returns a hash order. Pairing the two by index silently attributes flux
to the wrong primitive. Use :meth:`getAbsorbedFlux` instead, which is
keyed by UUID.
.. warning::
This sums the ``radiation_flux_<band>`` primitive data over **every**
band registered in the model. For overlapping bands -- e.g. PAR, NIR
and SW, where SW already spans the other two -- the sum double-counts
and is not a physically meaningful quantity. Use
:meth:`getAbsorbedFlux` to get a single band's flux.
Units are **W/m^2** (flux density), not watts. Because it is a density, the
value does not change when a primitive's size changes: a 1x1 m and a 2x2 m
patch under the same collimated source both report the same number.
Summing the returned values directly (``sum(flux)``) adds flux densities of
differently-sized surfaces and is not physically meaningful. To obtain
absorbed power in watts, weight each primitive by its area -- via
:meth:`getAbsorbedFlux`, so that flux and area refer to the same primitive::
uuids = context.getAllUUIDs()
flux = radiation.getAbsorbedFlux("SW")
power = float((flux * context.getPrimitiveArea(uuids)).sum(dtype="float64"))
:meth:`getAbsorbedFlux`: band-specific, UUID-aligned absorbed flux.
Definition at line 1536 of file RadiationModel.py.
|
static |
Check whether GPU backends are vetoed by the HELIOS_NO_GPU environment variable.
True when ``HELIOS_NO_GPU`` is set to any value other than ``"0"``. The veto makes a GPU-equipped machine behave exactly like one with no compatible hardware :meth:`probeAnyGPUBackend` returns False and constructing a RadiationModel with the automatic backend fails. Requesting a backend by name bypasses the veto. Use this to tell an intentional veto apart from missing hardware when reporting why the GPU path is unavailable.
HELIOS_NO_GPU after the first call has no effect.| RuntimeError | If the native library predates helios-core v1.3.79 |
Definition at line 3374 of file RadiationModel.py.
| float pyhelios.RadiationModel.RadiationModel.integrateSourceSpectrum | ( | self, | |
| int | source_id, | ||
| float | wavelength_min, | ||
| float | wavelength_max ) |
Integrate source spectrum over wavelength range.
| source_id | Source ID |
| wavelength_min | Minimum wavelength |
| wavelength_max | Maximum wavelength |
Definition at line 1042 of file RadiationModel.py.
| float pyhelios.RadiationModel.RadiationModel.integrateSpectrum | ( | self, | |
| object_spectrum, | |||
| float | wavelength_min = None, | ||
| float | wavelength_max = None, | ||
| int | source_id = None, | ||
| camera_spectrum = None ) |
Integrate spectrum with optional source/camera spectra and wavelength range.
This unified method handles multiple integration scenarios: - Basic: Total spectrum integration - Range: Integration over wavelength range - Source: Integration weighted by source spectrum - Camera: Integration weighted by camera spectral response - Full: Integration with both source and camera spectra
| object_spectrum | Object spectrum as list of (wavelength, value) tuples/vec2 |
| wavelength_min | Optional minimum wavelength for integration range |
| wavelength_max | Optional maximum wavelength for integration range |
| source_id | Optional source ID for source spectrum weighting |
| camera_spectrum | Optional camera spectrum for camera response weighting |
Definition at line 1019 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.interpolateSpectrumFromObjectData | ( | self, | |
| List[int] | object_ids, | ||
| List[str] | spectra_labels, | ||
| List[float] | values, | ||
| str | object_data_query_label, | ||
| str | primitive_data_radprop_label ) |
Interpolate spectral properties based on object data values.
Automatically assigns spectra to object primitives by interpolating between reference spectra based on continuous object-level data values.
| object_ids | List of object IDs |
| spectra_labels | List of reference spectrum labels |
| values | List of data values corresponding to each spectrum |
| object_data_query_label | Object data label containing query values |
| primitive_data_radprop_label | Primitive data label to store assigned spectra |
Definition at line 1242 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.interpolateSpectrumFromPrimitiveData | ( | self, | |
| List[int] | primitive_uuids, | ||
| List[str] | spectra_labels, | ||
| List[float] | values, | ||
| str | primitive_data_query_label, | ||
| str | primitive_data_radprop_label ) |
Interpolate spectral properties based on primitive data values.
Automatically assigns spectra to primitives by interpolating between reference spectra based on continuous data values (e.g., age, moisture, etc.).
| primitive_uuids | List of primitive UUIDs to assign spectra |
| spectra_labels | List of reference spectrum labels |
| values | List of data values corresponding to each spectrum |
| primitive_data_query_label | Primitive data label containing query values |
| primitive_data_radprop_label | Primitive data label to store assigned spectra |
Definition at line 1197 of file RadiationModel.py.
| bool pyhelios.RadiationModel.RadiationModel.isCameraFluxSmoothingEnabled | ( | self | ) |
Return True if camera images are reconstructed by interpolating flux across each facet.
| RuntimeError | If the native library predates helios-core v1.3.84 |
Definition at line 2139 of file RadiationModel.py.
| bool pyhelios.RadiationModel.RadiationModel.isSIFCamera | ( | self, | |
| str | camera_label ) |
Return True if the camera was registered via :meth:addSIFCamera (vs.
addRadiationCamera).
Definition at line 2047 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.optionalOutputPrimitiveData | ( | self, | |
| str | label ) |
Enable optional primitive data output.
| label | Name/label of the primitive data to output |
Definition at line 1800 of file RadiationModel.py.
|
static |
Probe whether any compiled-in GPU backend is available on this system.
Probes backends in priority order (OptiX 8 -> OptiX 6 -> Vulkan) without constructing a full backend. Useful for checking GPU availability before creating a RadiationModel. This is the PyHelios equivalent of the native ``RadiationModel::isGPUBackendAvailable()``, which as of helios-core v1.3.79 is a pure delegate to the same underlying probe. Returns False when ``HELIOS_NO_GPU`` is set to anything other than ``"0"``, whatever hardware is actually present -- see :meth:`gpuBackendsDisabledByEnvironment` to distinguish an environment veto from genuinely absent hardware.
Definition at line 3341 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.runBand | ( | self, | |
| band_label ) |
Run radiation simulation for single band or multiple bands.
PERFORMANCE When simulating multiple radiation bands, it is HIGHLY RECOMMENDED to run all bands in a single call (e.g., runBand(["PAR", "NIR", "SW"])) rather than sequential single-band calls. This provides significant computational efficiency gains because: - GPU ray tracing setup is done once for all bands - Scene geometry acceleration structures are reused - GPU kernel launches are batched together - Memory transfers between CPU/GPU are minimized
radiation.runBand(["PAR", "NIR", "SW"])
radiation.runBand("PAR") radiation.runBand("NIR") radiation.runBand("SW")
| band_label | Single band name (str) or list of band names for multi-band simulation |
updateGeometry call is not required first. A subset build from updateGeometry(uuids) is preserved: it is never rebuilt automatically, since that would discard the subset. Definition at line 1475 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.scaleSpectrum | ( | self, | |
| str | existing_label, | ||
| new_label_or_scale, | |||
| float | scale_factor = None ) |
Scale spectrum in-place or to new label.
Useful for adjusting spectrum intensities or creating variations of
existing spectra for sensitivity analysis.
Supports two call patterns:
- scaleSpectrum("label", scale) -> scales in-place
- scaleSpectrum("existing", "new", scale) -> creates new scaled spectrum
| existing_label | Existing global data label |
| new_label_or_scale | Either new label string (if creating new) or scale factor (if in-place) |
| scale_factor | Scale factor (required only if new_label_or_scale is a string) |
Definition at line 1073 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.scaleSpectrumRandomly | ( | self, | |
| str | existing_label, | ||
| str | new_label, | ||
| float | min_scale, | ||
| float | max_scale ) |
Scale spectrum with random factor and store as new label.
Useful for creating stochastic variations in spectral properties for Monte Carlo simulations or uncertainty quantification.
| existing_label | Existing global data label |
| new_label | New global data label for scaled spectrum |
| min_scale | Minimum scale factor |
| max_scale | Maximum scale factor |
Definition at line 1099 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setCameraLookat | ( | self, | |
| str | camera_label, | ||
| lookat ) |
Set camera lookat point.
| camera_label | Camera label string |
| lookat | Lookat point as vec3 or list [x, y, z] |
Definition at line 2216 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setCameraOrientation | ( | self, | |
| str | camera_label, | ||
| direction ) |
Set camera orientation.
| camera_label | Camera label string |
| direction | View direction as vec3, SphericalCoord, or list [x, y, z] |
Definition at line 2259 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setCameraPixelData | ( | self, | |
| str | camera_label, | ||
| str | band_label, | ||
| List[float] | pixel_data ) |
Set camera pixel data for specific band.
Allows programmatic modification of pixel values.
| camera_label | Camera label |
| band_label | Band label |
| pixel_data | List of pixel values |
Definition at line 2393 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setCameraPosition | ( | self, | |
| str | camera_label, | ||
| position ) |
Set camera position.
Allows dynamic camera repositioning during simulation, useful for time-series captures or multi-view imaging.
| camera_label | Camera label string |
| position | Camera position as vec3 or list [x, y, z] |
Definition at line 2175 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setCameraSpectralResponse | ( | self, | |
| str | camera_label, | ||
| str | band_label, | ||
| str | global_data ) |
Set camera spectral response from global data.
| camera_label | Camera label |
| band_label | Band label |
| global_data | Global data label for spectral response curve |
Definition at line 2316 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setCameraSpectralResponseFromLibrary | ( | self, | |
| str | camera_label, | ||
| str | camera_library_name ) |
Set camera spectral response from standard camera library.
Uses pre-defined spectral response curves for common cameras.
| camera_label | Camera label |
| camera_library_name | Standard camera name (e.g., "iPhone13", "NikonD850", "CanonEOS5D") |
Definition at line 2342 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setDiffuseRadiationExtinctionCoeff | ( | self, | |
| str | label, | ||
| float | K, | ||
| peak_direction ) |
Set diffuse radiation extinction coefficient with directional bias.
Models directionally-biased diffuse radiation (e.g., sky radiation with zenith peak).
| label | Band label |
| K | Extinction coefficient |
| peak_direction | Peak direction as vec3, SphericalCoord, or list [x, y, z] |
Definition at line 1301 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setDiffuseRadiationFlux | ( | self, | |
| str | label, | ||
| float | flux ) |
Set diffuse radiation flux for band.
Definition at line 1280 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setDiffuseRayCount | ( | self, | |
| str | band_label, | ||
| int | ray_count ) |
Set diffuse ray count for radiation band.
Definition at line 1272 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setDiffuseSpectrum | ( | self, | |
| band_label, | |||
| str | spectrum_label ) |
Set diffuse spectrum from global data label.
| band_label | Band label (string) or list of band labels |
| spectrum_label | Spectrum global data label |
Definition at line 1340 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setDiffuseSpectrumIntegral | ( | self, | |
| float | spectrum_integral, | ||
| float | wavelength_min = None, | ||
| float | wavelength_max = None, | ||
| str | band_label = None ) |
Set diffuse spectrum integral.
| spectrum_integral | Integral value |
| wavelength_min | Optional minimum wavelength |
| wavelength_max | Optional maximum wavelength |
| band_label | Optional specific band label (None for all bands) |
Definition at line 1367 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setDirectRayCount | ( | self, | |
| str | band_label, | ||
| int | ray_count ) |
Set direct ray count for radiation band.
Definition at line 1264 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setMinScatterEnergy | ( | self, | |
| str | label, | ||
| float | energy ) |
Set minimum scatter energy for radiation band.
Definition at line 1837 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setScatteringDepth | ( | self, | |
| str | label, | ||
| int | depth ) |
Set scattering depth for radiation band.
Definition at line 1830 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setSourceFlux | ( | self, | |
| source_id, | |||
| str | label, | ||
| float | flux ) |
Set source flux for single source or multiple sources.
Definition at line 1381 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setSourcePosition | ( | self, | |
| int | source_id, | ||
| position ) |
Set position of a radiation source.
Allows dynamic repositioning of radiation sources during simulation, useful for time-series modeling or moving light sources.
| source_id | ID of the radiation source |
| position | New position as vec3, SphericalCoord, or list/tuple [x, y, z] |
Definition at line 844 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setSourceSpectrum | ( | self, | |
| source_id, | |||
| spectrum ) |
Set radiation spectrum for source(s).
Spectral distributions define how radiation intensity varies with wavelength, essential for realistic modeling of different light sources (sunlight, LEDs, etc.).
| source_id | Source ID (int) or list of source IDs |
| spectrum | Either:
|
Definition at line 943 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.setSourceSpectrumIntegral | ( | self, | |
| int | source_id, | ||
| float | source_integral, | ||
| float | wavelength_min = None, | ||
| float | wavelength_max = None ) |
Set source spectrum integral value.
Normalizes the spectrum so that its integral equals the specified value, useful for calibrating source intensity.
| source_id | Source ID |
| source_integral | Target integral value |
| wavelength_min | Optional minimum wavelength for integration range |
| wavelength_max | Optional maximum wavelength for integration range |
Definition at line 965 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.updateCameraParameters | ( | self, | |
| str | camera_label, | ||
| CameraProperties | camera_properties ) |
Update camera parameters for an existing camera.
Allows modification of camera properties after creation while preserving position, lookat direction, and spectral band configuration.
| camera_label | Label for the camera to update |
| camera_properties | CameraProperties instance with new parameters |
| RadiationModelError | If operation fails or camera doesn't exist |
| ValueError | If parameters are invalid |
runBand before its image can be written again; :meth:writeCameraImage will otherwise report that the camera has no rendered pixel data. Changing any other parameter leaves existing image data intact.Definition at line 2503 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.updateGeometry | ( | self, | |
| Optional[List[int]] | uuids = None ) |
Update geometry in radiation model.
The two call forms differ in more than scope, as of helios-core v1.3.79:
- ``updateGeometry()`` (no argument) is **optional**. :meth:`runBand` builds
the geometry itself before tracing and rebuilds it whenever primitives have
been added to or deleted from the Context since the last build. Call it
explicitly only to control when the cost of the build is paid.
- ``updateGeometry(uuids)`` restricts the model to a subset of Context
primitives, and that subset is **never** rebuilt automatically -- doing so
would silently discard the subset you asked for. You must call it again
yourself after modifying Context geometry.
| uuids | Optional list of specific UUIDs to update. If None, updates all geometry. |
uuids latches the model into subset mode natively. Calling updateGeometry() with no argument afterwards clears that latch and returns the model to tracking the full Context. Definition at line 1428 of file RadiationModel.py.
| str pyhelios.RadiationModel.RadiationModel.writeCameraImage | ( | self, | |
| str | camera, | ||
| List[str] | bands, | ||
| str | imagefile_base, | ||
| str | image_path = "./", | ||
| int | frame = -1, | ||
| float | flux_to_pixel_conversion = 1.0 ) |
Write camera image to file and return output filename.
| camera | Camera label |
| bands | List of band labels to include in the image |
| imagefile_base | Base filename for output |
| image_path | Output directory path (default: current directory) |
| frame | Frame number to write (-1 for all frames) |
| flux_to_pixel_conversion | Conversion factor from flux to pixel values |
| RadiationModelError | If camera image writing fails |
| TypeError | If parameters have incorrect types |
Definition at line 2580 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.writeCameraImageData | ( | self, | |
| str | camera, | ||
| str | band, | ||
| str | imagefile_base, | ||
| str | image_path = "./", | ||
| int | frame = -1 ) |
Write camera image data to file (ASCII format).
| camera | Camera label |
| band | Band label |
| imagefile_base | Base filename for output |
| image_path | Output directory path (default: current directory) |
| frame | Frame number to write (-1 for all frames) |
| RadiationModelError | If camera image data writing fails |
| TypeError | If parameters have incorrect types |
Definition at line 2675 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.writeCameraImageDataEXR | ( | self, | |
| str | camera, | ||
| band, | |||
| str | imagefile_base, | ||
| str | image_path = "./", | ||
| int | frame = -1 ) |
Write camera pixel data to an EXR file with lossless float compression.
Preserves full floating-point precision unlike JPEG/PNG exports.
| camera | Camera label |
| band | Band label (str) for single-band, or list of band labels for multi-band |
| imagefile_base | Base filename for output |
| image_path | Output directory path (default: current directory) |
| frame | Frame number to append to filename (-1 to omit) |
| RadiationModelError | If writing fails |
| TypeError | If parameters have incorrect types |
Definition at line 3173 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.writeDepthImageData | ( | self, | |
| str | camera_label, | ||
| str | imagefile_base, | ||
| str | image_path = "./", | ||
| int | frame = -1 ) |
Write depth image data to an ASCII text file.
| camera_label | Camera label |
| imagefile_base | Base filename for output |
| image_path | Output directory path (default: current directory) |
| frame | Frame number to append to filename (-1 to omit) |
| RadiationModelError | If writing fails |
| TypeError | If parameters have incorrect types |
Definition at line 3213 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.writeDepthImageDataEXR | ( | self, | |
| str | camera_label, | ||
| str | imagefile_base, | ||
| str | image_path = "./", | ||
| int | frame = -1 ) |
Write depth image data to an EXR file with lossless float compression.
Preserves full floating-point depth precision unlike ASCII or JPEG exports.
| camera_label | Camera label |
| imagefile_base | Base filename for output |
| image_path | Output directory path (default: current directory) |
| frame | Frame number to append to filename (-1 to omit) |
| RadiationModelError | If writing fails |
| TypeError | If parameters have incorrect types |
Definition at line 3243 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.writeImageBoundingBoxes | ( | self, | |
| str | camera_label, | ||
| primitive_data_labels = None, | |||
| object_data_labels = None, | |||
| object_class_ids = None, | |||
| str | image_file = "", | ||
| str | classes_txt_file = "classes.txt", | ||
| str | image_path = "./" ) |
Write image bounding boxes for object detection training.
Supports both single and multiple data labels. Either provide primitive_data_labels or object_data_labels, not both.
| camera_label | Camera label |
| primitive_data_labels | Single primitive data label (str) or list of primitive data labels |
| object_data_labels | Single object data label (str) or list of object data labels |
| object_class_ids | Single class ID (int) or list of class IDs (must match data labels) |
| image_file | Image filename |
| classes_txt_file | Classes definition file (default: "classes.txt") |
| image_path | Image output path (default: current directory) |
| RadiationModelError | If bounding box writing fails |
| TypeError | If parameters have incorrect types |
| ValueError | If both primitive and object data labels are provided, or neither |
Definition at line 2898 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.writeImageSegmentationMasks | ( | self, | |
| str | camera_label, | ||
| primitive_data_labels = None, | |||
| object_data_labels = None, | |||
| object_class_ids = None, | |||
| str | json_filename = "", | ||
| str | image_file = "", | ||
| bool | append_file = False ) |
Write image segmentation masks in COCO JSON format.
Supports both single and multiple data labels. Either provide primitive_data_labels or object_data_labels, not both.
| camera_label | Camera label |
| primitive_data_labels | Single primitive data label (str) or list of primitive data labels |
| object_data_labels | Single object data label (str) or list of object data labels |
| object_class_ids | Single class ID (int) or list of class IDs (must match data labels) |
| json_filename | JSON output filename |
| image_file | Image filename |
| append_file | Whether to append to existing JSON file |
| RadiationModelError | If segmentation mask writing fails |
| TypeError | If parameters have incorrect types |
| ValueError | If both primitive and object data labels are provided, or neither |
Definition at line 3002 of file RadiationModel.py.
| str pyhelios.RadiationModel.RadiationModel.writeNormCameraImage | ( | self, | |
| str | camera, | ||
| List[str] | bands, | ||
| str | imagefile_base, | ||
| str | image_path = "./", | ||
| int | frame = -1 ) |
Write normalized camera image to file and return output filename.
| camera | Camera label |
| bands | List of band labels to include in the image |
| imagefile_base | Base filename for output |
| image_path | Output directory path (default: current directory) |
| frame | Frame number to write (-1 for all frames) |
| RadiationModelError | If normalized camera image writing fails |
| TypeError | If parameters have incorrect types |
Definition at line 2634 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.writeNormDepthImage | ( | self, | |
| str | camera_label, | ||
| str | imagefile_base, | ||
| float | max_depth, | ||
| str | image_path = "./", | ||
| int | frame = -1 ) |
Write normalized depth image as grayscale JPEG.
Depth values are normalized to the range [0, max_depth] for visualization.
| camera_label | Camera label |
| imagefile_base | Base filename for output |
| max_depth | Maximum depth value for normalization (e.g., sky depth) |
| image_path | Output directory path (default: current directory) |
| frame | Frame number to append to filename (-1 to omit) |
| RadiationModelError | If writing fails |
| TypeError | If parameters have incorrect types |
| ValueError | If max_depth is not positive |
Definition at line 3275 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.writeObjectDataLabelMap | ( | self, | |
| str | camera, | ||
| str | object_data_label, | ||
| str | imagefile_base, | ||
| str | image_path = "./", | ||
| int | frame = -1, | ||
| float | padvalue = float('nan') ) |
Write a per-pixel object-data label map for a camera to a text file.
Identical to :meth:`writePrimitiveDataLabelMap` but maps the value of an object-data
label (compound-object data) rather than primitive data. The object data must be of
type float, double, uint, or int. The radiation model must have been run
(``updateGeometry`` + ``runBand``) so that per-pixel labels exist.
Output ``{camera}_{imagefile_base}.txt`` when ``frame < 0`` (default), or
``{camera}_{imagefile_base}_{frame:05d}.txt`` when ``frame >= 0``.
| camera | Camera label |
| object_data_label | Object data label to map (float/double/uint/int) |
| imagefile_base | Base filename for output |
| image_path | Output directory path (default: current directory) |
| frame | Frame number to write (-1 to omit the frame suffix) |
| padvalue | Value written for empty/background pixels (default: NaN) |
| RadiationModelError | If the label map writing fails |
| TypeError | If parameters have incorrect types |
Definition at line 2776 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.writePrimitiveDataLabelMap | ( | self, | |
| str | camera, | ||
| str | primitive_data_label, | ||
| str | imagefile_base, | ||
| str | image_path = "./", | ||
| int | frame = -1, | ||
| float | padvalue = float('nan') ) |
Write a per-pixel primitive-data label map for a camera to a text file.
For each camera pixel, writes the value of ``primitive_data_label`` on the primitive
seen at that pixel. Pixels that hit no geometry (or a primitive lacking the data) are
written as ``padvalue`` (NaN by default). The primitive data must be of type
float, double, uint, or int. The radiation model must have been run
(``updateGeometry`` + ``runBand``) so that per-pixel primitive labels exist.
The output file is written row-by-row (one line per image row), so it loads directly
into a 2D ``(height, width)`` array. See :meth:`getPrimitiveDataLabelMap` for a
convenience that returns a NumPy array instead of a file on disk.
Output ``{camera}_{imagefile_base}.txt`` when ``frame < 0`` (default), or
``{camera}_{imagefile_base}_{frame:05d}.txt`` when ``frame >= 0``.
| camera | Camera label |
| primitive_data_label | Primitive data label to map (float/double/uint/int) |
| imagefile_base | Base filename for output |
| image_path | Output directory path (default: current directory) |
| frame | Frame number to write (-1 to omit the frame suffix) |
| padvalue | Value written for empty/background pixels (default: NaN) |
| RadiationModelError | If the label map writing fails |
| TypeError | If parameters have incorrect types |
Definition at line 2729 of file RadiationModel.py.
|
protected |
Definition at line 505 of file RadiationModel.py.
|
protected |
Definition at line 457 of file RadiationModel.py.
|
protected |
Definition at line 453 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.context = context |
Definition at line 446 of file RadiationModel.py.
| pyhelios.RadiationModel.RadiationModel.radiation_model = None |
Definition at line 447 of file RadiationModel.py.