Skip to content

Commit 5d6f7e6

Browse files
RDaxinikandersolar
andauthored
Apply suggestions from code review
Co-authored-by: Kevin Anderson <[email protected]>
1 parent 22744a8 commit 5d6f7e6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/examples/spectrum/average_photon_energy.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
# This example demonstrates how to use the
1212
# :py:func:`~pvlib.spectrum.average_photon_energy` function to calculate the
1313
# Average Photon Energy (APE, :math:`\overline{E_\gamma}`) of spectral
14-
# irradiance distributions simulated using :py:func:`~pvlib.spectrum.spectrl2`.
14+
# irradiance distributions. This example uses spectral irradiance simulated
15+
# using :py:func:`~pvlib.spectrum.spectrl2`, but the same method is
16+
# applicable to spectral irradiance from any source.
1517
# More information on the SPECTRL2 model can be found in [1]_.
1618
# The APE parameter is a useful indicator of the overall shape of the solar
1719
# spectrum [2]_. Higher (lower) APE values indicate a blue (red) shift in the
1820
# spectrum and is one of a variety of such characterisation methods that is
1921
# used in the PV performance literature [3]_.
2022
#
21-
# To demonstrate this functionality, first we need to simulate some spectra
23+
# To demonstrate this functionality, first we will simulate some spectra
2224
# using :py:func:`~pvlib.spectrum.spectrl2`. In this example, we will simulate
2325
# spectra following a similar method to that which is followed in the
2426
# `Modelling Spectral Irradiance
@@ -105,8 +107,7 @@
105107
poa_global = spectra_components['poa_global']
106108
wavelength = spectra_components['wavelength']
107109

108-
broadband_irradiance = np.array([trapezoid(poa_global[:, i], wavelength)
109-
for i in range(poa_global.shape[1])])
110+
broadband_irradiance = trapezoid(poa_global, wavelength, axis=0)
110111

111112
poa_global_normalised = poa_global / broadband_irradiance
112113

0 commit comments

Comments
 (0)