Linear Scaling#

class pylit.core.linear_scaling.LinearScaling(tau)#

Bases: object

Base class for linear scaling of Laplace/inverse Laplace transforms.

This class sets up a diffeomorphism \(\psi\), which maps the time axis \(\tau\) from the interval \([\tau_0, \tau_1]\) to \([0, 1]\).

__init__(tau)#

Initialize the LinearScaling class.

Parameters:

tau (ndarray) – The discretised time axis \(\tau\). Must be a one-dimensional array. The right endpoint tau1 is taken as \(\max \tau\).

Raises:
  • ValueError – If the nodes are not one-dimensional.

  • ValueError – If the right endpoint is not strictly positive.

property psy: callable#

The diffeomorphism mapping the interval [tau0, tau1] onto [0, tau1].

property tau0: float#

Left endpoint of the interval is always \(0.0\).

property tau1: float#

Right endpoint of the interval is always \(\max au\).

class pylit.core.linear_scaling.OmegaLinearScaling(tau)#

Bases: LinearScaling

__call__(func)#

Apply linear scaling to a model function.

Given a model function \(f(\omega)\), this decorator scales both the frequency variable and amplitude:

\[S_{\text{scaled}}(\omega) = (\tau_1 - \tau_0)\, e^{\tau_0 \omega}\, S\big((\tau_1 - \tau_0)\, \omega\big)\]

where \([\tau_0, \tau_1]\) is the original time interval.

Parameters:

func – A model function \(S(\omega)\).

Returns:

The scaled model function \(S_{\text{scaled}}(\omega)\).

Examples

>>> import numpy as np
>>> def S(omega): return np.exp(-omega**2)
>>> scale = OmegaLinearScaling(tau=np.linspace(0, 8, 20))
>>> scaled_S = scale(S)
>>> scaled_S(0.5)
(scale.tau1 - scale.tau0) * np.exp(scale.tau0 * 0.5) * S((scale.tau1 - scale.tau0) * 0.5)
__init__(tau)#

Initialize the OmegaLinearScaling by means of its superclass.

class pylit.core.linear_scaling.TauLinearScaling(tau)#

Bases: LinearScaling

__call__(func)#

Apply linear scaling to a Laplace transform.

Given a Laplace transform \(F(\tau)\), this decorator scales the time axis using the diffeomorphism \(\psi\):

\[F_{\text{scaled}}(\tau) = F(\psi(\tau))\]
Parameters:

func – A Laplace transformed function \(F(\tau)\).

Returns:

The scaled Laplace transform \(F_{\text{scaled}}(\tau)\).

Examples

>>> import numpy as np
>>> def f(tau): return np.exp(-tau)
>>> scale = TauLinearScaling(tau=np.linspace(0, 8, 20))
>>> scaled_f = scale(f)
>>> scaled_f(0.5)
np.exp(-scale.psy(0.5))
__init__(tau)#

Initialize the TauLinearScaling by means of its superclass.