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/fix 1d line multi #480

Open
wants to merge 55 commits into
base: main
Choose a base branch
from
Open

Feature/fix 1d line multi #480

wants to merge 55 commits into from

Conversation

blooop
Copy link
Owner

@blooop blooop commented Jan 20, 2025

Summary by Sourcery

Add support for multiple ResultVars in a single ParametrizedSweep and update plotting to handle them correctly.

New Features:

  • Support multiple ResultVars in a single ParametrizedSweep.

Tests:

  • Update tests to reflect changes in example benchmarks.

Copy link
Contributor

sourcery-ai bot commented Jan 20, 2025

Reviewer's Guide by Sourcery

This pull request refactors the 1D line plotting to support multiple result variables and adds a new example to demonstrate this functionality. The changes also include a fix to how the dataset is filtered before plotting.

Sequence diagram for updated curve plotting process

sequenceDiagram
    participant C as Client
    participant H as HoloviewResult
    participant D as Dataset

    C->>H: to_curve_ds(dataset, result_var)
    H->>D: get data_vars
    loop For each variable
        alt Not a _std variable
            H->>H: Create Curve for var
            alt Has matching _std variable
                H->>H: Create Spread for var
            end
        end
    end
    H-->>C: Return Overlay with curves and spreads
Loading

Class diagram showing changes to Example1D and new example classes

classDiagram
    class Example1D {
        +index: IntSweep
        +output: ResultVar
        +output2: ResultVar
        +__call__(**kwargs)
    }
    note for Example1D "Added output2 ResultVar"

    class DataSource {
        -data: List
        +call(index, repeat)
    }
    Example1D ..> DataSource : uses
Loading

File-Level Changes

Change Details Files
Refactor 1D line plots to support multiple result variables and their standard deviations.
  • Modified the to_curve_ds function to iterate through all data variables in the dataset.
  • The function now plots a curve for each variable and its corresponding standard deviation (if available).
  • The function now uses an Overlay to plot multiple curves on the same plot.
bencher/results/holoview_result.py
Added a new example demonstrating multiple outputs from a 1D sweep.
  • Created a new example example_1_in_2_out that has two output variables.
  • Moved the old example to example_1_in_1_out.
  • Updated the example to plot both output variables.
bencher/example/inputs_1D/example_1_in_2_out.py
bencher/example/inputs_1D/example_1_in_1_out.py
Updated tests to use the new example.
  • Updated the tests to use the new example_1_in_1_out example.
test/test_bench_examples.py
Fixed a bug in how the dataset is filtered before plotting.
  • The to_dataset function now correctly filters the dataset when a result variable is specified.
  • The result variable is now converted to a dataset before being returned.
bencher/results/bench_result_base.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @blooop - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

codecov bot commented Jan 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.07%. Comparing base (9a451d5) to head (2500810).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #480      +/-   ##
==========================================
+ Coverage   89.97%   90.07%   +0.09%     
==========================================
  Files          65       66       +1     
  Lines        3483     3505      +22     
==========================================
+ Hits         3134     3157      +23     
+ Misses        349      348       -1     

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

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