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

Extend Step String Tagging Functionality #4178

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

mleot
Copy link
Contributor

@mleot mleot commented Jun 14, 2024

Description

Adds additional funcitonality around step string tags. Allows for filtering a solution object based on tags. Allows for inclusion of tags when exporting data through the Solution.get_data_dict() method.

Fixes #4177

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ pre-commit run (or $ nox -s pre-commit) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)
  • All tests pass: $ python run-tests.py --all (or $ nox -s tests)
  • The documentation builds: $ python run-tests.py --doctest (or $ nox -s doctests)

You can run integration tests, unit tests, and doctests together at once, using $ python run-tests.py --quick (or $ nox -s quick).

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

Copy link

codecov bot commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Project coverage is 99.54%. Comparing base (205ca81) to head (35e72a9).
Report is 3 commits behind head on develop.

Current head 35e72a9 differs from pull request most recent head 7916a2b

Please upload reports for the commit 7916a2b to get more accurate results.

Files Patch % Lines
pybamm/solvers/solution.py 88.23% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4178      +/-   ##
===========================================
- Coverage    99.55%   99.54%   -0.01%     
===========================================
  Files          288      288              
  Lines        21857    21876      +19     
===========================================
+ Hits         21760    21777      +17     
- Misses          97       99       +2     

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

Copy link
Member

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

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

Implementation looks good to me, just a few comments about the tests

tests/unit/test_solvers/test_solution.py Outdated Show resolved Hide resolved
@mleot
Copy link
Contributor Author

mleot commented Jun 24, 2024

@valentinsulzer I added an additional feature, being the .step and .cycle attributes to the solution objects, which are assigned during the solve step of a simulation, when running 'with experiment'.

@mleot mleot marked this pull request as ready for review June 24, 2024 18:46
@mleot
Copy link
Contributor Author

mleot commented Jun 25, 2024

Are assert statements generally frowned upon in testing? I noticed that it raises issues in the static code analysis.

@agriyakhetarpal
Copy link
Member

Are assert statements generally frowned upon in testing? I noticed that it raises issues in the static code analysis.

They are usually frowned upon in regular code, but I think we need to make Codacy more lenient about this a bit, because these are all in tests/, where asserts are commonplace. Soon, the use of asserts will grow a lot in PyBaMM (see #4156). I am unsure who has access to the relevant settings and if we can configure it with a codacy.yml file of sorts.

@kratman
Copy link
Contributor

kratman commented Nov 4, 2024

@mleot are you still working on this?

@kratman kratman added the needs-reply Needs further information from the author and may be closed if no response is received label Nov 4, 2024
@github-actions github-actions bot removed the needs-reply Needs further information from the author and may be closed if no response is received label Nov 4, 2024
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.

Extend Step String Tagging Functionality
4 participants