get_hilbert_curve

eyefeatures.features.feature_maps.get_hilbert_curve(data, x, y, scale=True, p=4)[source]

Map scanpath to points on 1D Hilbert curve.

Parameters:
  • data (DataFrame) – input Dataframe with fixations.

  • x (str) – X coordinate column name.

  • y (str) – Y coordinate column name.

  • scale (bool) – whether to scale the scanpath to [0, 1] before mapping to Hilbert curve. If false, then

  • p (int) – order of Hilbert curve, unit square is divided into (2^p)x(2^p) smaller squares. Higher value of p indicates better locality preservation.

Returns:

scanpath mapping to 1D Hilbert curve.

Return type:

ndarray

Hilbert Curve is a way to describe 2D space using 1D object. It provides a bijection (unique mapping) of 2D plane on a 1D line, constructed as a limit of piecewise linear curves, \(n\)-th curve having a length of \(2^n - \frac{1}{2^n}\). On practice, we fix some \(p\) and consider \(p\)-th Hilbert Curve and map each \((x,y)\) point to the closest point on it, where higher \(p\) means that more space is filled with a curve which results in more accurate encoding.

Reference

Hilbert Curve on Wiki.

Hilbert Curve encoding algorithm.