danieljfarrell / pvtrace

Optical ray tracing for luminescent materials and spectral converter photovoltaic devices
Other
97 stars 94 forks source link

np.log is ln(), should be log() (i.e. np.log10) #5

Closed dcambie closed 8 years ago

dcambie commented 8 years ago

In "sampled pathlength" (Materials.py) the random path length is calculated as: -np.log(1 - np.random.uniform())/self.absorption(photon)

while I believe it should be -np.log10(1 - np.random.uniform())/self.absorption(photon)

danieljfarrell commented 8 years ago

This depends entirely on the definition of absorption coefficient. pvtrace uses the base-e definition which was the convention in my lab (physicist) and all of the example data that's comes with it also. That is,

I = Io * exp(-alpha * t)

You can multiply base-10 data by 1/log10(e) ~ 2.303 to convert it.

dcambie commented 8 years ago

I understand, so my error was feeding experimental spectra with: I = I0 * 10^(-alpha * t)

Thanks for the fast reply! ;)

danieljfarrell commented 8 years ago

Yes exactly, use the base-e definition. Or alternatively add an import function to pvtrace that expects base-10 files.