Skip to content

Add simple_efficiency tests for numpy array inputs#2661

Open
aman-coder03 wants to merge 2 commits intopvlib:mainfrom
aman-coder03:test-simple-efficiency-vectorized
Open

Add simple_efficiency tests for numpy array inputs#2661
aman-coder03 wants to merge 2 commits intopvlib:mainfrom
aman-coder03:test-simple-efficiency-vectorized

Conversation

@aman-coder03
Copy link
Contributor

this PR adds test coverage for vectorized use of pvlib.transformer.simple_efficiency with numpy.ndarray inputs.

the tests verify:

  • support for NumPy array inputs for input_power, load_loss,
    and no_load_loss
  • consistency between vectorized and scalar evaluations

No functional changes are introduced.

fixes #2649

@aman-coder03
Copy link
Contributor Author

the CI failures are due to deprecation-enforcement tests in tests/test_irradiance.py, unrelated to this PR.
this PR only modifies tests/test_transformer.py.
please let me know if you would like me to rebase

@cwhanse
Copy link
Member

cwhanse commented Jan 21, 2026

@aman-coder03 this is the scope of #2658

Could you complete #2646 first? It needs a whatsnew note.

@aman-coder03
Copy link
Contributor Author

@cwhanse shall I create pvlib-python\docs\sphinx\source\whatsnew\v0.13.2.rst ?
and then add

* Fix a division-by-zero condition in
  :py:func:`~pvlib.transformer.simple_efficiency` when ``load_loss = 0``.
  (:issue:`2645`)

in Bug Fixes

@cwhanse
Copy link
Member

cwhanse commented Jan 21, 2026

It should be v0.14.1.rst. Thanks!

@aman-coder03
Copy link
Contributor Author

@cwhanse i have completed that, you can have a look!!

@aman-coder03 aman-coder03 force-pushed the test-simple-efficiency-vectorized branch from dd816c0 to 7abb5e7 Compare February 4, 2026 09:43
@aman-coder03
Copy link
Contributor Author

@cwhanse as suggested by you in #2646 , i have implemented the additional tests in this separate PR to avoid scope creep in #2646. Let me know if you would like any adjustments.

)


def test_simple_efficiency_numpy_array_inputs():
Copy link
Member

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.

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.

Add simple_efficiency tests to cover numpy arrays and pandas Series

2 participants