Skip to content

Commit 61ea9a9

Browse files
committed
Update average_photon_energy.py
1 parent fdc7532 commit 61ea9a9

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

docs/examples/spectrum/average_photon_energy.py

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,51 @@
161161
ape = spectrum.average_photon_energy(spectra)
162162

163163
# %%
164-
# XX table? add values / arrow(s) to graph XX
165-
# XX add AM1.5 graph/ape value
166-
# plot hourly ape with AM1.5 APE constant line?
164+
# We can update the normalised spectral irradiance plot to include each
165+
# spectrum's irradiance distribution APE value in the legend. Note that the
166+
# units of the average photon energy here are electronvolts (eV).
167+
168+
plt.figure()
169+
plt.plot(wavelength, poa_global_normalised)
170+
plt.xlim(200, 2700)
171+
plt.ylim(0, 0.0018)
172+
plt.ylabel(r"Normalised Irradiance (nm⁻¹)")
173+
plt.xlabel(r"Wavelength (nm)")
174+
time_labels = times.strftime("%H:%M")
175+
labels = [
176+
"{}, APE {:0.02f}".format(*vals)
177+
for vals in zip(time_labels, ape)
178+
]
179+
plt.legend(labels)
180+
plt.show()
181+
182+
# %%
183+
# The table below summarises the hourly APE values observed throughout the day.
184+
# .. list-table:: Hourly APE values
185+
# :widths: 25 25
186+
# :header-rows: 1
187+
#
188+
# * - Time
189+
# - APE (eV)
190+
# * - 08:00
191+
# - 1.25
192+
# * - 09:00
193+
# - 1.37
194+
# * - 10:00
195+
# - 1.40
196+
# * - 11:00
197+
# - 1.41
198+
# * - 12:00
199+
# - 1.42
200+
# * - 13:00
201+
# - 1.41
202+
# * - 14:00
203+
# - 1.40
204+
# * - 15:00
205+
# - 1.38
206+
# * - 16:00
207+
# - 1.28
208+
167209
# %%
168210
# References
169211
# ----------

0 commit comments

Comments
 (0)