-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0dfad2f
commit 0f91bab
Showing
18 changed files
with
185 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
cff-version: 1.2.0 | ||
title: 'Python Battery Optimisation and Parameterisation (PyBOP)' | ||
message: >- | ||
If you use this software, please cite it using the | ||
metadata from this file. | ||
type: software | ||
authors: | ||
- given-names: Brady | ||
family-names: Planden | ||
- given-names: Nicola | ||
family-names: Courtier | ||
- given-names: David | ||
family-names: Howey | ||
repository-code: 'https://www.github.com/pybop-team/pybop' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import numpy as np | ||
|
||
|
||
class RMSE: | ||
""" | ||
Defines the root mean square error cost function. | ||
""" | ||
|
||
def __init__(self): | ||
self.name = "RMSE" | ||
|
||
def compute(self, prediction, target): | ||
# Check compatibility | ||
if len(prediction) != len(target): | ||
print( | ||
"Length of vectors:", | ||
len(prediction), | ||
len(target), | ||
) | ||
raise ValueError( | ||
"Measurement and simulated data length mismatch, potentially due to reaching a voltage cut-off" | ||
) | ||
|
||
print("Last Values:", prediction[-1], target[-1]) | ||
|
||
# Compute the cost | ||
try: | ||
return np.sqrt(np.mean((prediction - target) ** 2)) | ||
|
||
except Exception as e: | ||
print(f"Error in RMSE calculation: {e}") | ||
return None | ||
|
||
|
||
class MLE: | ||
""" | ||
Defines the cost function for maximum likelihood estimation. | ||
""" | ||
|
||
def __init__(self): | ||
self.name = "MLE" | ||
|
||
def compute(self, prediction, target): | ||
# Compute the cost | ||
try: | ||
return 0 # update with MLE residual | ||
|
||
except Exception as e: | ||
print(f"Error in RMSE calculation: {e}") | ||
return None | ||
|
||
|
||
class PEM: | ||
""" | ||
Defines the cost function for prediction error minimisation. | ||
""" | ||
|
||
def __init__(self): | ||
self.name = "PEM" | ||
|
||
def compute(self, prediction, target): | ||
# Compute the cost | ||
try: | ||
return 0 # update with MLE residual | ||
|
||
except Exception as e: | ||
print(f"Error in RMSE calculation: {e}") | ||
return None | ||
|
||
|
||
class MAP: | ||
""" | ||
Defines the cost function for maximum a posteriori estimation. | ||
""" | ||
|
||
def __init__(self): | ||
self.name = "MAP" | ||
|
||
def compute(self, prediction, target): | ||
# Compute the cost | ||
try: | ||
return 0 # update with MLE residual | ||
|
||
except Exception as e: | ||
print(f"Error in RMSE calculation: {e}") | ||
return None | ||
|
||
def sample(self, n_chains): | ||
""" | ||
Sample from the posterior distribution. | ||
""" | ||
pass |
6 changes: 3 additions & 3 deletions
6
pybop/datasets/observations.py → pybop/datasets/base_dataset.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
# | ||
# Import lithium ion based models | ||
# | ||
|
||
from .base_echem import SPM, SPMe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import pybamm | ||
from ..BaseModel import BaseModel | ||
from ..base_model import BaseModel | ||
|
||
|
||
class SPM(BaseModel): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
pybop/optimisers/NLoptOptimize.py → pybop/optimisers/nlopt_optimize.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
pybop/optimisers/SciPyMinimize.py → pybop/optimisers/scipy_minimize.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pybamm | ||
|
||
|
||
class ParameterSet: | ||
""" | ||
Class for creating parameter sets in pybop. | ||
""" | ||
|
||
def __new__(cls, method, name): | ||
if method.casefold() == "pybamm": | ||
try: | ||
return pybamm.ParameterValues(name).copy() | ||
except: | ||
raise ValueError("Parameter set not found") | ||
else: | ||
raise ValueError("Only PyBaMM parameter sets are currently implemented") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters