Skip to content

Python QT batch curve fitting GUI tool for solar cell IV data files

License

Notifications You must be signed in to change notification settings

greyltc/analysis-software

Repository files navigation

batch-iv-analysis

screenshot1

This project is a GUI program written in python, intended to make it easy for solar cell researchers to characterize the electrical properties of the solar cells they make. It's meant to be robust enough to throw all your IV data files at it in one go (hence the "batch"). The code here takes IV (current-voltage sweep) data files (of various formats, new format additions welcome!) and uses it to find values for the components of the following solar cell circuit model:

Circuit

where R_S is the series resistance
R_SH is the shunt resistance,
I_D is the diode current,
I_L is the light current,
I_0 is the reverse saturation current,
n is the diode's ideality factor,
I is the current out of the positive terminal of the cell (measured)
and V is the voltage across the cell (measured)
which is described by

Equation

I_L, I_0, n, R_S and R_SH are found by nonlinear regression via scipy.optimize.curve_fit() and the user can place arbitrary constraints on these fit parameters (such as specifying ranges for them or setting them to a specific value).

If you find this code useful...


Feel free to shoot me an email with comments or suggestions. grey [AT] christoforo [DOT] net
I'd be super happy to accept pull requests or ideas you have for improving this and I can probably help add support for your own custom IV data file input format.

Features


  • Hover over the column headers for a little blurb on what that column contains
  • Double click anywhere in the table to bring up a graph to compare the fitted curve with the raw data associated with the line you clicked (this is a way to quickly check if the fit is good or bad)
  • This feature seems to crash under windows if you do this without closing a previously opened graph window
  • Hover over the file name in each column to see the LabVIEW generated summary data for that file (for comparison purposes)
  • The numbers shown in the table for Pmax, Vmax, Voc, I/Jsc and FF are calculated from a spline fit to the data.
  • Hovering over these values will show those calculated from the fit to the characteristic solar cell equation
  • Hovering over other numbers in the table will show +/- 95% confidence intervals for that value
  • Can read and plot i,v vs time data files generated by i-v-vs-time-taker. Does no analysis on them currently (but could in the future).

Files here


  • batch-iv-analysis.py
  • Main python script. Run this to use the tool. You can edit the code in this file directly using your favorite editor.
  • batch-iv-analysis.ui
  • Contains user interface design for main window, edit with Qt Designer (I used version 5.6.0)
  • batch_iv_analysis_UI.py
  • Do not edit this file directly. Instead generate it from batch-iv-analysis.ui by issuing:
    pyuic5 -o batch_iv_analysis_UI.py batch-iv-analysis.ui
  • Use this file to generate standalone release packages (see instructions below)

Installation


Installing With Anacoda

Windows and MacOS users should do this.

  1. Make sure you have the very latest Python 3 version of Anaconda installed from here
  2. Run the "Anaconda Prompt" program that was installed in step #1 (on a Mac just run these commands in your terminal) and type the following in:
# prepare anaconda
conda update conda
conda update --all
conda config --prepend channels conda-forge
conda update --all
conda install git conda-build
git clone https://github.com/mutovis/analysis-software.git
cd analysis-software

# build and (re)install
conda build . --output-folder build
conda remove mutovis-analysis # you must do this if it's already installed, anaconda is dumb.
conda install -c "./build" mutovis-analysis

# clean up all build items now or else your next build might fail
rm -rf ./build
conda clean --all
conda build purge

# run the analysis tool
mutovis-analysis

Installing Under Linux

You could use the above Anaconda instructions if you wish, but running your distro's python might be faster. If you use Arch Linux you can skip all this and just install the python-mutovis-analysis package from the AUR.

  1. Inspect meta.yaml and use your distro's package manager to install the python3 packages corresponding to the modules listed in the run: section.
  2. Run the following in your terminal:
git clone https://github.com/mutovis/analysis-software.git
cd analysis-software
python setup.py install --user

# run the analysis tool
mutovis-analysis

Hacking


Hacking Under Linux

  1. Inspect meta.yaml and install the python3 packages corresponding to the modules listed in the run: section.
  2. Run the following in your terminal:
git clone https://github.com/mutovis/analysis-software.git
cd analysis-software

# do your hacking here

# run the analysis tool
./mutovis-analysis

Hacking With Anaconda

Windows and MacOS users should do this.

  1. Make sure you have the very latest Python 3 version of Anaconda installed from here
  2. Run the "Anaconda Prompt" program that was installed in step #1 (on a Mac just run these commands in your terminal) and type the following in:
# prepare anaconda
conda update conda
conda update --all
conda config --prepend channels conda-forge
conda update --all
conda install git conda-build
git clone https://github.com/mutovis/analysis-software.git
cd analysis-software

# install the dependancies
conda build . --output-folder build
conda install --only-deps -c "./build" mutovis-analysis

# clean up all build items now or else you might get failures next time
rm -rf ./build
conda clean --all
conda build purge

# do your hacking here

# run the analysis tool
python mutovis-analysis