-
Notifications
You must be signed in to change notification settings - Fork 77
The Sun
Ned Ekins-Daukes edited this page Mar 22, 2022
·
1 revision
Solcore has the standard ASTM solar spectra built in. We can easily plot these with a short snippet of code:
`import numpy as np import matplotlib.pyplot as plt from solcore.light_source import LightSource
wl = np.linspace(300, 4000, 4000) * 1e-9 #wl contains the x-ordinate in wavelength am15g = LightSource(source_type='standard', x=wl, version='AM1.5g')
plt.figure(1) plt.plot(*am15g.spectrum(), label='AM1.5G') #Question: .spectrum() returns a tuple, what does the * do? plt.xlim(300, 3000) plt.xlabel('Wavelength (nm)') plt.ylabel('Power density (Wm$^{-2}$nm$^{-1}$)') #plt.tight_layout() plt.legend() plt.show()`
The resulting chart is below: