Free as in Freedom: Create your repos!
Little script collection for the calculation of solar fuel device efficiency limits considering detailed-balance and catalysis.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Matthias May 3610822686 Updated Mirror URL, as TeaHub was renamed into Codeberg. 5 months ago
doc Updated extended example no 1 in the docs. 7 months ago
src Make it more convenient to change spectral resolution. 6 months ago
.gitignore Updated extended example no 1 in the docs. 7 months ago
LICENSE Added LICENSE and updated to EUPL. 7 months ago Updated Mirror URL, as TeaHub was renamed into Codeberg. 5 months ago
am15g.dat AM1.5G solar spectrum added. Courtesy of the etaOpt authors. 2 years ago Updated Mirror URL, as TeaHub was renamed into Codeberg. 5 months ago

README for YaSoFo - Yet Another SOlar Fuels Optimizer


  • Python 3.3 (or later) with SciPy, for installation instructions see SciPy.

How to run tests?

We assume that and am15g.dat are in the same directory and you have installed SciPy 3.x. Open a Python terminal, e.g. Ipython, in the directory where is located. Now type the following in your terminal:

import yasofo as yo

for a demo for a single junction with coarse parameters.Type


for a demo for a double junction with coarse parameters. The line


will give you a demo for a triple junction with coarse parameters, and finally


will calculate a quadruple junction with coarse parameters. The latter can take a long time. After some time - depending on the order of the multi-junction - a graph with the max. STF efficiency over \Delta G should appear.

Another - though not yet as powerful - option is to simply type in you terminal


This will show the help. You can then run a demo with

python3 -d

Where to obtain further solar spectra?

The standard file format used here is equivalent to the format distributed with etaOpt by Fraunhofer ISE. It can be downloaded from their website. See also Letay and Bett, Eur. Photovoltaic Sol. Energy Conf., Proc. Int. Conf., 17th, 2001, 178-181.

In the etaOpt archive file, you will find a folder ‘spectra’, containing AM0, AM1.5D, and AM1.5G spectra.

Another source for spectra is e.g. NREL. There, one can download the ASTM G-173-03 spectrum, the convenient .csv data format can be found in the provided .zip archive. But beware! The computation time scales approximately with n^x, where n are the datapoints in your spectrum and x is the order of the multi-junction.

The AM1.5G spectrum supplied with YaSoFo originates from etaOpt and is redistributed with friendly permission of the authors.

Water absorption

A nice overview of the optical properties of water with data and references can be found at the Oregon Medical Laser Center.

Some quick examples

a) Let us assume you want to find the best double junction bandgap parameters for water splitting (E0=1.23eV). Your absorbers are not the very best, so your open-circuit photovoltage is 500 mV lower than the bandgap/e, but you have very good catalysts, i.e. IrO2. Your solar spectrum is the unmodified AM 1.5G spectrum.

What would be the very best bandgap combination and what efficiency could you get out of it?

Start a python console, e.g. Ipython3 in the directory where you have and your solar spectrum.

import yasofo as yo
yo.find_max_double(E0=1.23, voltage_loss=0.5, only_print_results=True, db=False)

You should see a text stating max. efficiency and bandgap combination.

b) If you want to see the various bandgap combinations with their resulting performance:

yo.best_gaps_double(E0=1.23, voltage_loss=0.5, db=False)

You should now see a 2d plot with the STF efficienciy as a function of the bandgaps.

If your absorber is approaching the detailed balance limit, you can calculate the detailed balance limit by setting db=False (or omitting it completely), the voltage_loss variable is then ignored, if present:


c) You want to modify you AM1.5G spectrum by the absorbance of a catalyst or electrolyte. Let us assume you have a file ‘absorbance.dat’ with your wavelength (nm) in the first column and you absorbance (1/cm) in the second column, has 5 lines of header and your absorbing layer is 5 mm thick.

am15g_mod=yo.mod_spectrum_by_abs('absorbance.dat', thickness=0.5, header=5)

You can plot the spectrum to see if things are fine


Let us now see how a tandem performs with the modified spectrum:

yo.best_gaps_double(data=am15g_mod, E0=1.23, voltage_loss=0.5, db=False)


  • Matthias May. Email: Matthias.May ]at[


Licensed under the EUPL, Version 1.2.