Skip to main content

Surface roughness calculation with Python

Project description

surface-roughness

Surface roughness is a library that processes 3D surface STL data and produces oriented roughness metrics.

Citation

If you wish to use this work, please cite this paper according to CITATION.cff.

Installation

Installation is completed by

pip install surface-roughness

Usage

Roughness mapping

from surface_roughness import Surface, SampleWindow, roughness_map

# Load Surface STL File into Python
surface = Surface(path="example_surface.stl")

# Specify SampleWindow parameters
w = SampleWindow(is_circle=True,radius=2) # in units of STL mesh

# Generate roughness map object based on method presented in Magsipoc & Grasselli (2023) with parameters
map = roughness_map(
    surface,        # surface object required to interact with library
    'delta_t',      # Method for analyzing roughness
    w,              # SampleWindow object
    0.5,            # Distance between windows in mesh units
    1               # Number of vertices for mesh facet to be included in window sampling
    )

# Start subsampling process
map.sample()

# Evaluate roughness of subsamples
map.evaluate()

# Analyze directional roughness statistics
map.analyze_directional_roughness('delta_t')
map.analyze_directional_roughness('delta*_t')

# Pickle map to save analysis (optional)
with ('example_surface_r2_s0.5.pickle','wb') as f:
    pickle.dump(map, f)

# Save data to VTK for visualization
map.to_vtk('example_surface_r2_s0.5','delta_t')

Directional Roughness

from surface_roughness import Surface
import matplotlib.pyplot as plt     # For plotting graphs

surface = Surface('example_surface.stl')

# Calculate roughness from Tatone and Grasselli (2009) doi: 10.1063/1.3266964
surface.evaluate_thetamax_cp1()
az = surface.thetamax_cp1('az') # Get azimuth correlating with analysis
thetamaxcp1_roughness = surface.thetamax_cp1('thetamax_cp1')

# Plot surface roughness
plt.figure()
plt.polar(az,thetamaxcp1_roughness,label=r'$\theta^*_{max}/(C+1)$')
plt.legend()

# Calculate roughness from Babanouri and Karami Nasab (2017) doi: 10.1007/s00603-016-1139-1
surface.evaluate_delta_t()
az_t = s.delta_t('az')
delta_t = s.delta_t('delta_t')

az_a = s.delta_a('az')
delta_a = s.delta_a('delta_a')

az_n = s.delta_n('az')
delta_n = s.delta_n('delta_n')


plt.figure()
plt.polar(az_t,delta_t,label='$\Delta_T$')
plt.polar(az_a,delta_a,label='$\Delta_A$')
plt.polar(az_n,delta_n,label='$\Delta_N$')
plt.legend()

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

surface_roughness-0.0.3.tar.gz (37.7 kB view details)

Uploaded Source

Built Distributions

surface_roughness-0.0.3-cp312-cp312-win_amd64.whl (239.3 kB view details)

Uploaded CPython 3.12 Windows x86-64

