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

Feature/bokeh mc bringup #835

Merged
merged 7 commits into from
Nov 7, 2024
Merged

Feature/bokeh mc bringup #835

merged 7 commits into from
Nov 7, 2024

Conversation

Natsoulas
Copy link
Contributor

@Natsoulas Natsoulas commented Oct 22, 2024

  • Tickets addressed: bsk-000
  • Review: By file
  • Merge strategy: Merge and Squash

Description

This branch introduces significant improvements to the Monte Carlo plotting capabilities in Basilisk, focusing on enhancing the AnalysisBaseClass.py file and related example scenarios. The key changes include:

  1. The MonteCarloPlotter class:

    • Improved data loading and management
    • Dynamic plot creation with support for multiple variables and components
    • Interactive plot updates based on user input
    • Efficient handling of large datasets through downsampling and streaming
  2. Bokeh Integration:

    • Added support for Bokeh, enabling interactive HTML-based visualizations
    • Implemented a Bokeh server option for real-time plot updates
    • Created a fallback to matplotlib when Bokeh is unavailable
  3. User Interface Improvements:

    • Added dropdown menus for variable and component selection
    • Implemented a search functionality to highlight specific run numbers
    • Created a status indicator to show plot loading/updating status
  4. Documentation and File Management:

    • Improved plot saving functionality, including HTML and RST file generation
    • Enhanced documentation generation for saved plots
  5. Example Scenario Updates:

    • Modified scenarioMonteCarloAttRW.py to showcase the new plotting capabilities
    • Added command-line options for data deletion and Bokeh server usage
    • Implemented a new scenarioRerunMonteCarlo.py for demonstrating how to rerun specific Monte Carlo simulations
    • Removed "This is a hack..." line from the repo and added objects directly to 'sim' parent object to remain in scope for MC runs
  6. Testing and Compatibility:

    • Updated test_bskMcTestScript.py to accommodate the new features
    • Ensured backward compatibility with existing Monte Carlo simulations

These changes significantly improve the visualization and analysis capabilities for Monte Carlo simulations in Basilisk, providing users with more interactive and informative tools to explore simulation results.

Verification

The changes were validated through the following methods:

  1. Manual Testing:

    • Extensive testing of the new MonteCarloPlotter class functionality
    • Verification of Bokeh integration and fallback to matplotlib
    • Testing of user interface improvements, including dropdown menus and run number search functionality
  2. Automated Tests:

    • Updated test_bskMcTestScript.py to cover new features and ensure backward compatibility
    • Added new unit tests for the MonteCarloPlotter class to verify data loading, plot creation, and interactive updates
  3. Example Scenario Testing:

    • Ran and verified the modified scenarioMonteCarloAttRW.py to showcase new plotting capabilities
    • Tested the new scenarioRerunMonteCarlo.py to ensure proper functionality for rerunning specific Monte Carlo simulations
  4. Performance Testing:

    • Conducted manual performance tests with large datasets up to 1 GB in size to verify efficient data handling and display
  5. Documentation Review:

    • Verified that the updated documentation accurately reflects the new features and usage instructions in sphinx documentation

No tests were removed or re-baselined. The addition and update of tests were necessary to cover the new functionality and ensure the reliability of the Monte Carlo plotting capabilities.

Documentation

The following documentation has been affected by these changes and should be reviewed for accuracy and completeness:

  1. Docstrings in modified files:

    • scenarioVisualizeMonteCarlo.py: Revised docstrings to reflect new command-line options and usage of updated plotting capabilities (bokeh) and this along with the other files was renamed from scenarioAnalyzeMonteCarlo.py
    • scenarioMonteCarloAttRW.py: Revised docstrings to reflect new command-line options and usage of updated plotting capabilities
    • scenarioRerunMonteCarlo.py: New file with comprehensive docstrings explaining the purpose and usage of rerunning specific Monte Carlo simulations
  2. optional-requirements.txt:

    • Added Bokeh and Dask to the list of optional requirements
    • Reviewers should verify these optional packages are sufficient for the new plotting capabilities introduced in this branch/pr.

Reviewers should pay particular attention to:

  • Accuracy and completeness of docstrings in the modified files
  • Clarity of explanations for new features and methods
  • Consistency between code behavior and documented functionality
  • General difficulties for the target user (researchers interacting with plots and making the plots from MC's)

Additionally, reviewers should ensure that the addition of Bokeh and Dask to the optional requirements is properly documented in any relevant README files or user guides.

Future work

  1. Further optimization of performance for large datasets:

    • Investigate and implement data compression techniques to improve handling of very large Monte Carlo datasets
    • Explore more efficient data streaming methods for real-time plot updates
  2. Refinement of Bokeh plotting tools:

    • Gather user feedback on the new Monte Carlo plotting capabilities
    • Based on feedback, potentially simplify or customize Bokeh plotting tools specifically for Monte Carlo simulations
    • Consider adding more advanced interactive features or visualization types if requested by users/devs/researchers
  3. Expansion of rerun capabilities:

    • Enhance the scenarioRerunMonteCarlo.py to support more complex rerun scenarios
    • Implement a user-friendly interface for selecting specific Monte Carlo runs to rerun
  4. Integration with other Basilisk modules:

    • Explore opportunities to integrate the improved Monte Carlo plotting capabilities with any other relevant Basilisk analysis and visualization tools
  5. Documentation and tutorials???:

    • Develop more comprehensive tutorials and examples showcasing the new Monte Carlo plotting features
    • Perhaps create a video tutorial to help users quickly adopt and leverage the new capabilities

Note: These future work items are based on anticipated needs and potential improvements. Priorities may be adjusted based on actual user feedback and project requirements.

@Natsoulas Natsoulas self-assigned this Oct 22, 2024
@Natsoulas Natsoulas requested a review from a team as a code owner October 22, 2024 07:12
@Natsoulas Natsoulas force-pushed the feature/bokeh-mc-bringup branch 3 times, most recently from 4db9f2b to c8aa8b2 Compare October 22, 2024 07:36
@Natsoulas Natsoulas added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 22, 2024
@Natsoulas Natsoulas force-pushed the feature/bokeh-mc-bringup branch 3 times, most recently from c9e9a85 to 0dab0f3 Compare October 22, 2024 18:56
@Natsoulas Natsoulas force-pushed the feature/bokeh-mc-bringup branch 7 times, most recently from 7747f4d to f11f61e Compare November 5, 2024 02:59
@Natsoulas Natsoulas force-pushed the feature/bokeh-mc-bringup branch from 8c90e95 to d74495b Compare November 5, 2024 05:44
Copy link
Contributor

@schaubh schaubh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great changes. This branch is now much easier to review and check. Good job. Just some small edits to make and then we are good to go!

examples/MonteCarloExamples/scenarioRerunMonteCarlo.py Outdated Show resolved Hide resolved
examples/scenarioMonteCarloAttRW.py Outdated Show resolved Hide resolved
examples/scenarioMonteCarloSpice.py Outdated Show resolved Hide resolved
src/tests/test_bskMcTestScript.py Outdated Show resolved Hide resolved
src/tests/test_bskMcTestScript.py Show resolved Hide resolved
src/tests/test_scenarioMonteCarloAttRW.py Outdated Show resolved Hide resolved
src/tests/test_scenarioMonteCarloSpice.py Outdated Show resolved Hide resolved
docs/source/Support/bskReleaseNotes.rst Outdated Show resolved Hide resolved
docs/source/Support/bskReleaseNotes.rst Show resolved Hide resolved
@Natsoulas Natsoulas force-pushed the feature/bokeh-mc-bringup branch from d74495b to 0e33f5f Compare November 6, 2024 20:43
@Natsoulas Natsoulas requested a review from schaubh November 6, 2024 20:43
@Natsoulas Natsoulas force-pushed the feature/bokeh-mc-bringup branch 2 times, most recently from 39bedf1 to 95a7224 Compare November 7, 2024 00:54
Copy link
Contributor

@schaubh schaubh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go.

examples/scenarioMonteCarloAttRW.py Outdated Show resolved Hide resolved
examples/scenarioMonteCarloAttRW.py Outdated Show resolved Hide resolved
@Natsoulas Natsoulas force-pushed the feature/bokeh-mc-bringup branch from 95a7224 to 88157a1 Compare November 7, 2024 01:14
@schaubh schaubh merged commit 5dd2708 into develop Nov 7, 2024
9 checks passed
@schaubh schaubh deleted the feature/bokeh-mc-bringup branch November 7, 2024 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants