Skip to content

Commit

Permalink
Add extrapolate to both
Browse files Browse the repository at this point in the history
  • Loading branch information
arm61 committed Oct 23, 2023
1 parent b60b66c commit c3b9acb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions kinisi/arrhenius.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,21 @@ 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: float) -> 'uravu.distribution.Distribution':
def extrapolate(self, extrapolated_temperature: Union[float, List[float], np.ndarray], posterior_predictive_kwargs=None) -> '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.
"""
return self.function(extrapolated_temperature, self.flatchain[:, 0], self.flatchain[:, 1], self.flatchain[:, 2])
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)


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

0 comments on commit c3b9acb

Please sign in to comment.