surface_roughness-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (383.1 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

surface_roughness-0.0.3-cp312-cp312-macosx_11_0_arm64.whl (263.2 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

surface_roughness-0.0.3-cp312-cp312-macosx_10_9_x86_64.whl (289.8 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

surface_roughness-0.0.3-cp311-cp311-win_amd64.whl (239.2 kB view details)

Uploaded CPython 3.11 Windows x86-64

surface_roughness-0.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (382.9 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

surface_roughness-0.0.3-cp311-cp311-macosx_11_0_arm64.whl (262.6 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

surface_roughness-0.0.3-cp311-cp311-macosx_10_9_x86_64.whl (289.4 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

surface_roughness-0.0.3-cp310-cp310-win_amd64.whl (238.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

surface_roughness-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (382.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

surface_roughness-0.0.3-cp310-cp310-macosx_11_0_arm64.whl (261.4 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

surface_roughness-0.0.3-cp310-cp310-macosx_10_9_x86_64.whl (287.9 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

surface_roughness-0.0.3-cp39-cp39-win_amd64.whl (236.7 kB view details)

Uploaded CPython 3.9 Windows x86-64

surface_roughness-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (382.3 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

surface_roughness-0.0.3-cp39-cp39-macosx_11_0_arm64.whl (261.5 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

surface_roughness-0.0.3-cp39-cp39-macosx_10_9_x86_64.whl (287.9 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file surface_roughness-0.0.3.tar.gz.

File metadata

  • Download URL: surface_roughness-0.0.3.tar.gz
  • Upload date:
  • Size: 37.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for surface_roughness-0.0.3.tar.gz
Algorithm Hash digest
SHA256 68d3fa00fdb1987a046263c5c9e9e8dbe59c50b9c75cb9877d2ab5992e2052c3
MD5 20038ed0c2347ee68ed1e1b338ce075c
BLAKE2b-256 42f60e9523094983c6ab0fa4b2668fdb341c38ab5fd3decac40c34d4a2f63672

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c1176473473ae16a0a3240279e247024b1d0fd332b5d7e868089e5750d1dd0b8
MD5 e32da262e930b38145dfa0add59223fc
BLAKE2b-256 b262119ec7a8cd7f80b3cb207a453a5f3ee4de45a2b6f2d356abefe3ae72ef81

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 01d38d2747f694fa2656eb8f6efa889ef2c8476cbec6d3769bcead5355740355
MD5 aa761210bfd9beb5b2c039a4f3ae49c5
BLAKE2b-256 f20fd6aa6679fff0dedcc0930ce608e9f83b35b1a311675a14067e288d29f32f

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee1be8143c1f4f710d00d13680677217988abb29526e6a0da4701dd9234e980a
MD5 ac62b90889af7ad1d8654c8f17b65aba
BLAKE2b-256 82d155b4c7743cf79bdc49d8a0fbacb6d166091bad3ec14b744f1e5946050b76

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1b383a8360b96453b79b3021ca478a1aa6f7a0587994515eea34e187c15999b2
MD5 61a5b1f178148950dc24a83dae7e2d65
BLAKE2b-256 67465f0f914b87341f362e223d249432dc6460dfc9877b2c1f5c58519cc56978

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 128dccfc837c0ea81c146a55268baac11ff76798e6fb610e45c23369fdecf18a
MD5 a4578135068ca93317e997879ffdcb52
BLAKE2b-256 45b9a674c655eee0061fe411e15e56521db8f2f51ca364cfe383a3857421af23

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 89747959b5c611a6625fdee7c9aaeff6e3e6ab2a073680572cc6889f078c3e9b
MD5 1cda7f66f1b4bb441ab229567fdb7aa5
BLAKE2b-256 a5fd78ead0ee646f00ccdfaf86b75793fe8042684e17a73578b5e8f4232a3281

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e3d1f2712bb19f70f88911fd4d892f2b72f6d9aa88f1239a7b1eeaa9b5df010b
MD5 814d3625b923d943a178d54ac659fedc
BLAKE2b-256 ec5e112141ec6dc4604e144a967e76a57e22df612fddbc4248ee3ebefd4a0ea3

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 efe2ee0b490811b21762ec5dd7e54f3146281c266d42140f5c08b40acd680b69
MD5 54300c1fc1e162aa78f449e29e692ec9
BLAKE2b-256 2341001fe81e8b590f161be0af67eade19bedcec28b8a8a45700c11c0c09781e

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 01077b0126bae0c5d50741c134c16de0fed8ddfe9298e39377e1ac026b2ae84e
MD5 7e49c9963db54dce415f1c78bbfe7e40
BLAKE2b-256 dee83dbc403aa9138d9dc10e6106e6d1f5d5e7b13332f49ed5f194b0763879c8

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 092b2364fef54edcf741829861e779eb78a4457f7f1ca2a5cb194590f73443bd
MD5 09f534793a7d2494df5349022791e70b
BLAKE2b-256 062acc9d2657166093d15b995d64150fb2d991dccbd5623f1bd89895209f4594

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9fc750d9bf7d004cbb7ee9ad8d08d99e4b01904d3d68268e3799c758852967cf
MD5 85f512d676a5dcc303f2e982a7d6aad1
BLAKE2b-256 486760e0f009c9fa72f8b2cecabb4099d5bde368f139d4e26eaf59a8f86a6713

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 269ba1054b20b32bd4df68bcff3ee6a150a7c15b2465bc58565032e1c7d5d126
MD5 2fe0f3f7fd7c5dc6e17fb32d83eb15cb
BLAKE2b-256 731e21aae2941b842789f5f3cb07a8a198617c90976f9bbbe3227ea4b0c11ede

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c0189a5069e807938e917a7b3449af12366f44ad7094dec82a399c49b8fa4c7e
MD5 a94aea894a364dcb5070e4334a6ebcfd
BLAKE2b-256 3b43ae9e746e693f0eaf5128c99bf312413eee6ed902b168e7a961cc32c78a78

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2086183b10fba637234969ee9351fcfd53bd03c0d67a180c8099f1a80e36ebf
MD5 cf7185ef014a77f382ada577b87e4883
BLAKE2b-256 d7750728739c353d0fb5411f1ae31e46d4814fd030e2829a38f69e81cecf7785

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d483dba6bd89a3973c2a2847b87185cbf11397f148224faf8e677e0958f0080
MD5 2749afbf674c61370587d886c095cd19
BLAKE2b-256 87a16b0691e85153986b9c91fac83e236dc0113d64299739919986c383a96fb9

See more details on using hashes here.

File details

Details for the file surface_roughness-0.0.3-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for surface_roughness-0.0.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d3255f45d950b14863a87bad483cb8f9143efe9db23ff988c3145b23eafba075
MD5 7ce565783b90b40d2e3a084f8ca1931e
BLAKE2b-256 0935f69bd805d616bdf7fa9725c223ddec8fabc9ae23f68ad4d841f946eba8d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page