Skip to content

Docs: Add anisotropic GMM example#162

Merged
henry2004y merged 2 commits into
mainfrom
docs-anisotropic-gmm-example
Nov 16, 2025
Merged

Docs: Add anisotropic GMM example#162
henry2004y merged 2 commits into
mainfrom
docs-anisotropic-gmm-example

Conversation

@henry2004y

Copy link
Copy Markdown
Owner

Adds an example of GMM fitting for anisotropic data to the AMReX documentation notebook.

This new section includes:

  • Generation of synthetic anisotropic data.
  • Fitting a GMM to the data.
  • Extracting and verifying the physical parameters.
  • Visualization of the results.

Adds an example of GMM fitting for anisotropic data to the AMReX documentation notebook.

This new section includes:
- Generation of synthetic anisotropic data.
- Fitting a GMM to the data.
- Extracting and verifying the physical parameters.
- Visualization of the results.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @henry2004y, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the AMReX documentation by introducing a practical example of applying Gaussian Mixture Models (GMM) to anisotropic data. The addition guides users through the entire process, from generating synthetic anisotropic datasets to fitting GMMs, extracting specific physical parameters like parallel and perpendicular temperatures, and visualizing the results. This new content aims to provide a clearer understanding and practical application of GMMs for complex, directionally dependent data distributions.

Highlights

  • Anisotropic GMM Example Added: A new section has been integrated into the AMReX documentation notebook, providing a comprehensive example of Gaussian Mixture Model (GMM) fitting for anisotropic data.
  • Synthetic Data Generation: The example includes the generation of synthetic anisotropic data, simulating distributions where properties vary across different directions, relevant for fields like plasma physics.
  • GMM Fitting and Parameter Extraction: It demonstrates the process of fitting a GMM to the generated anisotropic data and accurately extracting physical parameters, such as parallel and perpendicular temperatures.
  • Visualization of Results: The new section features clear visualizations of the anisotropic data, overlaid with GMM fit ellipses that represent the fitted components and their standard deviation contours.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov

codecov Bot commented Nov 16, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.31%. Comparing base (8e4373d) to head (ecdb77d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #162   +/-   ##
=======================================
  Coverage   68.31%   68.31%           
=======================================
  Files          25       25           
  Lines        4191     4191           
=======================================
  Hits         2863     2863           
  Misses       1328     1328           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds a helpful example for anisotropic GMM fitting to the documentation notebook. The new section is well-structured with a clear explanation, code for data generation and fitting, and visualization of the results.

My review includes a critical fix for a KeyError that would prevent the example code from running, and a suggestion to remove a redundant import for better code hygiene. After addressing these points, the example will be a great addition to the documentation.

Comment thread docs/amrex_data.ipynb Outdated
Comment on lines +787 to +789
" temp_par = round(params[\\\"temp_parallel\\\"], 5)\\n",
" temp_per = round(params[\\\"temp_perp\\\"], 5)\\n",
" print(f\\\"Component {i+1}: Center = {center}, Temp Parallel = {temp_par}, Temp Perp = {temp_per}\\\")"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The keys used to access the temperature parameters are incorrect. The get_gmm_parameters function returns dictionaries with keys "T_parallel" and "T_perpendicular" (note the capital 'T'). Using "temp_parallel" and "temp_perp" will cause a KeyError when the code is executed.

I've corrected the keys and also used more descriptive variable names for the extracted temperatures to improve clarity.

    temp_par_ext = round(params[\"T_parallel\"], 5)
    temp_per_ext = round(params[\"T_perpendicular\"], 5)
    print(f\"Component {i+1}: Center = {center}, Temp Parallel = {temp_par_ext}, Temp Perp = {temp_per_ext}\")

Comment thread docs/amrex_data.ipynb Outdated
Comment on lines +798 to +799
"from matplotlib.patches import Ellipse\\n",
"\\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Ellipse class is already imported in a previous cell of this notebook (at line 708). To avoid redundancy and keep the notebook clean, this import statement and the following blank line can be removed.

Adds an example of GMM fitting for anisotropic data to the AMReX documentation notebook.

This new section includes:
- Generation of synthetic anisotropic data.
- Fitting a GMM to the data.
- Extracting and verifying the physical parameters.
- Visualization of the results.
@henry2004y henry2004y merged commit 84255e7 into main Nov 16, 2025
3 checks passed
@henry2004y henry2004y deleted the docs-anisotropic-gmm-example branch November 16, 2025 16:53
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