Skip to content

PV-Lab/bias

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bias: Bayesian Inference with accelerated sampling

Developed by Dr. Basita Das

This code is used to perform parameter estimation from experimental JV data of solar cells.

File download

  1. Clone the code from GitHub
  2. Download Dataset from Zenodo
  3. Put the three folders Dataset, Experimental_data, and Results directly inside the folder bias where the rest of the code is. Code won't run until you download this two folder and put then inside the directory

Example: If bias is the main directory where you want to put everything, then bias should have the following files/Folders

  1. Dataset : directory for NN training data - to be downloaded from Zenodo
  2. Results : directory for results - to be downloaded from Zenodo
  3. Experimental_data : directory for experimental data - to be downloaded from Zenodo
  4. bias.py
  5. de.py
  6. de_snooker.py
  7. h5.py
  8. NN_training.py
  9. run_bias.py

Code environment

To run the code one need to create a python environment with the following libraries: install miniforge from Releases · conda-forge/miniforge
Create a file called foo.yml and paste the following in it name: biasenv channels:

  • conda-forge
  • defaults dependencies:
  • pymoo~=0.6.0.1
  • tensorflow~=2.10.0
  • addict
  • emcee~=3.1.6
  • python~=3.10
  • corner~=2.2.2
  • joblib~=1.3.2
  • scikit-learn~=1.3.2
  • statsmodels~=0.14.4
  • mpmath~=1.3.0
    Open a miniforge promt (search it in your task bar) and then in that prompt window navigate to the directory where foo.yml file is located.
    And then run this command: 'mamba env create -f foo.yml' to create the environment

How to run and save results

The code runs from run_bias.py and saves all results from the current run in a subfolder with a time stamp inside the Results folder. All data is saved and graphs corner plot are generated automatically. During every run the following files/folders are generated in a : If NN is not trained, nn_trained = "No"

  1. "timestamp_NN_trained_model.h5" stores the weights and biases trained NN model.
  2. "timestamp_NN_train_test.h5" stores the data used for training and testing the NN netwrok.
  3. "timestamp_NN_scaler.joblib" stores the scaler used to perform transformation of the training data.
  4. A new folder is created "timestamp_training" which saves the NN training

Steps to run the code without training the NN

It is possible to run the code without training the NN surrogae model. A pre-trained NN has been provided in Results/Training(download from Zenodo)

  1. To run the code with the pre-tranied NN, download the data and trained NN files availble in Zenodo
  2. Make sure the variable nn_trained='yes' in file "run_bias.py"
  3. Then run the code from run_bias.py

About

Bayesian Inference with accelerated sampling

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages