Skip to content

Commit

Permalink
Add ruff formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTranter committed Feb 8, 2024
1 parent ee34b2e commit 5b565f5
Show file tree
Hide file tree
Showing 44 changed files with 1,261 additions and 1,082 deletions.
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.3"
hooks:
- id: ruff
args: [--fix, --show-fixes, --exclude=__init__.py]
types_or: [python, pyi, jupyter]
- id: ruff-format
types_or: [python, pyi, jupyter]
177 changes: 66 additions & 111 deletions docs/examples/01 Getting started.ipynb

Large diffs are not rendered by default.

144 changes: 81 additions & 63 deletions docs/examples/02 Network from an image.ipynb

Large diffs are not rendered by default.

146 changes: 63 additions & 83 deletions docs/examples/03 Running a simulation.ipynb

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions jellybamm/__battery__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def pos_OCP(sto):
return (
c[0]
+ c[1] * sto
+ c[2] * sto ** 2
+ c[3] * sto ** 3
+ c[4] * sto ** 4
+ c[5] * sto ** 5
+ c[2] * sto**2
+ c[3] * sto**3
+ c[4] * sto**4
+ c[5] * sto**5
)


Expand All @@ -73,12 +73,12 @@ def neg_dUdT(sto):
return (
c[0]
+ c[1] * sto
+ c[2] * sto ** 2
+ c[3] * sto ** 3
+ c[4] * sto ** 4
+ c[5] * sto ** 5
+ c[6] * sto ** 6
+ c[7] * sto ** 7
+ c[2] * sto**2
+ c[3] * sto**3
+ c[4] * sto**4
+ c[5] * sto**5
+ c[6] * sto**6
+ c[7] * sto**7
)


Expand All @@ -94,8 +94,8 @@ def pos_dUdT(sto):
return (
c[0]
+ c[1] * sto
+ c[2] * sto ** 2
+ c[3] * sto ** 3
+ c[4] * sto ** 4
+ c[5] * sto ** 5
+ c[2] * sto**2
+ c[3] * sto**3
+ c[4] * sto**4
+ c[5] * sto**5
)
6 changes: 3 additions & 3 deletions jellybamm/__definitions__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

ROOT_DIR = os.path.dirname(os.path.abspath(jellybamm.__file__))
PARENT_DIR = os.path.dirname(ROOT_DIR)
TESTS_DIR = os.path.join(PARENT_DIR, 'tests')
FIXTURES_DIR = os.path.join(TESTS_DIR, 'fixtures')
TEST_CASES_DIR = os.path.join(FIXTURES_DIR, 'cases')
TESTS_DIR = os.path.join(PARENT_DIR, "tests")
FIXTURES_DIR = os.path.join(TESTS_DIR, "fixtures")
TEST_CASES_DIR = os.path.join(FIXTURES_DIR, "cases")
INPUT_DIR = os.path.join(ROOT_DIR, "input")
OUTPUT_DIR = os.path.join(ROOT_DIR, "output")
2 changes: 0 additions & 2 deletions jellybamm/__funcs__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def current_function(t):


def adjust_parameters(parameter_values, I_typical):

parameter_values.update(
{
# "Typical current [A]": I_typical,
Expand All @@ -57,7 +56,6 @@ def adjust_parameters(parameter_values, I_typical):


def output_variables():

return [
"Terminal voltage [V]",
"Volume-averaged cell temperature [K]",
Expand Down
1 change: 1 addition & 0 deletions jellybamm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
from .__topology__ import *
from .__battery__ import *
from .__liionsolve__ import *

__version__ = "0.0.3"
10 changes: 7 additions & 3 deletions jellybamm/__liionsolve__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def run_simulation_lp(parameter_values, experiment, initial_soc, project):
# e_heights.fill(np.mean(e_heights))
inputs = {
"Electrode height [m]": e_heights,
"Input temperature [K]": spm_temperature
"Input temperature [K]": spm_temperature,
}
###########################################################################
# Initialisation
Expand Down Expand Up @@ -173,7 +173,9 @@ def run_simulation_lp(parameter_values, experiment, initial_soc, project):
Q[res_Ts] += Q_tot
jellybamm.apply_heat_source_lp(project, Q)
# Calculate Global Temperature
jellybamm.run_step_transient(project, dim_time_step, T0, cp, rho, thermal_third)
jellybamm.run_step_transient(
project, dim_time_step, T0, cp, rho, thermal_third
)
# Interpolate the node temperatures for the SPMs
spm_temperature = phase.interpolate_data("pore.temperature")[res_Ts]
# T_non_dim_spm = fT_non_dim(parameter_values, spm_temperature)
Expand Down Expand Up @@ -233,7 +235,9 @@ def run_simulation_lp(parameter_values, experiment, initial_soc, project):
Q[res_Ts] += Q_tot
jellybamm.apply_heat_source_lp(project, Q)
# Calculate Global Temperature
jellybamm.run_step_transient(project, dim_time_step, T0, cp, rho, thermal_third)
jellybamm.run_step_transient(
project, dim_time_step, T0, cp, rho, thermal_third
)
# Interpolate the node temperatures for the SPMs
spm_temperature = phase.interpolate_data("pore.temperature")[res_Ts]
###################################################################
Expand Down
Loading

0 comments on commit 5b565f5

Please sign in to comment.