Skip to content

Commit

Permalink
Revert extrapolate
Browse files Browse the repository at this point in the history
  • Loading branch information
arm61 committed Oct 23, 2023
1 parent c3b9acb commit 7f08c57
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions kinisi/arrhenius.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from typing import List, Union, Tuple
import numpy as np
from uravu.relationship import Relationship
from uravu.distribution import Distribution
from scipy.constants import R, N_A, eV

# Convert R to eV
Expand Down Expand Up @@ -68,21 +67,15 @@ def distribution(self) -> np.ndarray:
"""
return self.function(self.x[:, np.newaxis], self.flatchain[:, 0], self.flatchain[:, 1])

def extrapolate(self, extrapolated_temperature: Union[float, List[float], np.ndarray], posterior_predictive_kwargs=None) -> 'uravu.distribution.Distribution':
def extrapolate(self, extrapolated_temperature: float) -> 'uravu.distribution.Distribution':
"""
Extrapolate the diffusion coefficient to some un-investigated value. This can also be
used for interpolation.
:param: Temperature to return diffusion coefficient at.
:return: Diffusion coefficient at extrapolated temperature.
"""
if posterior_predictive_kwargs is None:
posterior_predictive_kwargs = {}
if isinstance(extrapolated_temperature, (float, int, complex)) :
extrapolated_temperature = np.array([extrapolated_temperature])
if isinstance(extrapolated_temperature, List):
extrapolated_temperature = np.array(extrapolated_temperature)
return self.posterior_predictive(abscissa_values=extrapolated_temperature, **posterior_predictive_kwargs)
return self.function(extrapolated_temperature, self.flatchain[:, 0], self.flatchain[:, 1])


def arrhenius(abscissa: np.ndarray, activation_energy: float, prefactor: float) -> np.ndarray:
Expand Down Expand Up @@ -155,21 +148,15 @@ def distribution(self) -> np.ndarray:
"""
return self.function(self.x[:, np.newaxis], self.flatchain[:, 0], self.flatchain[:, 1], self.flatchain[:, 2])

def extrapolate(self, extrapolated_temperature: Union[float, List[float], np.ndarray], posterior_predictive_kwargs=None) -> 'uravu.distribution.Distribution':
def extrapolate(self, extrapolated_temperature: float) -> 'uravu.distribution.Distribution':
"""
Extrapolate the diffusion coefficient to some un-investigated value. This can also be
used for interpolation.
:param: Temperature to return diffusion coefficient at.
:return: Diffusion coefficient at extrapolated temperature.
"""
if posterior_predictive_kwargs is None:
posterior_predictive_kwargs = {}
if isinstance(extrapolated_temperature, (float, int, complex)) :
extrapolated_temperature = np.array([extrapolated_temperature])
if isinstance(extrapolated_temperature, List):
extrapolated_temperature = np.array(extrapolated_temperature)
return self.posterior_predictive(abscissa_values=extrapolated_temperature, **posterior_predictive_kwargs)
return self.function(extrapolated_temperature, self.flatchain[:, 0], self.flatchain[:, 1], self.flatchain[:, 2])


def super_arrhenius(abscissa: np.ndarray, activation_energy: float, prefactor: float, t_zero: float) -> np.ndarray:
Expand Down

0 comments on commit 7f08c57

Please sign in to comment.