Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs and testing #18

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ exclude=
./myokit/formats/python/template,
./build,
./venv,
./venv2,
./venv2,
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: PyBaMM-TEA tests

on:
workflow_dispatch:
pull_request:

jobs:
build:
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coverage flake8
pip install .
- name: Lint with flake8
run: |
flake8 . --count --exit-zero --show-source --statistics
- name: Test with unittest
run: |
coverage run -m unittest
- name: Upload Coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9
uses: codecov/codecov-action@v2
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#

![logo](https://raw.githubusercontent.com/pybamm-team/pybamm-tea/main/docs/pybamm_tea_logo.png)
![PyBaMM-TEA-logo](https://raw.githubusercontent.com/pybamm-team/pybamm-tea/main/docs/pybamm_tea_logo.png)


# PyBaMM-TEA

This repository contains the work of the "Google Summer of Code" project on a techno-economic analysis library for battery cells, which can be combined with PyBaMM's functionality.
So far, there is a method to visualize mass- and volume loadings of an electrode stack and to estimate energy densities without simulation. The project further aims to estimate cell metrics with simulations (e.g. a Ragone plot) and manufacturing metrics with a Process-based Cost Model.

This repository contains the work of the "Google Summer of Code" project on a techno-economic analysis library for battery cells, which can be combined with PyBaMM's functionality. So far, there is a method to visualize mass- and volume- loadings of an electrode stack and to estimate energy densities without simulation. The project further aims to estimate cell metrics with simulations (e.g. a Ragone plot) and manufacturing metrics with a Process-based Cost Model.

## Installation
We recommend installing within a [virtual environment](https://docs.python.org/3/tutorial/venv.html) in order to not alter any python distribution files on your machine.
Expand Down Expand Up @@ -95,3 +92,13 @@ tea_nco.plot_stack_breakdown()
# electrode stack
print(tea_nco.stack_breakdown_dataframe)
```

## Documentation
API documentation for the `pybamm_tea` package can be built locally using [Sphinx](https://www.sphinx-doc.org/en/master/). To build the documentation first [clone the repository](https://github.com/git-guides/git-clone), then run the following command:
```bash
sphinx-build docs docs/_build/html
```
This will generate a number of html files in the `docs/_build/html` directory. To view the documentation, open the file `docs/_build/html/index.html` in a web browser, e.g. by running
```bash
open docs/_build/html/index.html
```
19 changes: 19 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS = -j auto
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
144 changes: 144 additions & 0 deletions docs/_static/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
@import url("https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;0,900;1,400;1,700;1,900&family=Open+Sans:ital,wght@0,400;0,600;1,400;1,600&display=swap");

.navbar-brand img {
height: 50px;
}

.navbar-brand {
height: 50px;
}

body {
font-family: "Open Sans", sans-serif;
}

pre,
code {
font-size: 100%;
line-height: 155%;
}

h1 {
font-family: "Lato", sans-serif;
color: #013243;
/* warm black */
}

h2 {
color: #4d77cf;
/* han blue */
letter-spacing: -0.03em;
}

h3 {
color: #013243;
/* warm black */
letter-spacing: -0.03em;
}

/* Style the active version button.

- latest: orange
- stable: green
- old, PR: red

Colors from:

Wong, B. Points of view: Color blindness.
Nat Methods 8, 441 (2011). https://doi.org/10.1038/nmeth.1618
*/

/* If the active version has the name "latest", style it orange */
.version-switcher__button[data-active-version-name*="latest"] {
background-color: #e69f00;
border-color: #e69f00;
color: #000000;
}

/* green for `stable` */
.version-switcher__button[data-active-version-name*="stable"] {
background-color: #009e73;
border-color: #009e73;
}

/* red for `old` */
.version-switcher__button:not([data-active-version-name*="latest"],
[data-active-version-name*="stable"]) {
background-color: #980f0f;
border-color: #980f0f;
}

/* Main page overview cards */

.sd-card {
background: #fff;
border-radius: 0;
padding: 30px 10px 20px 10px;
margin: 10px 0px;
}

.sd-card .sd-card-header {
text-align: center;
}

.sd-card .sd-card-header .sd-card-text {
margin: 0px;
}

.sd-card .sd-card-img-top {
height: 52px;
width: 52px;
margin-left: auto;
margin-right: auto;
}

.sd-card .sd-card-header {
border: none;
background-color: white;
color: #150458 !important;
font-size: var(--pst-font-size-h5);
font-weight: bold;
padding: 2.5rem 0rem 0.5rem 0rem;
}

.sd-card .sd-card-footer {
border: none;
background-color: white;
}

.sd-card .sd-card-footer .sd-card-text {
max-width: 220px;
margin-left: auto;
margin-right: auto;
}

/* Dark theme tweaking */
html[data-theme="dark"] .sd-card img[src*=".svg"] {
filter: invert(0.82) brightness(0.8) contrast(1.2);
}

/* Main index page overview cards */
html[data-theme="dark"] .sd-card {
background-color: var(--pst-color-background);
}

html[data-theme="dark"] .sd-shadow-sm {
box-shadow: 0 0.1rem 1rem rgba(250, 250, 250, 0.6) !important;
}

html[data-theme="dark"] .sd-card .sd-card-header {
background-color: var(--pst-color-background);
color: #150458 !important;
}

html[data-theme="dark"] .sd-card .sd-card-footer {
background-color: var(--pst-color-background);
}

html[data-theme="dark"] h1 {
color: var(--pst-color-primary);
}

html[data-theme="dark"] h3 {
color: #0a6774;
}
File renamed without changes
Loading
Loading