pvarc
Analyze anti-reflection coating measurements on the air-glass interface of a solar module
Introduction
Many solar modules have an anti-reflection coating (ARC) on the air-glass interface. This interface most often consists of a ~125 nm layer of porous silica. This package allows the user to simulate the reflection performance of these ARCs. It also provides convenient functions for calculating the solar-weighted photon reflectance which is a good figure-of-merit of the performance of a coating.
Installation
To install using pip, run:
pip install pvarc
To setup a virtual environment using conda/pip, create a virtual environment:
conda create --name pvarc -c conda-forge python=3 numpy pandas scipy matplotlib tqdm colour-science xlrd matplotlib-scalebar
conda activate pvarc
pip install tmm pvarc
Example
The first example uses the ARC reflection model to generate a sythetic reflection curve. The coating parameters are then extracted using a fit to the same model. This example can be used to demonstrate the accuracy with which the true parameters can be extracted.
"""Example for generating a synthetic reflection spectrum, fitting to the
single-layer-coating model and finding the solar weighted photon reflectance
and power enhancement due to the coating.
Todd Karin
"""
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from pvarc import single_interface_reflectance
from pvarc.metrics import solar_weighted_photon_reflectance
from pvarc.fit import fit_arc_reflection_spectrum, arc_reflection_model
from pvarc.materials import refractive_index_glass
from pvarc.oceaninsight import read_oceanview_file
# Create a synthetic reflection curve based on the theoretical model. To run on
# a different dataset, simply import the data as `wavelength` and `reflection`.
wavelength = np.linspace(200, 1100, 500)
param_true = {
'thickness': 125,
'fraction_abraded': 0.05,
'fraction_dust': 0.0,
'porosity': 0.3}
reflection = arc_reflection_model(wavelength, **param_true)
reflection = reflection + np.random.normal(0, 2e-4, wavelength.shape)
# Plot data
plt.figure(0)
plt.clf()
plt.plot(wavelength, 100 * reflection,
label='Data',
color=[0, 0, 0.8])
# Fit model
x, ret = fit_arc_reflection_spectrum(wavelength,
reflection,
model='TPA',
aoi=8,
wavelength_min=450,
wavelength_max=1000,
method='basinhopping',
verbose=True)
wavelength_extend = np.linspace(300, 1250, 1000)
reflection_fit = arc_reflection_model(wavelength_extend, **x)
# Calculate solar weighted photon reflection (SWPR) using fit
swpr = solar_weighted_photon_reflectance(wavelength_extend, reflection_fit)
# Calculate SWPR for glass reference
index_glass = refractive_index_glass(wavelength_extend)
reflection_BK7 = single_interface_reflectance(n0=1.0003,
n1=index_glass,
aoi=8)
swpr_bk7 = solar_weighted_photon_reflectance(wavelength_extend, reflection_BK7)
# Calculate power enhancement due to coating.
power_enchancement = swpr_bk7 - swpr
# Compare fit vs simulated value.
print('--\nComparison of true values vs. best fit')
for p in ['thickness', 'porosity', 'fraction_abraded']:
print('{}.\t True: {:.2f}, Fit: {:.2f}, '.format(p, param_true[p], x[p]))
# Plot theory.
plt.plot(wavelength_extend,
100 * reflection_fit,
label='Fit',
linewidth=3,
color=[1, 0.5, 0, 0.5], )
plt.text(450, 3, '*Best fit parameters*\n' + \
'Thickness: {:.0f} nm\n'.format(x['thickness']) + \
'Porosity: {:.0%}\n'.format(x['porosity']) + \
'Fraction Abraded: {:.1%}\n'.format(x['fraction_abraded']) + \
'SWPR (400-1100 nm): {:.1%}\n'.format(swpr) + \
'PE (400-1100 nm): {:.1%}\n'.format(power_enchancement)
,
fontsize=8,
)
plt.xlabel('Wavelength (nm)')
plt.ylabel('Reflection (%)')
plt.ylim([0, 8])
plt.xlim([300, 1250])
plt.legend()
plt.show()
# plt.savefig('example_out.png',dpi=200)
Metadata
Release files for pvarc 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pvarc-0.1.0.tar.gz | 88.6 kB | Without provenance | Details for pvarc-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pvarc-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pvarc-0.1.0-py3-none-any.whl |
Total release size: 179.3 kB
Release files / pvarc-0.1.0.tar.gz
| Download URL | pvarc-0.1.0.tar.gz |
|---|---|
| Size | 88.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d723a5550edb4e1009b2f2d391f7b393db2c9635a65d03c80411956b0c7d9ca
|
|
BLAKE2b-256 checksum How to use checksums |
64ee738e7b100debbb6357121fc36ae0a03d902a0a5b1b4cf9dcb77d9e8da99f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2
|
Release files / pvarc-0.1.0-py3-none-any.whl
| Download URL | pvarc-0.1.0-py3-none-any.whl |
|---|---|
| Size | 90.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0902ca333aee90a010f1affed6e7d0eee682d2c1e041240df82773ee0e8aa416
|
|
BLAKE2b-256 checksum How to use checksums |
fd2ecda5db686a464de356ede7afb06dd0fd7b4022ff6059b734e53e46a23d1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2
|
Security for pvarc 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.