funclp.Spline2D module
- class funclp.Spline2D(model2interp=None, x2interp=None, y2interp=None, kx=3, ky=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_kx
- property cpu_d_ky
- property cpu_d_mux
- property cpu_d_muy
- property cpu_d_offset
- property cpu_function
- property cpukernel_d_amp
- property cpukernel_d_kx
- property cpukernel_d_ky
- property cpukernel_d_mux
- property cpukernel_d_muy
- 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_kx
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_ky
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_mux
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_muy
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_kx
- property gpu_d_ky
- property gpu_d_mux
- property gpu_d_muy
- property gpu_d_offset
- property gpu_function
- property gpukernel_d_amp
- property gpukernel_d_kx
- property gpukernel_d_ky
- property gpukernel_d_mux
- property gpukernel_d_muy
- property gpukernel_d_offset
- property gpukernel_function
- property kx
- kx0 = None
- kx_fit = False
- kx_max = np.float32(inf)
- kx_min = np.float32(-inf)
- property ky
- ky0 = None
- ky_fit = False
- ky_max = np.float32(inf)
- ky_min = np.float32(-inf)
- property mux
- static mux0(res, *vars)
- mux_fit = True
- mux_max = np.float32(inf)
- mux_min = np.float32(-inf)
- property muy
- static muy0(res, *vars)
- muy_fit = True
- muy_max = np.float32(inf)
- muy_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(y, /, mux, muy, amp, offset, kx, ky, tx=None, ty=None, coeffs=None)
- python_d_kx(y, /, mux, muy, amp, offset, kx, ky, tx, ty, coeffs)
- python_d_ky(y, /, mux, muy, amp, offset, kx, ky, tx, ty, coeffs)
- python_d_mux(y, /, mux, muy, amp, offset, kx, ky, tx=None, ty=None, coeffs=None)
- python_d_muy(y, /, mux, muy, amp, offset, kx, ky, tx=None, ty=None, coeffs=None)
- python_d_offset(y, /, mux, muy, amp, offset, kx, ky, tx=None, ty=None, coeffs=None)
- python_function(y, /, mux=0.0, muy=0.0, amp=1.0, offset=0.0, kx=3, ky=3, tx=None, ty=None, coeffs=None)
- property tx
- property ty
- variables = ['x', 'y']