Skip to content

Commit ddc70c5

Browse files
committed
Update irradiance.py
"spectrum" variable --> "spectra" (see pvlib#2150)
1 parent 112747e commit ddc70c5

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pvlib/spectrum/irradiance.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,14 @@ def get_reference_spectra(wavelengths=None, standard="ASTM G173-03"):
180180
return standard
181181

182182

183-
def average_photon_energy(spectrum):
183+
def average_photon_energy(spectra):
184184
r"""
185185
Calculate the average photon energy of one or more spectral irradiance
186186
distributions.
187187
188188
Parameters
189189
----------
190-
spectrum : pandas.Series or pandas.DataFrame
190+
spectra : pandas.Series or pandas.DataFrame
191191
192192
Spectral irradiance, must be positive. [Wm⁻²nm⁻¹]
193193
@@ -236,7 +236,7 @@ def average_photon_energy(spectrum):
236236
wavelength, :math:`G(\lambda)` is the spectral irradiance, :math:`q` is the
237237
elementary charge used here so that the average photon energy,
238238
:math:`\overline{E_\gamma}`, is expressed in electronvolts (eV). The
239-
integrals are computed over the full wavelength range of the ``spectrum``
239+
integrals are computed over the full wavelength range of the ``spectra``
240240
parameter.
241241
242242
References
@@ -246,24 +246,24 @@ def average_photon_energy(spectrum):
246246
Photovoltaic in Europe Conference (pp. 1756-1759).
247247
"""
248248

249-
if not isinstance(spectrum, (pd.Series, pd.DataFrame)):
250-
raise TypeError('`spectrum` must be either a'
249+
if not isinstance(spectra, (pd.Series, pd.DataFrame)):
250+
raise TypeError('`spectra` must be either a'
251251
' pandas Series or DataFrame')
252252

253-
if (spectrum < 0).any().any():
253+
if (spectra < 0).any().any():
254254
raise ValueError('Spectral irradiance data must be positive')
255255

256-
hclambda = pd.Series((constants.h*constants.c)/(spectrum.T.index*1e-9))
257-
hclambda.index = spectrum.T.index
258-
pfd = spectrum.div(hclambda)
256+
hclambda = pd.Series((constants.h*constants.c)/(spectra.T.index*1e-9))
257+
hclambda.index = spectra.T.index
258+
pfd = spectra.div(hclambda)
259259

260260
def integrate(e):
261261
return trapezoid(e, x=e.T.index, axis=-1)
262262

263-
int_spectrum = integrate(spectrum)
263+
int_spectra = integrate(spectra)
264264
int_pfd = integrate(pfd)
265265

266266
with np.errstate(invalid='ignore'):
267-
ape = (1/constants.elementary_charge)*int_spectrum/int_pfd
267+
ape = (1/constants.elementary_charge)*int_spectra/int_pfd
268268

269269
return ape

0 commit comments

Comments
 (0)