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

PySMO: fix warnings #1472

Merged
merged 25 commits into from
Aug 23, 2024
Merged

PySMO: fix warnings #1472

merged 25 commits into from
Aug 23, 2024

Conversation

OOAmusat
Copy link
Contributor

@OOAmusat OOAmusat commented Aug 17, 2024

Fixes

#1403, #1363

Summary/Motivation:

Recent changes to the numpy backend have resulted in a large number of deprecation warnings (>7500) being raised in PySMO. This PR makes changes to address these warnings.

Changes proposed in this PR:

  • Fix all numpy deprecation warnings, primarily arising from assigning scalar values to arrays, e.g., y[i, 0] = x. This is resolved in this PR by either extracting the specific elements of the scalar (y[i, 0] = x[0]) or using the item method (y[i, 0] = x.item())
  • Replacing warnings.warn with the idaes logger warnings, and fix tests to use caplog to reflect this change
  • Adding @pytest.mark.filterwarnings to specific tests to ignore runtime warnings around np.log

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@OOAmusat OOAmusat marked this pull request as draft August 17, 2024 02:39
@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2024

Codecov Report

Attention: Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.

Project coverage is 76.36%. Comparing base (575953b) to head (8577f4e).
Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
...daes/core/surrogate/pysmo/polynomial_regression.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1472      +/-   ##
==========================================
- Coverage   76.36%   76.36%   -0.01%     
==========================================
  Files         394      394              
  Lines       65130    65136       +6     
  Branches    14429    14429              
==========================================
+ Hits        49737    49740       +3     
- Misses      12831    12835       +4     
+ Partials     2562     2561       -1     

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


🚨 Try these New Features:

@OOAmusat OOAmusat removed the request for review from rundxdi August 19, 2024 16:52
@OOAmusat OOAmusat marked this pull request as ready for review August 19, 2024 19:20
Copy link
Contributor

@lbianchi-lbl lbianchi-lbl left a comment

Choose a reason for hiding this comment

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

Thanks a lot @OOAmusat. From a quick look through the pytest job output log, I believe this resolves all of the unanticipated warnings from the PySMO submodules (i.e., I wasn't able to spot any).

The only one that looks like it might be related is the following:

image

However, if you feel this belongs outside of PySMO's "jurisdiction", then feel free to disregard and we can address it at a later time.

@ksbeattie ksbeattie added the Priority:Normal Normal Priority Issue or PR label Aug 22, 2024
Copy link
Member

@andrewlee94 andrewlee94 left a comment

Choose a reason for hiding this comment

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

This looks good to me. My only questions is just to confirm that the warnings about invalid values in logs is not a sign of underlying issues.

@ksbeattie ksbeattie enabled auto-merge (squash) August 22, 2024 23:41
@lbianchi-lbl lbianchi-lbl merged commit 1fb938f into IDAES:main Aug 23, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:Normal Normal Priority Issue or PR warnings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants