Skip to content

Commit

Permalink
PVcircuit v0.0.5
Browse files Browse the repository at this point in the history
This update includes multiple fixes for compatibility and stability, new features for testing and CI, and the deprecation of the EY module.

- Update example notebooks
- Minor fixes in settings
- Fix `strout` in `iv3t` for `numpy > 2.x.x`
- Correct `qe` datapath for packaged version
- Fix whitespace offset in `strout` for SPICE on macOS
- Use stable sorting in `IV3T`

- Migrate configuration to `pyproject.toml`
- Add unit tests and workflows
- Integrate coverage reporting

- Disable tandems

- Deprecate `EY` module
  • Loading branch information
Robert Witteck committed Oct 30, 2024
1 parent c8b2c0f commit b7dc52f
Show file tree
Hide file tree
Showing 67 changed files with 5,347 additions and 523 deletions.
Binary file removed .DS_Store
Binary file not shown.
38 changes: 38 additions & 0 deletions .github/workflows/tomlproject.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Python Tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest] # Chose windows-latest, ubuntu-latest, macos-latest.
python-version: ['3.9', '3.10', '3.11', '3.12'] # Test multiple Python versions
fail-fast: false
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

# Install
- name: Set up Python and Install Dependencies
run: |
python -m pip install --upgrade pip # Ensure pip is up to date
python -m pip install .[test] # Install the package with development dependencies from pyproject.toml
# Lint with Ruff
# - name: Lint with Ruff
# run: |
# ruff check . --statistics

# Run pyest
- name: Run Tests
run: |
pytest --cov=pvcircuit
# continue-on-error: true
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ celerybeat.pid
.venv
env/
venv/
cenv/
.cenv/
ENV/
env.bak/
venv.bak/
Expand All @@ -114,6 +116,9 @@ venv.bak/
.spyderproject
.spyproject

# vscode project settings
.vscode

# Rope project settings
.ropeproject

Expand All @@ -127,3 +132,6 @@ dmypy.json

# Pyre type checker
.pyre/

# other folders
Share/
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Python Tests](https://github.com/NREL/PVcircuit/actions/workflows/tomlproject.yml/badge.svg?branch=master)](https://github.com/NREL/PVcircuit/actions/workflows/tomlproject.yml)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

# pvcircuit
*pvcircuit* contains objects that are building blocks for PV modeling and interactive data fitting.

Expand Down
47 changes: 21 additions & 26 deletions notebooks/4J IMM.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,13 @@
"execution_count": 2,
"id": "35e3d9d6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tandems version 0.989\n",
"Data path is: /Users/jgeisz/Documents/GitHub/Tandems/tandems/data/\n"
]
}
],
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"from pvcircuit.PlotWithControls import PlotsWithControls\n",
"import pvcircuit as pvc\n",
"import ipywidgets as widgets\n",
"#%matplotlib inline\n",
Expand Down Expand Up @@ -97,27 +89,30 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"id": "9ac045cc-f893-4f9a-a7f6-f82caeb74c7d",
"metadata": {},
"outputs": [],
"source": [
"ui, dax, lax = MM927.controls()"
"pwc = PlotsWithControls(MM927)\n",
"ui = pwc.ui\n",
"dax = pwc.dax\n",
"lax = pwc.lax"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "fc908aa2-60a8-405f-ae73-42cb9e5e7f30",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x7fa8891f4cd0>]"
"[<matplotlib.lines.Line2D at 0x2f0beaa6500>]"
]
},
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -138,7 +133,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"id": "b1ef0475-afe7-417d-a4a0-a4e63d09e62c",
"metadata": {},
"outputs": [
Expand All @@ -150,7 +145,7 @@
"\n",
"j[0]: <pvcircuit.junction.Junction class>\n",
"Eg = 1.83 eV, TC = 25.0 C\n",
"Jext = 12.0 , JLC = 0.0 mA/cm2\n",
"Jext = 12.0 mA/cm2, JLC = 0.0 mA/cm2\n",
"Gsh = 0 S/cm2, Rser = 0 Ωcm2\n",
"lightA = 1 cm2, totalA = 1.15 cm2\n",
"pn = -1, beta = 0, gamma = 0\n",
Expand All @@ -161,7 +156,7 @@
"\n",
"j[1]: <pvcircuit.junction.Junction class>\n",
"Eg = 1.40 eV, TC = 25.0 C\n",
"Jext = 11.5 , JLC = 3.9 mA/cm2\n",
"Jext = 11.5 mA/cm2, JLC = 3.9 mA/cm2\n",
"Gsh = 0 S/cm2, Rser = 0 Ωcm2\n",
"lightA = 1 cm2, totalA = 1.15 cm2\n",
"pn = -1, beta = 14.3, gamma = 0\n",
Expand All @@ -172,7 +167,7 @@
"\n",
"j[2]: <pvcircuit.junction.Junction class>\n",
"Eg = 1.05 eV, TC = 25.0 C\n",
"Jext = 11.4 , JLC = 0.9 mA/cm2\n",
"Jext = 11.4 mA/cm2, JLC = 0.9 mA/cm2\n",
"Gsh = 0 S/cm2, Rser = 0 Ωcm2\n",
"lightA = 1 cm2, totalA = 1.15 cm2\n",
"pn = -1, beta = 8.6, gamma = 0\n",
Expand All @@ -183,7 +178,7 @@
"\n",
"j[3]: <pvcircuit.junction.Junction class>\n",
"Eg = 0.74 eV, TC = 25.0 C\n",
"Jext = 12.3 , JLC = 1.5 mA/cm2\n",
"Jext = 12.3 mA/cm2, JLC = 1.5 mA/cm2\n",
"Gsh = 0 S/cm2, Rser = 0 Ωcm2\n",
"lightA = 1 cm2, totalA = 1.15 cm2\n",
"pn = -1, beta = 10.5, gamma = 0\n",
Expand All @@ -194,7 +189,7 @@
"RBB_dict: {'method': 'JFG', 'mrb': 43.0, 'J0rb': 0.3, 'Vrb': 0.0}"
]
},
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -205,19 +200,19 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"id": "5dd5e423-b857-4f03-8153-0746f5f58dfd",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b4bfa81d26bc4c08a5d79dc37ac7c64c",
"model_id": "5d0fc313cc7b416190deb395c2d3164d",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HBox(children=(Output(), Output()), layout=Layout(display='flex', flex_flow='row', justify_cont"
"VBox(children=(HBox(children=(Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': \"Canvas(t"
]
},
"metadata": {},
Expand All @@ -239,7 +234,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -253,7 +248,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.10.4"
}
},
"nbformat": 4,
Expand Down
68 changes: 24 additions & 44 deletions notebooks/MS874_3T.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,13 @@
"execution_count": 2,
"id": "fcd04291",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tandems version 0.989\n",
"Data path is: /Users/jgeisz/Documents/GitHub/Tandems/tandems/data/\n"
]
}
],
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib as mpl\n",
"from pvcircuit.PlotWithControls import PlotsWithControls\n",
"import pvcircuit as pvc\n",
"import ipywidgets as widgets\n",
"#%matplotlib inline\n",
Expand All @@ -49,7 +41,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "3d7dd5f8-2a35-461c-a5d7-81bceee9093e",
"metadata": {},
"outputs": [],
Expand All @@ -60,20 +52,20 @@
"path = pvc.datapath\n",
"fileA = 'MS874n4papy_C_CZ_JA.csv'\n",
"fileB = 'MS874n4papy_C_CZ_JB.csv'\n",
"MS874_V_dataiv = pvc.IV3T.loadcsv('MS874_V_dataiv',path,fileA,fileB,'V','CZ', area=A) #Iscale=1000./A) \n",
"MS874_V_dataiv = pvc.IV3T.from_csv('MS874_V_dataiv',path,fileA,fileB,'V','CZ', area=A) #Iscale=1000./A)\n",
"# data iv3T vs I\n",
"fileA = 'MS874n4papy_C_CZ_VA.csv'\n",
"fileB = 'MS874n4papy_C_CZ_VB.csv'\n",
"MS874_I_dataiv = pvc.IV3T.loadcsv('MS874_I_dataiv',path,fileA,fileB,'I','CZ', area=A) #Iscale=1000./A) \n",
"MS874_I_dataiv = pvc.IV3T.from_csv('MS874_I_dataiv',path,fileA,fileB,'I','CZ', area=A) #Iscale=1000./A)\n",
"#dark data\n",
"fileA = 'MS874n4Cdark_CZ_JA.csv'\n",
"fileB = 'MS874n4Cdark_CZ_JB.csv'\n",
"MS874dark_dataiv = pvc.IV3T.loadcsv('MS874dark_dataiv',path,fileA,fileB,'V','CZ', area=A) #Iscale=1000./A) "
"MS874dark_dataiv = pvc.IV3T.from_csv('MS874dark_dataiv',path,fileA,fileB,'V','CZ', area=A) #Iscale=1000./A)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"id": "f471637c-4313-4988-8f8c-1683e5ddf91c",
"metadata": {},
"outputs": [],
Expand All @@ -82,7 +74,7 @@
"MS874dev3T = pvc.Tandem3T()\n",
"\n",
"MS874dev3T.set(name='MS874dev3T', Rz = 0.3)\n",
"MS874dev3T.top.set(Eg=1.861, n=[1.0, 1.8], J0ratio=[158, 12], Jext=0.01525, Gsh=1e-12) \n",
"MS874dev3T.top.set(Eg=1.861, n=[1.0, 1.8], J0ratio=[158, 12], Jext=0.01525, Gsh=1e-12)\n",
"#MS874dev3T.top.set(Rser=1.1, beta=2e-6, area=A)\n",
"MS874dev3T.top.set(Rser=1.1, beta=3e-6, area=A)\n",
"\n",
Expand All @@ -94,40 +86,28 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"id": "8f62fafb-eeaa-4ea1-91a6-01102d3518a4",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1e7689fe21f7410fa8e09e1ed3919da5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HBox(children=(Output(), Output()), layout=Layout(display='flex', flex_flow='row', justify_cont…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"ui, Vax, Iax = MS874dev3T.controls(MS874_V_dataiv, MS874_I_dataiv, MS874dark_dataiv, hex=False)\n",
"ui"
"# ui, Vax, Iax = MS874dev3T.controls(MS874_V_dataiv, MS874_I_dataiv, MS874dark_dataiv, hex=False)\n",
"# ui\n",
"\n",
"pwc = PlotsWithControls(MS874dev3T,MS874_V_dataiv, MS874_I_dataiv, MS874dark_dataiv, hex=False)\n",
"ui = pwc.ui"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "179a3a24-50f6-4f39-bbef-493f44c54d04",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8770e51bc9104f038bcf1a5b17fdd67f",
"model_id": "9c1f15b3795949c8aeca8fa0765fe2b1",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -147,17 +127,17 @@
"Lout = widgets.Output()\n",
"Rout = widgets.Output()\n",
"ToutBox = widgets.HBox([Lout, Rout])\n",
"with Lout: \n",
"with Lout:\n",
" Tax.get_figure().show()\n",
"with Rout: \n",
"with Rout:\n",
" Bax.get_figure().show()\n",
"plt.ion()\n",
"ToutBox"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"id": "1484973f-fe1a-44fa-8018-0a8899ecce1c",
"metadata": {},
"outputs": [
Expand All @@ -180,7 +160,7 @@
" MPPCM -3.40 0.00 3.40 1.350 -1.057 -0.294 -3.40 3.40 -1.057 -1.350 1.00 -4.81 0.00 1.162 -1.220 "
]
},
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -207,9 +187,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "pvdev",
"display_name": "Python 3",
"language": "python",
"name": "pvdev"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -221,7 +201,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.10.4"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit b7dc52f

Please sign in to comment.