-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add simple_efficiency tests for numpy array inputs #2661
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
base: main
Are you sure you want to change the base?
Add simple_efficiency tests for numpy array inputs #2661
Conversation
|
the CI failures are due to deprecation-enforcement tests in |
|
@aman-coder03 this is the scope of #2658 Could you complete #2646 first? It needs a whatsnew note. |
|
@cwhanse shall I create in Bug Fixes |
|
It should be v0.14.1.rst. Thanks! |
|
@cwhanse i have completed that, you can have a look!! |
dd816c0 to
7abb5e7
Compare
tests/test_transformer.py
Outdated
| ) | ||
|
|
||
|
|
||
| def test_simple_efficiency_numpy_array_inputs(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aman-coder03 I think it is premature to test with all inputs as np.array. In other discussions we don't have consensus to allow the parameters no_load_loss and load_loss to be anything other than float, and intend to edit the docstring accordingly.
If we agree in the future to allow vectors for these parameters, then this test would be needed.
I don't want to include it now so to prevent someone's AI from deciding we have missed a combination of types in other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you prefer that I remove the test that uses array inputs for no_load_loss and load_loss, and keep only the vectorized input_power case? Or should I drop the vectorized tests entirely for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think drop test_simple_efficiency_numpy_array_inputs and keep test_simple_efficiency_vector_equals_scalar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implemented the suggested changes @cwhanse , thanks for your guidance!!
|
Looks OK now. Please add a brief note in the Testing section of this file: https://github.com/pvlib/pvlib-python/blob/main/docs/sphinx/source/whatsnew/v0.15.1.rst |
|
added whatsnew entry in the testing section, please have a look. |
|
I suggest to merge the tests into one, most functions are type-tested in the same test for any numeric implementation, and it can be shortened with the |
echedey-ls
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to merge the tests into one, most functions are type-tested in the same test for any numeric implementation, and it can be shortened with the
@pytest.mark.parametrize.
@aman-coder03 , for my previous comment, I suggest you give it a try doing it without AI, it's not difficult to understand, you have an example in the same file, documentation is public and easily accessible, and we prefer contributors to know what they are doing rather going back and forth to an LLM model.
|
|
||
| * Add test to verify that :py:func:`~pvlib.transformer.simple_efficiency` | ||
| produces consistent results for vectorized and scalar inputs. | ||
| (:pull:`2661`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (:pull:`2661`) | |
| (:issue:`2649`, :pull:`2661`) |
|
I refactored the numeric tests into a single parametrized test following the pattern used elsewhere in the file. I reviewed the |
this PR adds test coverage for vectorized use of
pvlib.transformer.simple_efficiencywithnumpy.ndarrayinputs.the tests verify:
input_power,load_loss,and
no_load_lossNo functional changes are introduced.
fixes #2649