Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Custom volume emitters" example broken #429

Closed
MaxHerbs opened this issue Jan 26, 2024 · 2 comments
Closed

"Custom volume emitters" example broken #429

MaxHerbs opened this issue Jan 26, 2024 · 2 comments

Comments

@MaxHerbs
Copy link

Hello
Currently it seems the "Custom Volume Emitter" sample does not work. Is there an alternative way to define custom light sources?

I'm using
Raysect Version: raysect-0.8.1.post1

and the code fails with the following output:

Rendering pass 1...
Traceback (most recent call last):
File "Untitled-1.py", line 50, in
camera.observe()
File "raysect/optical/observer/base/observer.pyx", line 265, in raysect.optical.observer.base.observer._ObserverBase.observe
File "raysect/optical/observer/base/observer.pyx", line 301, in raysect.optical.observer.base.observer._ObserverBase.observe
File "/home/max/.local/lib/python3.8/site-packages/raysect/core/workflow.py", line 239, in run
raise results
AttributeError: attribute 'samples' of 'raysect.optical.spectrum.Spectrum' objects is not writable

A copy of the code is available from the raysect repository, and the error occurs with no changes made to the example.
Thank you

@vsnever
Copy link
Contributor

vsnever commented Jan 26, 2024

Hi @MaxHerbs, the issue is fixed already in the development branch. Just replace line 23 of the demo:

        spectrum.samples += cos((shift + 5) * radius)**4

with

        spectrum.samples[:] += cos((shift + 5) * radius)**4

@MaxHerbs
Copy link
Author

Hi @vsnever,
Thank you for the quick response, that's perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants