Skip to content

Radiation model:writeCameraImage function error #4

@L129921

Description

@L129921

Error log:

Radiation model initialized with OptiX 8.1 backend.
Updating geometry in radiation transport model...done.
Camera processing failed: Helios error 7: ERROR (RadiationModel::writeCameraImage): invalid map<K, T> key
Exception ignored in: <function Context.__del__ at 0x00000228952C16C0>
Traceback (most recent call last):
  File "G:\test\PyHelios-0.1.16\PyHelios-0.1.17\pyhelios\Context.py", line 294, in __del__
TypeError: 'NoneType' object is not callable

Environment

  • pyhelios: 0.1.17
  • helios: 1.3.68

The origin simulation code is from the section complete camara pipeline example of plugin_radiation.md:

from pyhelios import Context, WeberPennTree, WPTType, RadiationModel
from pyhelios.types import *

# Create scene with labeled geometry
context = Context()

# Add ground with labels
ground = context.addPatch(center=vec3(0, 0, 0), size=vec2(10, 10))

# Run radiation simulation with cameras
try:
    with RadiationModel(context) as radiation:
        # Set up radiation bands
        radiation.addRadiationBand("Red")
        radiation.addRadiationBand("Green")
        radiation.addRadiationBand("Blue")
        radiation.addRadiationBand("NIR")

        # Add sun source
        sun_id = radiation.addSunSphereRadiationSource(
            radius=0.5, zenith=45.0, azimuth=180.0)

        # Configure realistic solar spectrum
        radiation.setSourceFlux(sun_id, "Red", 250.0)
        radiation.setSourceFlux(sun_id, "Green", 350.0)
        radiation.setSourceFlux(sun_id, "Blue", 200.0)
        radiation.setSourceFlux(sun_id, "NIR", 400.0)

        # Run simulation
        radiation.updateGeometry()
        radiation.addRadiationCamera(
            "overhead_rgb",
            ["Red", "Green", "Blue"],
            position=vec3(0, 3, 10),
            lookat_or_direction=vec3(0, 0, 0)
        )

        # radiation.setCameraSpectralResponseFromLibrary("overhead_rgb","iPhone13")
        rgb_filename = radiation.writeCameraImage(
            camera="overhead_rgb",
            bands=["Red", "Green", "Blue"],
            imagefile_base="apple_tree_rgb",
            frame=1
        )

except Exception as e:
    print(f"Camera processing failed: {e}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions