# reflectivity - Reflectivity¶

 reflectivity Calculate reflectivity $$|r(k_z)|^2$$ from slab model. reflectivity_amplitude Calculate reflectivity amplitude $$r(k_z)$$ from slab model. magnetic_reflectivity Magnetic reflectivity for slab models. magnetic_amplitude Returns the complex magnetic reflectivity waveform. unpolarized_magnetic Returns the average of magnetic reflectivity for all cross-sections. convolve Apply x-dependent gaussian resolution to the theory.

Basic reflectometry calculations

Slab model reflectivity calculator with optional absorption and roughness. The function reflectivity_amplitude returns the complex waveform. Slab model with supporting magnetic scattering. The function magnetic_reflectivity returns the complex reflection for the four spin polarization cross sections [++, +-, -+, –]. The function unpolarized_magnetic returns the expected magnitude for a measurement of the magnetic scattering using an unpolarized beam.

refl1d.reflectivity.reflectivity(*args, **kw)[source]

Calculate reflectivity $$|r(k_z)|^2$$ from slab model.

:Parameters :
depth : float[N] | Å
Thickness of the individual layers (incident and substrate depths are ignored)
sigma : float OR float[N-1] | Å
Interface roughness between the current layer and the next. The final layer is ignored. This may be a scalar for fixed roughness on every layer, or None if there is no roughness.
rho, irho : float[N] OR float[N, K] | 10-6-2
Real and imaginary scattering length density. Use multiple columns when you have kz-dependent scattering length densities, and set rho_offset to select the appropriate one. Data should be stored in column order.
kz : float[M] | Å-1
Points at which to evaluate the reflectivity
rho_index : integer[M]
rho and irho columns to use for the various kz.
Returns: R | float[M] Reflectivity magnitude.

This function does not compute any instrument resolution corrections.

refl1d.reflectivity.reflectivity_amplitude(kz=None, depth=None, rho=None, irho=0, sigma=0, rho_index=None)[source]

Calculate reflectivity amplitude $$r(k_z)$$ from slab model.

:Parameters :
depth : float[N] | Å
Thickness of the individual layers (incident and substrate depths are ignored)
sigma = 0 : float OR float[N-1] | Å
Interface roughness between the current layer and the next. The final layer is ignored. This may be a scalar for fixed roughness on every layer, or None if there is no roughness.
rho, irho = 0: float[N] OR float[N, K] | 10-6-2
Real and imaginary scattering length density. Use multiple columns when you have kz-dependent scattering length densities, and set rho_index to select amongst them. Data should be stored in column order.
kz : float[M] | Å-1
Points at which to evaluate the reflectivity
rho_index = 0 : integer[M]
rho and irho columns to use for the various kz.
Returns: r | complex[M] Complex reflectivity waveform.

This function does not compute any instrument resolution corrections.

refl1d.reflectivity.magnetic_reflectivity(*args, **kw)[source]

Magnetic reflectivity for slab models.

Returns the expected values for the four polarization cross sections (++, +-, -+, –). Return reflectivity R^2 from slab model with sharp interfaces. returns reflectivities.

The parameters are as follows:

kz (Å-1)
points at which to evaluate the reflectivity
depth (Å)
thickness of the individual layers (incident and substrate depths are ignored)
rho (10-6-2)
Scattering length density.
irho (10-6-2)
absorption. Defaults to 0.
rho_m (microNb)
Magnetic scattering length density correction.
theta_m (degrees)
Angle of the magnetism within the layer.
sigma (Å)
Interface roughness between the current layer and the next. The final layer is ignored. This may be a scalar for fixed roughness on every layer, or None if there is no roughness.
wavelength (Å)
Incident wavelength (only affects absorption). May be a vector. Defaults to 1.
Aguide (degrees)
Angle of the guide field; -90 is the usual case

This function does not compute any instrument resolution corrections. Interface diffusion, if present, uses the Nevot-Croce approximation.

Use magnetic_amplitude to return the complex waveform.

refl1d.reflectivity.magnetic_amplitude(kz, depth, rho, irho=0, rhoM=0, thetaM=0, sigma=0, Aguide=-90, H=0, rho_index=None)[source]

Returns the complex magnetic reflectivity waveform.

See magnetic_reflectivity for details.

refl1d.reflectivity.unpolarized_magnetic(*args, **kw)[source]

Returns the average of magnetic reflectivity for all cross-sections.

See magnetic_reflectivity for details.

refl1d.reflectivity.convolve(xi, yi, x, dx, resolution='normal')[source]

Apply x-dependent gaussian resolution to the theory.

Returns convolution y[k] of width dx[k] at points x[k].

The theory function is a piece-wise linear spline which does not need to be uniformly sampled. The theory calculation points xi should be dense enough to capture the “wiggle” in the theory function, and should extend beyond the ends of the data measurement points x. Convolution at the tails is truncated and normalized to area of overlap between the resolution function in case the theory does not extend far enough.

resolution is ‘normal’ (default) or ‘uniform’. Note that the uniform distribution uses the $$1-\sigma$$ equivalent distribution width which is $$1/\sqrt{3}$$ times the width of the rectangle.