funclp.Spline module

class funclp.Spline(model2interp=None, x2interp=None, k=3, /, **kwargs)[source]

Bases: Function

property amp
static amp0(res, *vars)
amp_fit = True
amp_max = np.float32(inf)
amp_min = np.float32(-inf)
property coeffs
property constants
property cpu_d_amp
property cpu_d_k
property cpu_d_mu
property cpu_d_offset
property cpu_function
property cpukernel_d_amp
property cpukernel_d_k
property cpukernel_d_mu
property cpukernel_d_offset
property cpukernel_function
d_amp

Decorator class defining universal function factory object from python kernel function, will create kernels, vectorized functions, jitted functions, stack functions, all on CPU / Parallel CPU / GPU.

Examples

>>> from funclp import Parameter, ufunc
>>> import numpy as np
...
>>> class MyClass() :
...     @ufunc(variables=['x', 'y'], data=['constant'], parameters=[Parameter('a', 1), Parameter('b', 0)])
...     def myfunc(x, y, constant, /, a, b) :
...         return a * x + b * y + constant
...     cuda = False
...
>>> instance = MyClass()
...
>>> x = np.arange(20).reshape((1, 20)) # Example of variables that can be broadcasted together
>>> y = np.arange(20).reshape((20, 1)) # Example of variables that can be broadcasted together
>>> constant = np.ones((5, 20, 20)) # Example of data with full shape
>>> a = np.arange(5) # Example of parameter vector
>>> b = 0.5 # Example of scalar use
>>> cpu_out = instance.myfunc(x, y, constant, a=a, b=b)
>>> instance.cuda = True
>>> gpu_out = instance.myfunc(x, y, constant, a=a, b=b)

d_k

Decorator class defining universal function factory object from python kernel function, will create kernels, vectorized functions, jitted functions, stack functions, all on CPU / Parallel CPU / GPU.

Examples

>>> from funclp import Parameter, ufunc
>>> import numpy as np
...
>>> class MyClass() :
...     @ufunc(variables=['x', 'y'], data=['constant'], parameters=[Parameter('a', 1), Parameter('b', 0)])
...     def myfunc(x, y, constant, /, a, b) :
...         return a * x + b * y + constant
...     cuda = False
...
>>> instance = MyClass()
...
>>> x = np.arange(20).reshape((1, 20)) # Example of variables that can be broadcasted together
>>> y = np.arange(20).reshape((20, 1)) # Example of variables that can be broadcasted together
>>> constant = np.ones((5, 20, 20)) # Example of data with full shape
>>> a = np.arange(5) # Example of parameter vector
>>> b = 0.5 # Example of scalar use
>>> cpu_out = instance.myfunc(x, y, constant, a=a, b=b)
>>> instance.cuda = True
>>> gpu_out = instance.myfunc(x, y, constant, a=a, b=b)

d_mu

Decorator class defining universal function factory object from python kernel function, will create kernels, vectorized functions, jitted functions, stack functions, all on CPU / Parallel CPU / GPU.

Examples

>>> from funclp import Parameter, ufunc
>>> import numpy as np
...
>>> class MyClass() :
...     @ufunc(variables=['x', 'y'], data=['constant'], parameters=[Parameter('a', 1), Parameter('b', 0)])
...     def myfunc(x, y, constant, /, a, b) :
...         return a * x + b * y + constant
...     cuda = False
...
>>> instance = MyClass()
...
>>> x = np.arange(20).reshape((1, 20)) # Example of variables that can be broadcasted together
>>> y = np.arange(20).reshape((20, 1)) # Example of variables that can be broadcasted together
>>> constant = np.ones((5, 20, 20)) # Example of data with full shape
>>> a = np.arange(5) # Example of parameter vector
>>> b = 0.5 # Example of scalar use
>>> cpu_out = instance.myfunc(x, y, constant, a=a, b=b)
>>> instance.cuda = True
>>> gpu_out = instance.myfunc(x, y, constant, a=a, b=b)

d_offset

Decorator class defining universal function factory object from python kernel function, will create kernels, vectorized functions, jitted functions, stack functions, all on CPU / Parallel CPU / GPU.

Examples

>>> from funclp import Parameter, ufunc
>>> import numpy as np
...
>>> class MyClass() :
...     @ufunc(variables=['x', 'y'], data=['constant'], parameters=[Parameter('a', 1), Parameter('b', 0)])
...     def myfunc(x, y, constant, /, a, b) :
...         return a * x + b * y + constant
...     cuda = False
...
>>> instance = MyClass()
...
>>> x = np.arange(20).reshape((1, 20)) # Example of variables that can be broadcasted together
>>> y = np.arange(20).reshape((20, 1)) # Example of variables that can be broadcasted together
>>> constant = np.ones((5, 20, 20)) # Example of data with full shape
>>> a = np.arange(5) # Example of parameter vector
>>> b = 0.5 # Example of scalar use
>>> cpu_out = instance.myfunc(x, y, constant, a=a, b=b)
>>> instance.cuda = True
>>> gpu_out = instance.myfunc(x, y, constant, a=a, b=b)

data = []
function

Decorator class defining universal function factory object from python kernel function, will create kernels, vectorized functions, jitted functions, stack functions, all on CPU / Parallel CPU / GPU.

Examples

>>> from funclp import Parameter, ufunc
>>> import numpy as np
...
>>> class MyClass() :
...     @ufunc(variables=['x', 'y'], data=['constant'], parameters=[Parameter('a', 1), Parameter('b', 0)])
...     def myfunc(x, y, constant, /, a, b) :
...         return a * x + b * y + constant
...     cuda = False
...
>>> instance = MyClass()
...
>>> x = np.arange(20).reshape((1, 20)) # Example of variables that can be broadcasted together
>>> y = np.arange(20).reshape((20, 1)) # Example of variables that can be broadcasted together
>>> constant = np.ones((5, 20, 20)) # Example of data with full shape
>>> a = np.arange(5) # Example of parameter vector
>>> b = 0.5 # Example of scalar use
>>> cpu_out = instance.myfunc(x, y, constant, a=a, b=b)
>>> instance.cuda = True
>>> gpu_out = instance.myfunc(x, y, constant, a=a, b=b)

property gpu_d_amp
property gpu_d_k
property gpu_d_mu
property gpu_d_offset
property gpu_function
property gpukernel_d_amp
property gpukernel_d_k
property gpukernel_d_mu
property gpukernel_d_offset
property gpukernel_function
property k
k0 = None
k_fit = False
k_max = np.float32(inf)
k_min = np.float32(-inf)
property mu
static mu0(res, *vars)
mu_fit = True
mu_max = np.float32(inf)
mu_min = np.float32(-inf)
property offset
static offset0(res, *vars)
offset_fit = True
offset_max = np.float32(inf)
offset_min = np.float32(-inf)
property parameters
python_d_amp(mu, amp, offset, k=3, t=None, coeffs=None)
python_d_k(mu, amp, offset, k, t, coeffs)
python_d_mu(mu, amp, offset, k=3, t=None, coeffs=None)
python_d_offset(mu, amp, offset, k=3, t=None, coeffs=None)
python_function(mu=0.0, amp=1.0, offset=0.0, k=3, t=None, coeffs=None)
property t
variables = ['x']