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

Merging in Spectral Reflctance Changes #43

Merged
merged 19 commits into from
Apr 29, 2023
Merged

Conversation

sammorrell
Copy link
Member

I am merging in the implementation of code for the spectral reflectance. This also includes a number of bug fixes that we found during simulations.

This code includes the modifications to the `Reflectance` model struct. It uses `Spectrum` objects to hold whatever kind of reflectance spectrum we require. This comes with its accompanying builder object. I have also implemented the code to load from parameters and into attributes.
The logic in the spectral interpolation let through photons that were above the maximum wavelength in the loaded spectrum. It should not do this. So, I have fixed this with an extract check before performing interpolation. I have also written a new unit test to check this behaviour in the reflectance class.
Also added documentation to all of the `Spectrum` test cases.
The reflectance spectra should be between 0.0 -> 1.0, so check that they are when we init the reflectance, else we should gracefully exit and warn the user.
This means that we can more efficiently handle special cases and explictly specify behaviour more easily. In particular, it allows us to offer a `Constant` variant, which is not bounded by wavelengths. This includes all the changes required to make it work in the model.
In the the `Reflector` attribute, the ratio between diffuse and specular reflection is not required if only using a single reflectance model. However, it will assert that it is defined if both are used.
This is so that we can create constants in the `Spectrum` object form the parameter file.
The interpolation was not working the way that I’d expected. I should now have written it in the correct way. Tests show that it is working.
After fixing the interpolation problems, I have added some tests that check that things work with more points. This should be a better test as to whether the interpolation is actually working.
Fixed the warnings that were currently in the codebase. Just cleans up compiling a little.
Also fixed a few more compiler warnings.
We can now keep track of the progress through the lights in a given simulation.
Added unit tests to improve test coverage of core library.
Attempted to apply a fix for a crash that happens when the azimuthal component of the spherical CDF would return a value that would not map on to a valid plane, returning a `None`. I have made it iterate this process until a valid plane is found.
The idea of specularity is more elegant, and already well defined in computer graphics. Having it this way around makes more sense.

Tests pass with this change applied.
- Description changed to `specularity`.
This is just to keep the intermediate steps and output in-line with the changes I've made today.
@sammorrell sammorrell merged commit ffe7c81 into develop Apr 29, 2023
@sammorrell sammorrell deleted the spectral-reflectance branch April 29, 2023 23:00
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

Successfully merging this pull request may close these issues.

1 participant