PR for issue BSK-1164: Monte Carlo dispersions application #1165
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Description
The setting of attributes is changed from using the simple setattr() command to using a function that loops through the elements of a chained attribute and correctly applies the dispersion. Additionally, a function is added to correctly retrieve the attributes (instead of using getattr()). Finally, a simParams input called recordSimParams (default value set to False) is added. If set to True, a JSON file can be created with the values of the attributes after the dispersion application, to verify that they have been applied. See the corresponding issue for more details.
Some additional details on the commits and the added functions (in the order that they appear in the code files):
Commit 1: Controller.py
Commit 2: scenarioBskSimAttFeedbackMC.py
Commit 2: test_bskMcTestScript.py
Verification
A test function has been added to the test_bskMcTestScript.py file. The output of the simParams JSON file for run 0 of scenarioBskSimAttFeedbackMC is compared with the identical format JSON file using the recordSimParams functionality to record the dispersed attributes. As mentioned also in the issue: please note that this scenario does not currently pass this test, since even with the proposed solution some attributes are still not being dispersed. I have not been able to find the reason why this is happening, but I assume it is due to the way in which the modules are being used in this specific scenario, since the scenarios I have made for my project all pass the test.
Documentation
The documentation on the examples of Monte Carlo scenarios must be updated. The plots are incorrect since they show un-dispersed values (see also the information in the issues ticket).