Height correlation#
Structure factor#
The structure factor is defined as:
\[S(\vec{q}) = \langle \hat{u}(\vec{q}) \hat{u}(\vec{q}) \rangle\]
where \(\vec{q}\) is the angular frequency. It can be used to compute the roughness exponent \(\zeta\):
\[S(|q|) \sim |q|^{-(d + 2 \zeta)}\]
where \(d\) is the dimension of the image. An example is shown below.
Height-height correlation#
The height-height correlation corresponds to the following:
\[\mathcal{P} (\Delta \vec{x}) =
\sqrt{ \sum_{i} \; \left(
z (\vec{x}_i + \Delta \vec{x}) -
z (\vec{x}_i)
\right)^2 }\]
Example#
Note
Like for the 2-point correlation, a mask can be used. Similarly, the average can be extended to that of an ensemble of images.
import GooseEYE
import numpy as np
L = 2.0 * np.pi
N = 1000
h = L / N
x = np.linspace(0, L, N)
y1 = np.sin(x)
y2 = np.sin(2.0 * x)
hh1 = GooseEYE.heightheight(roi=[200], f=y1, periodic=True)
hh2 = GooseEYE.heightheight(roi=[200], f=y2, periodic=True)
dx = GooseEYE.distance(roi=[200], h=[h], dim=0)
#include <GooseEYE/GooseEYE.h>
#include <highfive/H5Easy.hpp>
#define MYASSERT(expr) MYASSERT_IMPL(expr, __FILE__, __LINE__)
#define MYASSERT_IMPL(expr, file, line) \
if (!(expr)) { \
throw std::runtime_error( \
std::string(file) + ':' + std::to_string(line) + \
": assertion failed (" #expr ") \n\t"); \
}
int main()
{
double L = 2.0 * M_PI;
size_t N = 1000;
double h = L / (double)N;
xt::xarray<double> x = xt::linspace<double>(0, L, N);
xt::xarray<double> y1 = xt::sin(x);
xt::xarray<double> y2 = xt::sin(2. * x);
std::vector<size_t> roi = {200};
std::vector<double> hv = {h};
xt::xarray<double> hh1 = GooseEYE::heightheight(roi, y1, true);
xt::xarray<double> hh2 = GooseEYE::heightheight(roi, y2, true);
xt::xarray<double> dx = GooseEYE::distance(roi, hv, 0);
// check against previous versions
H5Easy::File data("heightheight.h5", H5Easy::File::ReadOnly);
MYASSERT(xt::allclose(y1, H5Easy::load<decltype(y1)>(data, "y1")));
MYASSERT(xt::allclose(y2, H5Easy::load<decltype(y2)>(data, "y2")));
MYASSERT(xt::allclose(hh1, H5Easy::load<decltype(hh1)>(data, "hh1")));
MYASSERT(xt::allclose(hh2, H5Easy::load<decltype(hh2)>(data, "hh2")));
MYASSERT(xt::allclose(dx, H5Easy::load<decltype(dx)>(data, "dx")));
return 0;
}