Open mattngc opened 8 years ago
The optical rays are not set up to accumulate additional data (beyond spectra), that would be considered a specialist application and require a custom ray and materials. You could create a class derived from optical.Ray() and add a new attribute "log" which is a dictionary into which your custom materials can add/manipulate content in. That should achieve what you want. You'll need to ensure the log is passed to any daughter rays by overriding spawn_daughter().
For a number of physics use cases, volume emission dominates over surface reflection effects and other possible light sources (i.e. a tokamak plasma). The emission model of a volume emitter can be very complicated, and interpreting the spectral output can sometimes be very difficult. A couple of times I have wanted to sample the properties of the emitting material during ray-tracing for latter analysis. In the case of a plasma for example, I wanted to log the temperature, density and magnitude of magnetic field at every ray evaluation point. This helps to understand the output spectra.
At the moment I have "hacked" this kind of functionality by putting an ndarray on the emitting material, and every time it is called by ray to evaluate its emitted spectra, I log the coordinates and local parameter values. Is there a cleaner way to do this?