sample.cheby - Freeform - Chebyshev model¶
Material in a solvent |
|
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\):
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.sample.cheby.ChebyVF(thickness=0, interface=0, material=None, solvent=None, vf=None, name='ChebyVF', method='interp')[source]¶
Bases:
Layer
Material in a solvent
- Parameters:
- thicknessfloat | Angstrom
the thickness of the solvent layer
- interfacefloat | Angstrom
the rms roughness of the solvent surface
- materialMaterial
the material of interest
- solventMaterial
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: Parameter | None = None¶
- property ismagnetic¶
- layer_parameters()¶
- magnetism: BaseMagnetism | None = None¶
- name: str¶
- parameters()[source]¶
Returns a dictionary of parameters specific to the layer. These will be added to the dictionary containing interface, thickness and magnetism parameters.
- 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.
- thickness: Parameter¶
- class refl1d.sample.cheby.FreeformCheby(thickness=0, interface=0, rho=(), irho=(), name='Cheby', method='interp')[source]¶
Bases:
Layer
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: Parameter | None = None¶
- property ismagnetic¶
- layer_parameters()¶
- magnetism: BaseMagnetism | None = None¶
- name: str¶
- 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.
- thickness: Parameter¶