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

Fix empty hist #399

Merged
merged 4 commits into from
May 8, 2024
Merged

Fix empty hist #399

merged 4 commits into from
May 8, 2024

Conversation

ewu63
Copy link
Collaborator

@ewu63 ewu63 commented May 7, 2024

Purpose

If the initial evaluation fails for SNOPT, exit 61 is returned. However, this results in an empty history file with major=True, which errors out:

  File ".../pyoptsparse/pyOpt_history.py", line 654, in getValues
    data[name] = np.stack(data[name], axis=0)
  File ".../numpy/core/shape_base.py", line 445, in stack
    raise ValueError('need at least one array to stack')

This PR fixes this issue.

Expected time until merged

2 days

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@ewu63 ewu63 requested a review from a team as a code owner May 7, 2024 21:13
@ewu63
Copy link
Collaborator Author

ewu63 commented May 7, 2024

Also would appreciate a patch version bump (preferably in this PR)

Copy link

codecov bot commented May 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.15%. Comparing base (0fd3dd7) to head (a09162c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #399      +/-   ##
==========================================
+ Coverage   74.10%   74.15%   +0.05%     
==========================================
  Files          22       22              
  Lines        3294     3297       +3     
==========================================
+ Hits         2441     2445       +4     
+ Misses        853      852       -1     

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

@ewu63 ewu63 requested a review from sseraj May 8, 2024 19:45
Copy link
Contributor

@marcomangano marcomangano left a comment

Choose a reason for hiding this comment

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

LGTM. Can you confirm you added __all__ for linting purposes?

@ewu63
Copy link
Collaborator Author

ewu63 commented May 8, 2024

LGTM. Can you confirm you added __all__ for linting purposes?

Yep, I believe that's a PEP8 requirement (to avoid "unused imports").

@ewu63 ewu63 merged commit 4ed7ce9 into main May 8, 2024
12 checks passed
@ewu63 ewu63 deleted the fix-empty-hist branch May 8, 2024 22:54
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.

3 participants