# cheby - Freeform - Chebyshev model¶

 ChebyVF Material in a solvent FreeformCheby A freeform section of the sample modeled with Chebyshev polynomials.

Freeform modeling with Chebyshev polynomials

Chebyshev polynomials $$T_k$$ form a basis set for functions over $$[-1,1]$$. The truncated interpolating polynomial $$P_n$$ is a weighted sum of Chebyshev polynomials up to degree $$n$$:

$f(x) \approx P_n(x) = \sum_{k=0}^n c_i T_k(x)$

The interpolating polynomial exactly matches $$f(x)$$ at the chebyshev nodes $$z_k$$ and is near the optimal polynomial approximation to $$f$$ of degree $$n$$ under the maximum norm. For well behaved functions, the coefficients $$c_k$$ decrease rapidly, and furthermore are independent of the degree $$n$$ of the polynomial.

FreeformCheby models the scattering length density profile of the material within a layer, and ChebyVF models the volume fraction profile of two materials mixed in the layer.

The models can either be defined directly in terms of the Chebyshev coefficients $$c_k$$ with method = ‘direct’, or in terms of control points $$(z_k, f(z_k))$$ at the Chebyshev nodes cheby_points() with method = ‘interp’. Bounds on the parameters are easier to control using ‘interp’, but the function may oscillate wildly outside the bounds. Bounds on the oscillation are easier to control using ‘direct’, but the shape of the profile is difficult to control.

class refl1d.cheby.ChebyVF(thickness=0, interface=0, material=None, solvent=None, vf=None, name='ChebyVF', method='interp')[source]

Material in a solvent

Parameters: thickness : float | Angstrom the thickness of the solvent layer interface : float | Angstrom the rms roughness of the solvent surface material : Material the material of interest solvent : Material the solvent or vacuum vf : [float] the control points for volume fraction method = ‘interp’ : string | ‘direct’ or ‘interp’ freeform profile method

method is ‘direct’ if the vf values refer to chebyshev polynomial coefficients or ‘interp’ if vf values refer to control points located at $$z_k$$.

The control point $$k$$ is located at $$z_k \in [0,L]$$ for layer thickness $$L$$, as returned by cheby_points() called with n=len(vf) and range=$$[0,L]$$.

The materials can either use the scattering length density directly, such as PDMS = SLD(0.063, 0.00006) or they can use chemical composition and material density such as PDMS=Material(“C2H6OSi”,density=0.965).

These parameters combine in the following profile formula:

sld(z) = material.sld * profile(z) + solvent.sld * (1 - profile(z))

constraints()

Constraints

find(z)

Find the layer at depth z.

Returns layer, start, end

interface = None
ismagnetic
layer_parameters()
magnetism
parameters()[source]
penalty()

Return a penalty value associated with the layer. This should be zero if the parameters are valid, and increasing as the parameters become more invalid. For example, if total volume fraction exceeds unity, then the penalty would be the amount by which it exceeds unity, or if z values must be sorted, then penalty would be the amount by which they are unsorted.

Note that penalties are handled separately from any probability of seeing a combination of layer parameters; the final solution to the problem should not include any penalized points.

render(probe, slabs)[source]
thickness = None
class refl1d.cheby.FreeformCheby(thickness=0, interface=0, rho=[], irho=[], name='Cheby', method='interp')[source]

A freeform section of the sample modeled with Chebyshev polynomials.

sld (rho) and imaginary sld (irho) can be modeled with a separate polynomial orders.

constraints()

Constraints

find(z)

Find the layer at depth z.

Returns layer, start, end

interface = None
ismagnetic
layer_parameters()
magnetism
parameters()[source]

Return parameters used to define layer

penalty()

Return a penalty value associated with the layer. This should be zero if the parameters are valid, and increasing as the parameters become more invalid. For example, if total volume fraction exceeds unity, then the penalty would be the amount by which it exceeds unity, or if z values must be sorted, then penalty would be the amount by which they are unsorted.

Note that penalties are handled separately from any probability of seeing a combination of layer parameters; the final solution to the problem should not include any penalized points.

render(probe, slabs)[source]

Render slabs for use with the given probe

thickness = None