ContactEngineering / SurfaceTopography

Read and analyze surface topographies
https://contactengineering.github.io/SurfaceTopography/
MIT License
17 stars 10 forks source link

Reliability cutoff introduces shift in the length scale in the scale dependent curvature from profile #292

Open sannant opened 1 year ago

sannant commented 1 year ago

t_artefacted.scale_dependent_curvature_from_profile(reliable=False, resampling_method=None)[0] Out[4]: array([2.44140625e-04, 4.88281250e-04, 7.32421875e-04, ..., 2.49267578e-01, 2.49511719e-01, 2.49755859e-01]) t_artefacted.scale_dependent_curvature_from_profile(reliable=True, resampling_method=None)[0] Out[5]: array([0.01025391, 0.01049805, 0.01074219, ..., 0.25439453, 0.25463867, 0.25488281])

t.scale_dependent_curvature_from_profile(resampling_method=None)[0] Out[8]: array([2.44140625e-04, 4.88281250e-04, 7.32421875e-04, ..., 2.49267578e-01, 2.49511719e-01, 2.49755859e-01])

sannant commented 1 year ago

SDRP curvature from profile

image

zoom into the large scale end of the SDRP curvature from profile

image

sannant commented 1 year ago

code used to generate these plots:

import os
import pytest
import unittest
import numpy as np

from NuMPI import MPI
from muFFT import FFT
import ContactMechanics
from SurfaceTopography import Topography, NonuniformLineScan, UniformLineScan, read_topography
from SurfaceTopography.Generation import fourier_synthesis

unit= "m"
nx = 4096
sx = 1
dx = sx / nx

t = fourier_synthesis((nx,), (sx,), hurst=0.8, rms_slope=0.1, short_cutoff=4 * (sx / nx),
                      long_cutoff=sx / 4, unit=unit).detrend(detrend_mode="center")

R = 1/ t.rms_curvature_from_profile() * 10

t_artefacted = t.scan_with_rigid_sphere(R)

import matplotlib.pyplot as plt
fig, ax = plt.subplots()

ax.plot(*t.positions_and_heights())
ax.plot(*t_artefacted.positions_and_heights())

import matplotlib.pyplot as plt
fig, ax = plt.subplots()

def func(dx, dy=None):
    return -np.min(dx)

l, c = t.scale_dependent_statistical_property(
        n=2, func=func, reliable=True)
ax.loglog(l,c,  "+k",  label="original")
for reliable, color, label in [[False, "cyan", "scanned all"], [True, "k", "scann reliable"]]:
    l, c = t_artefacted.scale_dependent_statistical_property(
        n=2, func=func, reliable=reliable)
    ax.loglog(l,c,  ".", c=color, label=label)

ax.legend()

ax.axhline(1/R)

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.loglog(*t.power_spectrum_from_profile(resampling_method=None), "+k",label="original")
for reliable, color, label in [[False, "cyan", "scanned all"], [True, "k", "scann reliable"]]:
    ax.loglog(*t_artefacted.power_spectrum_from_profile(reliable=reliable, resampling_method=None), ".", c=color, label=label)
ax.legend()

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.loglog(*t.scale_dependent_curvature_from_profile(resampling_method=None), "+k",label="original")

for reliable, color, label in [[False, "cyan", "scanned all"], [True, "k", "scann reliable"]]:
    ax.loglog(*t_artefacted.scale_dependent_curvature_from_profile(reliable=reliable, resampling_method=None), ".", c=color, label=label)
ax.legend()

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.loglog(*t.autocorrelation_from_profile(resampling_method=None), "+k",label="original")

for reliable, color, label in [[False, "cyan", "scanned all"], [True, "k", "scann reliable"]]:
    ax.loglog(*t_artefacted.autocorrelation_from_profile(reliable=reliable, resampling_method=None), ".", c=color, label=label)
ax.legend()

hrms_r = [t.rms_slope_from_profile(), t.rms_slope_from_profile(), t.rms_curvature_from_profile()]
hrms_f, hrms_f_reliable = [
    [
        np.sqrt(t.integrate_psd_from_profile(fun, reliable=reliable)) for fun in [
            lambda qx: 1,
            lambda qx: np.abs((np.exp(1j * qx * dx) - 1) / dx) ** 2,
            lambda qx: np.abs((np.exp(1j * qx * dx) - 2 + np.exp(-1j * qx * dx)) / dx ** 2) ** 2
        ]
    ] for reliable in [False, True]
]