ContactEngineering / topobank-statistics

Plugin for TopoBank that provides statistical analysis functions
MIT License
2 stars 1 forks source link

Compute RMS-Gradient in RMS-values of 2D Topography #33

Open sannant opened 3 years ago

sannant commented 3 years ago

Currently, the webapp reports the rms_slopes in the x and y directions separately for 3D Topographies. I definitely agree that this is the best thing to do for AFM data.

For the sake of completeness it would be nice to also include the RMS gradient. The RMS gradient is Topography.rms_slope. Maybe would should actually rename this function rms_gradient

sannant commented 3 years ago

I noticed this because I wondered why the WebApp rms-slope of the contact-challenge surface was around 0.7 instead of 1.

The rms_gradient computed with Topography.rms_slope is indeed almost 1, as it should be.

mcrot commented 3 years ago

I think it should be easy to implement another RMS value using Topography.rms_slope.

Where did you see the value 0.7 instead of 1? Do you think, this is a bug?

sannant commented 3 years ago

image

I think 0.7 is correct

The rms_gradient is sqrt(mean(dh_dx**2 + dh_dy**2))

The rms-slope is sqrt(mean(dh_dx**2))

On a scan where the slope is 0 in the x direction (a kind of scratched surface), the rms-gradient equals the rms-slope.

But in general, the rms-gradient is higher.

mcrot commented 3 years ago

As I calculate the rms-slope like you have written, I wonder why I get 1 instead of 0.7.

Could this be related to the change of the API for derivations in SurfaceTopography version 0.92. As Lars writes in "https://github.com/ComputationalMechanics/SurfaceTopography/issues/60":

Derivative now excludes the boundary values for nonperiodic topographies

sannant commented 3 years ago

Hmm. The topography should be considered as periodic actually

sannant commented 3 years ago

Moment it is actually simpler then I thought. For an isotropic surface sqrt(mean(dh_dx2 + dh_dy2)) = sqrt(mean(dh_dx2) + mean(dh_dx2))) = sqrt(2) sqrt(mean(dh_dx**2))

0.7 * np.sqrt(2) = 0.98