ContactEngineering / SurfaceTopography

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

Wrong name of method or method missing for RMS curvature #95

Closed mcrot closed 3 years ago

mcrot commented 3 years ago

When loading uniform line scan data, e.g.

0 1
1 1
2 2
3 1
4 1
5 1

the result is an instance of type SurfaceTopography.UniformLineScanAndTopography.UniformLineScan. It has a method rms_curvature_from_area, but not rms_curvature_from_profile:

In [16]: r=open_topography("uniform_line_scan.asc")

In [17]: r.topography()
Out[17]: <SurfaceTopography.UniformLineScanAndTopography.UniformLineScan at 0x7f43b964f970>

In [18]: t=r.topography()

In [19]: t.dim
Out[19]: 1

In [20]: t.rms_curvature_from_area()
Out[20]: 1.224744871391589

In [22]: t.rms_curvature_from_profile()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-22-1cf6dcc849db> in <module>
----> 1 t.rms_curvature_from_profile()

~/work/imtek/topobank/venv/lib/python3.8/site-packages/SurfaceTopography/HeightContainer.py in __getattr__(self, name)
     79             return func
     80         else:
---> 81             raise AttributeError(
     82                 "Unkown attribute '{}' and no analysis or pipeline function "
     83                 "of this name registered (class {}). Available functions: {}"

AttributeError: Unkown attribute 'rms_curvature_from_profile' and no analysis or pipeline function of this name registered (class UniformLineScan). Available functions: mean, min, max, scale, detrend, transpose, translate, to_matrix, to_netcdf, to_nonuniform, make_fft, bandwidth, derivative, fourier_derivative, domain_decompose, plot, fill_undefined_data, mirror_stitch, interpolate_bicubic, interpolate_fourier, window, filter, shortcut, longcut, autocorrelation_from_profile, autocorrelation_from_area, power_spectrum_from_profile, power_spectrum_from_area, rms_height_from_profile, rms_height_from_area, rms_gradient, rms_slope_from_profile, rms_laplacian, rms_curvature_from_area, checkerboard_detrend, variable_bandwidth, scale_dependent_curvature_1D, scale_dependent_curvature_2D, scale_dependent_slope_1D, scale_dependent_slope_2D

In TopoBank, I have the code:

rms_curv = topography.rms_curvature_from_area() if topography.dim == 2 else topography.rms_curvature_from_profile()

This fails for uniform line scans. See #92 .

Is this the wrong method or method name or is the correct method missing?

mcrot commented 3 years ago

Fixed by #100 .