A solar cell is a diode with a current source across it. Light generates Iph; whatever the load does not take flows through the diode and sets the voltage. Rearranging the diode equation for that leftover current gives the one line the script is built on:
VD = n·VT·ln((Iph − Iload)/IS + 1)
Two limits fall straight out. Draw no current and all of Iph goes through the diode, giving the open-circuit voltage — a logarithm, so it barely moves with light level. Draw all of it and the diode gets nothing, the voltage collapses to zero, and the short-circuit current is Iph — linear in light level. Neither limit delivers any power; the useful point is the knee between them.
The left panels are the script's view, against load current: voltage, then power. The right panels are the same data plotted the way a solar data sheet does it, against voltage. The fill factor is the area of the maximum-power rectangle divided by VOC·ISC — how close the cell gets to the rectangle it would fill if it were an ideal source.
i_load = np.linspace(1e-5,1e-3,200)
i_s = 1e-12
i_ph = 1e-3
V_T = 1.38e-23*300/1.6e-19
V_D = V_T*np.log((i_ph - i_load)/(i_s) + 1)
P_load = V_D*i_load
Source: ex/pv.py (against current) and ex/pv_v.py (against voltage) — the same equation, plotted two ways. Neither models series or shunt resistance, so the knee here is sharper than a real cell's.