sdfio 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sdfio-1.0.0/.gitignore +38 -0
- sdfio-1.0.0/.pre-commit-config.yaml +50 -0
- sdfio-1.0.0/LICENSE +21 -0
- sdfio-1.0.0/LICENSES/MIT.txt +18 -0
- sdfio-1.0.0/PKG-INFO +117 -0
- sdfio-1.0.0/README.md +86 -0
- sdfio-1.0.0/REUSE.toml +6 -0
- sdfio-1.0.0/docs/api.rst +11 -0
- sdfio-1.0.0/docs/conf.py +30 -0
- sdfio-1.0.0/docs/index.md +18 -0
- sdfio-1.0.0/pyproject.toml +114 -0
- sdfio-1.0.0/src/sdfio/__init__.py +64 -0
- sdfio-1.0.0/src/sdfio/__main__.py +12 -0
- sdfio-1.0.0/src/sdfio/_ascii.py +287 -0
- sdfio-1.0.0/src/sdfio/_binary.py +221 -0
- sdfio-1.0.0/src/sdfio/_numeric.py +35 -0
- sdfio-1.0.0/src/sdfio/cli.py +140 -0
- sdfio-1.0.0/src/sdfio/datatypes.py +251 -0
- sdfio-1.0.0/src/sdfio/exceptions.py +21 -0
- sdfio-1.0.0/src/sdfio/file.py +436 -0
- sdfio-1.0.0/src/sdfio/header.py +420 -0
- sdfio-1.0.0/src/sdfio/py.typed +0 -0
- sdfio-1.0.0/tests/test_ascii.py +352 -0
- sdfio-1.0.0/tests/test_binary.py +306 -0
- sdfio-1.0.0/tests/test_cli.py +278 -0
- sdfio-1.0.0/tests/test_datatypes.py +197 -0
- sdfio-1.0.0/tests/test_file.py +446 -0
- sdfio-1.0.0/tests/test_header.py +108 -0
- sdfio-1.0.0/tests/test_numeric.py +32 -0
sdfio-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Thomas Ascher <thomas.ascher@gmx.at>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
# Byte-compiled / optimized files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
build/
|
|
11
|
+
dist/
|
|
12
|
+
*.egg-info/
|
|
13
|
+
*.egg
|
|
14
|
+
.eggs/
|
|
15
|
+
MANIFEST
|
|
16
|
+
|
|
17
|
+
# Environments
|
|
18
|
+
.venv/
|
|
19
|
+
venv/
|
|
20
|
+
env/
|
|
21
|
+
.env
|
|
22
|
+
|
|
23
|
+
# Tooling caches
|
|
24
|
+
.pytest_cache/
|
|
25
|
+
.mypy_cache/
|
|
26
|
+
.dmypy.json
|
|
27
|
+
.ruff_cache/
|
|
28
|
+
.coverage
|
|
29
|
+
.coverage.*
|
|
30
|
+
coverage.xml
|
|
31
|
+
*.cover
|
|
32
|
+
htmlcov/
|
|
33
|
+
|
|
34
|
+
# Documentation build output
|
|
35
|
+
docs/_build/
|
|
36
|
+
|
|
37
|
+
# Packaging credentials
|
|
38
|
+
.pypirc
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Thomas Ascher <thomas.ascher@gmx.at>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
repos:
|
|
6
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
7
|
+
rev: v0.16.7
|
|
8
|
+
hooks:
|
|
9
|
+
- id: ruff-check
|
|
10
|
+
args: [--fix]
|
|
11
|
+
- id: ruff-format
|
|
12
|
+
|
|
13
|
+
- repo: https://github.com/abravalheri/validate-pyproject
|
|
14
|
+
rev: "0.26"
|
|
15
|
+
hooks:
|
|
16
|
+
- id: validate-pyproject
|
|
17
|
+
|
|
18
|
+
- repo: https://github.com/mgedmin/check-manifest
|
|
19
|
+
rev: "0.51"
|
|
20
|
+
hooks:
|
|
21
|
+
- id: check-manifest
|
|
22
|
+
|
|
23
|
+
- repo: local
|
|
24
|
+
hooks:
|
|
25
|
+
- id: mypy
|
|
26
|
+
name: mypy
|
|
27
|
+
entry: mypy
|
|
28
|
+
language: system
|
|
29
|
+
types: [python]
|
|
30
|
+
pass_filenames: false
|
|
31
|
+
|
|
32
|
+
- id: vulture
|
|
33
|
+
name: vulture
|
|
34
|
+
entry: vulture
|
|
35
|
+
language: system
|
|
36
|
+
types: [python]
|
|
37
|
+
pass_filenames: false
|
|
38
|
+
|
|
39
|
+
- id: bandit
|
|
40
|
+
name: bandit
|
|
41
|
+
entry: bandit -c pyproject.toml -r src
|
|
42
|
+
language: system
|
|
43
|
+
types: [python]
|
|
44
|
+
pass_filenames: false
|
|
45
|
+
|
|
46
|
+
- id: reuse
|
|
47
|
+
name: reuse lint
|
|
48
|
+
entry: reuse lint
|
|
49
|
+
language: system
|
|
50
|
+
pass_filenames: false
|
sdfio-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Thomas Ascher
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) <year> <copyright holders>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
6
|
+
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
12
|
+
portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
15
|
+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
16
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
18
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
sdfio-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sdfio
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Read and write ISO 25178-71 SDF surface data files
|
|
5
|
+
Project-URL: Homepage, https://github.com/aschet/sdfio
|
|
6
|
+
Project-URL: Documentation, https://aschet.github.io/sdfio/
|
|
7
|
+
Project-URL: Source, https://github.com/aschet/sdfio
|
|
8
|
+
Project-URL: Issues, https://github.com/aschet/sdfio/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/aschet/sdfio/releases
|
|
10
|
+
Author-email: Thomas Ascher <thomas.ascher@gmx.at>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: iso-25178,metrology,sdf,surface-texture
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.11
|
|
28
|
+
Requires-Dist: defusedxml>=0.7
|
|
29
|
+
Requires-Dist: numpy>=1.24
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# sdfio
|
|
33
|
+
|
|
34
|
+
[](https://github.com/aschet/sdfio/actions/workflows/ci.yml)
|
|
35
|
+
[](https://aschet.github.io/sdfio/)
|
|
36
|
+
|
|
37
|
+
<!-- docs-include-start -->
|
|
38
|
+
|
|
39
|
+
Read and write ISO 25178-71 Surface Data Files (`.sdf`) in Python.
|
|
40
|
+
|
|
41
|
+
SDF stores areal (or profile) surface topography measurements as a
|
|
42
|
+
rectangular grid of height values, in either a human-readable ASCII or a
|
|
43
|
+
compact binary format. It is used as a software measurement standard
|
|
44
|
+
(a "softgauge") to verify the software of surface texture measuring
|
|
45
|
+
instruments, and is also used more generally as a surface topography
|
|
46
|
+
interchange format.
|
|
47
|
+
|
|
48
|
+
Supported dialects: ISO-1.0, ISO-2.0, and BCR-1.0 (the
|
|
49
|
+
pre-standardization proposal this format is based on), without
|
|
50
|
+
compression or checksummed data areas. Vendor-specific extensions are not
|
|
51
|
+
supported.
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install sdfio
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import numpy as np
|
|
63
|
+
import sdfio
|
|
64
|
+
|
|
65
|
+
data = np.zeros((480, 640))
|
|
66
|
+
|
|
67
|
+
sdfio.write("surface.sdf", data, x_scale=1e-6, y_scale=1e-6, z_scale=1e-9)
|
|
68
|
+
|
|
69
|
+
sdf = sdfio.read("surface.sdf")
|
|
70
|
+
print(sdf.data.shape)
|
|
71
|
+
print(sdf.header)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`sdf.data` is a `(num_profiles, num_points)` array of height values in
|
|
75
|
+
metres, in the standard's right-handed coordinate system: y increases with
|
|
76
|
+
row index and x with column index (`sdfio.SdfFile.x_axis`/`y_axis` return
|
|
77
|
+
the coordinates, also in metres).
|
|
78
|
+
|
|
79
|
+
Non-measured or spurious points (the `BAD` marker in ASCII files, or the
|
|
80
|
+
data type's reserved sentinel value in binary files) are represented as
|
|
81
|
+
`NaN` in `sdf.data`, and `sdfio.write` writes `NaN` values back the same way.
|
|
82
|
+
|
|
83
|
+
## Command Line
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
sdfio info surface.sdf
|
|
87
|
+
sdfio convert -f ascii surface.sdf surface_ascii.sdf
|
|
88
|
+
sdfio convert -d ISO-1.0 -r surface_v2.sdf surface_v1.sdf
|
|
89
|
+
sdfio convert -t int16 surface.sdf surface_int16.sdf
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`convert` can change the ASCII/binary format (`-f`/`--format`), the SDF
|
|
93
|
+
dialect and version (`-d`/`--dialect`, e.g. `ISO-2.0` or `BCR-1.0`), and the
|
|
94
|
+
data area storage type (`-t`/`--type`) independently; any not given are kept
|
|
95
|
+
from the source file. Converting to a dialect whose trailer requirements the
|
|
96
|
+
source file doesn't meet fails unless `-r`/`--remove-trailer` is passed to
|
|
97
|
+
discard it. Run `sdfio convert --help` for details. The CLI is also runnable
|
|
98
|
+
as `python -m sdfio`.
|
|
99
|
+
|
|
100
|
+
## Development
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
python3 -m venv .venv # Windows: python -m venv .venv
|
|
104
|
+
source .venv/bin/activate # Windows (PowerShell): .venv\Scripts\Activate.ps1
|
|
105
|
+
pip install -e . --group dev
|
|
106
|
+
pre-commit install
|
|
107
|
+
pytest
|
|
108
|
+
pre-commit run --all-files
|
|
109
|
+
pip-audit
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## References
|
|
113
|
+
|
|
114
|
+
- ISO 25178-71:2026, *Geometrical product specifications (GPS) — Surface
|
|
115
|
+
texture: Areal — Part 71: SDF file format*
|
|
116
|
+
- K. J. Stout et al., *The Development of Methods for the Characterisation of
|
|
117
|
+
Roughness in Three Dimensions*, EUR 15178 EN, EC Brussels, 1993
|
sdfio-1.0.0/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# sdfio
|
|
2
|
+
|
|
3
|
+
[](https://github.com/aschet/sdfio/actions/workflows/ci.yml)
|
|
4
|
+
[](https://aschet.github.io/sdfio/)
|
|
5
|
+
|
|
6
|
+
<!-- docs-include-start -->
|
|
7
|
+
|
|
8
|
+
Read and write ISO 25178-71 Surface Data Files (`.sdf`) in Python.
|
|
9
|
+
|
|
10
|
+
SDF stores areal (or profile) surface topography measurements as a
|
|
11
|
+
rectangular grid of height values, in either a human-readable ASCII or a
|
|
12
|
+
compact binary format. It is used as a software measurement standard
|
|
13
|
+
(a "softgauge") to verify the software of surface texture measuring
|
|
14
|
+
instruments, and is also used more generally as a surface topography
|
|
15
|
+
interchange format.
|
|
16
|
+
|
|
17
|
+
Supported dialects: ISO-1.0, ISO-2.0, and BCR-1.0 (the
|
|
18
|
+
pre-standardization proposal this format is based on), without
|
|
19
|
+
compression or checksummed data areas. Vendor-specific extensions are not
|
|
20
|
+
supported.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install sdfio
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import numpy as np
|
|
32
|
+
import sdfio
|
|
33
|
+
|
|
34
|
+
data = np.zeros((480, 640))
|
|
35
|
+
|
|
36
|
+
sdfio.write("surface.sdf", data, x_scale=1e-6, y_scale=1e-6, z_scale=1e-9)
|
|
37
|
+
|
|
38
|
+
sdf = sdfio.read("surface.sdf")
|
|
39
|
+
print(sdf.data.shape)
|
|
40
|
+
print(sdf.header)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`sdf.data` is a `(num_profiles, num_points)` array of height values in
|
|
44
|
+
metres, in the standard's right-handed coordinate system: y increases with
|
|
45
|
+
row index and x with column index (`sdfio.SdfFile.x_axis`/`y_axis` return
|
|
46
|
+
the coordinates, also in metres).
|
|
47
|
+
|
|
48
|
+
Non-measured or spurious points (the `BAD` marker in ASCII files, or the
|
|
49
|
+
data type's reserved sentinel value in binary files) are represented as
|
|
50
|
+
`NaN` in `sdf.data`, and `sdfio.write` writes `NaN` values back the same way.
|
|
51
|
+
|
|
52
|
+
## Command Line
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
sdfio info surface.sdf
|
|
56
|
+
sdfio convert -f ascii surface.sdf surface_ascii.sdf
|
|
57
|
+
sdfio convert -d ISO-1.0 -r surface_v2.sdf surface_v1.sdf
|
|
58
|
+
sdfio convert -t int16 surface.sdf surface_int16.sdf
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`convert` can change the ASCII/binary format (`-f`/`--format`), the SDF
|
|
62
|
+
dialect and version (`-d`/`--dialect`, e.g. `ISO-2.0` or `BCR-1.0`), and the
|
|
63
|
+
data area storage type (`-t`/`--type`) independently; any not given are kept
|
|
64
|
+
from the source file. Converting to a dialect whose trailer requirements the
|
|
65
|
+
source file doesn't meet fails unless `-r`/`--remove-trailer` is passed to
|
|
66
|
+
discard it. Run `sdfio convert --help` for details. The CLI is also runnable
|
|
67
|
+
as `python -m sdfio`.
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
python3 -m venv .venv # Windows: python -m venv .venv
|
|
73
|
+
source .venv/bin/activate # Windows (PowerShell): .venv\Scripts\Activate.ps1
|
|
74
|
+
pip install -e . --group dev
|
|
75
|
+
pre-commit install
|
|
76
|
+
pytest
|
|
77
|
+
pre-commit run --all-files
|
|
78
|
+
pip-audit
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## References
|
|
82
|
+
|
|
83
|
+
- ISO 25178-71:2026, *Geometrical product specifications (GPS) — Surface
|
|
84
|
+
texture: Areal — Part 71: SDF file format*
|
|
85
|
+
- K. J. Stout et al., *The Development of Methods for the Characterisation of
|
|
86
|
+
Roughness in Three Dimensions*, EUR 15178 EN, EC Brussels, 1993
|
sdfio-1.0.0/REUSE.toml
ADDED
sdfio-1.0.0/docs/api.rst
ADDED
sdfio-1.0.0/docs/conf.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Thomas Ascher <thomas.ascher@gmx.at>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
"""Sphinx configuration for the sdfio documentation."""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import sdfio
|
|
10
|
+
|
|
11
|
+
project = "sdfio"
|
|
12
|
+
copyright = "2026, Thomas Ascher"
|
|
13
|
+
author = "Thomas Ascher"
|
|
14
|
+
release = sdfio.__version__
|
|
15
|
+
|
|
16
|
+
extensions = [
|
|
17
|
+
"sphinx.ext.autodoc",
|
|
18
|
+
"sphinx.ext.intersphinx",
|
|
19
|
+
"myst_parser",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
autodoc_member_order = "bysource"
|
|
23
|
+
autodoc_default_options = {"members": True, "imported-members": True}
|
|
24
|
+
|
|
25
|
+
intersphinx_mapping = {
|
|
26
|
+
"python": ("https://docs.python.org/3", None),
|
|
27
|
+
"numpy": ("https://numpy.org/doc/stable/", None),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
html_theme = "furo"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: 2026 Thomas Ascher <thomas.ascher@gmx.at>
|
|
3
|
+
|
|
4
|
+
SPDX-License-Identifier: MIT
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
# sdfio
|
|
8
|
+
|
|
9
|
+
```{include} ../README.md
|
|
10
|
+
:relative-images:
|
|
11
|
+
:start-after: <!-- docs-include-start -->
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```{toctree}
|
|
15
|
+
:hidden:
|
|
16
|
+
|
|
17
|
+
api
|
|
18
|
+
```
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Thomas Ascher <thomas.ascher@gmx.at>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
[build-system]
|
|
6
|
+
requires = ["hatchling>=1.24"]
|
|
7
|
+
build-backend = "hatchling.build"
|
|
8
|
+
|
|
9
|
+
[project]
|
|
10
|
+
name = "sdfio"
|
|
11
|
+
dynamic = ["version"]
|
|
12
|
+
description = "Read and write ISO 25178-71 SDF surface data files"
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
requires-python = ">=3.11"
|
|
15
|
+
license = "MIT"
|
|
16
|
+
license-files = ["LICENSE"]
|
|
17
|
+
authors = [{ name = "Thomas Ascher", email = "thomas.ascher@gmx.at" }]
|
|
18
|
+
keywords = ["sdf", "iso-25178", "surface-texture", "metrology"]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 5 - Production/Stable",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Intended Audience :: Science/Research",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Programming Language :: Python",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
"Programming Language :: Python :: 3.14",
|
|
31
|
+
"Topic :: Scientific/Engineering",
|
|
32
|
+
"Typing :: Typed",
|
|
33
|
+
]
|
|
34
|
+
dependencies = ["defusedxml>=0.7", "numpy>=1.24"]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/aschet/sdfio"
|
|
38
|
+
Documentation = "https://aschet.github.io/sdfio/"
|
|
39
|
+
Source = "https://github.com/aschet/sdfio"
|
|
40
|
+
Issues = "https://github.com/aschet/sdfio/issues"
|
|
41
|
+
Changelog = "https://github.com/aschet/sdfio/releases"
|
|
42
|
+
|
|
43
|
+
[project.scripts]
|
|
44
|
+
sdfio = "sdfio.cli:main"
|
|
45
|
+
|
|
46
|
+
[dependency-groups]
|
|
47
|
+
dev = [
|
|
48
|
+
"bandit[toml]>=1.7",
|
|
49
|
+
"build>=1.2",
|
|
50
|
+
"mypy>=1.10",
|
|
51
|
+
"pip-audit>=2.7",
|
|
52
|
+
"pre-commit>=3.7",
|
|
53
|
+
"pytest>=8.0",
|
|
54
|
+
"pytest-cov>=5.0",
|
|
55
|
+
"reuse>=5.0",
|
|
56
|
+
"ruff>=0.5",
|
|
57
|
+
"twine>=5.1",
|
|
58
|
+
"types-defusedxml>=0.7",
|
|
59
|
+
"vulture>=2.11",
|
|
60
|
+
]
|
|
61
|
+
docs = ["furo>=2024.8", "myst-parser>=4.0", "sphinx>=8.0"]
|
|
62
|
+
|
|
63
|
+
[tool.hatch.version]
|
|
64
|
+
path = "src/sdfio/__init__.py"
|
|
65
|
+
|
|
66
|
+
[tool.hatch.build.targets.wheel]
|
|
67
|
+
packages = ["src/sdfio"]
|
|
68
|
+
|
|
69
|
+
[tool.hatch.build.targets.sdist]
|
|
70
|
+
include = [
|
|
71
|
+
"/src",
|
|
72
|
+
"/tests",
|
|
73
|
+
"/docs",
|
|
74
|
+
"/README.md",
|
|
75
|
+
"/LICENSE",
|
|
76
|
+
"/LICENSES",
|
|
77
|
+
"/REUSE.toml",
|
|
78
|
+
"/.pre-commit-config.yaml",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
[tool.pytest.ini_options]
|
|
82
|
+
minversion = "8.0"
|
|
83
|
+
addopts = "--doctest-modules --strict-markers --strict-config --import-mode=importlib"
|
|
84
|
+
testpaths = ["tests", "src"]
|
|
85
|
+
|
|
86
|
+
[tool.coverage.report]
|
|
87
|
+
fail_under = 75
|
|
88
|
+
|
|
89
|
+
[tool.ruff]
|
|
90
|
+
line-length = 100
|
|
91
|
+
src = ["src", "tests"]
|
|
92
|
+
|
|
93
|
+
[tool.ruff.lint]
|
|
94
|
+
select = ["E", "F", "W", "I", "N", "UP", "B", "C4", "SIM", "RUF", "D", "NPY", "PT", "ERA", "S"]
|
|
95
|
+
|
|
96
|
+
[tool.ruff.lint.per-file-ignores]
|
|
97
|
+
"tests/*" = ["D100", "D101", "D102", "D103", "S101"]
|
|
98
|
+
|
|
99
|
+
[tool.ruff.format]
|
|
100
|
+
exclude = ["*.md"]
|
|
101
|
+
|
|
102
|
+
[tool.ruff.lint.pydocstyle]
|
|
103
|
+
convention = "pep257"
|
|
104
|
+
|
|
105
|
+
[tool.mypy]
|
|
106
|
+
files = ["src", "tests"]
|
|
107
|
+
strict = true
|
|
108
|
+
|
|
109
|
+
[tool.vulture]
|
|
110
|
+
paths = ["src"]
|
|
111
|
+
min_confidence = 80
|
|
112
|
+
|
|
113
|
+
[tool.bandit]
|
|
114
|
+
exclude_dirs = ["tests"]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Thomas Ascher <thomas.ascher@gmx.at>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
"""sdfio: read and write ISO 25178-71 SDF surface data files.
|
|
6
|
+
|
|
7
|
+
The Surface Data File (SDF) format is defined by ISO 25178-71, "Geometrical
|
|
8
|
+
product specifications (GPS) -- Surface texture: Areal -- Part 71: Software
|
|
9
|
+
measurement standards". It stores areal (or profile) surface topography
|
|
10
|
+
measurements as a rectangular grid of height values, in either a
|
|
11
|
+
human-readable ASCII or a compact binary format.
|
|
12
|
+
|
|
13
|
+
Basic usage::
|
|
14
|
+
|
|
15
|
+
>>> import os
|
|
16
|
+
>>> import tempfile
|
|
17
|
+
>>> import numpy as np
|
|
18
|
+
>>> import sdfio
|
|
19
|
+
>>> path = os.path.join(tempfile.mkdtemp(), "example.sdf")
|
|
20
|
+
>>> sdfio.write(path, np.zeros((2, 3)), x_scale=1e-6, y_scale=1e-6)
|
|
21
|
+
>>> sdf = sdfio.read(path)
|
|
22
|
+
>>> sdf.data.shape
|
|
23
|
+
(2, 3)
|
|
24
|
+
>>> sdf.header.z_scale
|
|
25
|
+
1e-06
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
from __future__ import annotations
|
|
29
|
+
|
|
30
|
+
from .datatypes import (
|
|
31
|
+
DATA_TYPES,
|
|
32
|
+
DataType,
|
|
33
|
+
SdfDataType,
|
|
34
|
+
decode_raw,
|
|
35
|
+
encode_raw,
|
|
36
|
+
get_data_type,
|
|
37
|
+
suggest_z_scale,
|
|
38
|
+
)
|
|
39
|
+
from .exceptions import SdfError, SdfFormatError, SdfVersionError
|
|
40
|
+
from .file import FileFormat, SdfFile, read, write
|
|
41
|
+
from .header import SdfDialect, SdfHeader, SdfMetadata
|
|
42
|
+
|
|
43
|
+
__all__ = [
|
|
44
|
+
"DATA_TYPES",
|
|
45
|
+
"DataType",
|
|
46
|
+
"FileFormat",
|
|
47
|
+
"SdfDataType",
|
|
48
|
+
"SdfDialect",
|
|
49
|
+
"SdfError",
|
|
50
|
+
"SdfFile",
|
|
51
|
+
"SdfFormatError",
|
|
52
|
+
"SdfHeader",
|
|
53
|
+
"SdfMetadata",
|
|
54
|
+
"SdfVersionError",
|
|
55
|
+
"__version__",
|
|
56
|
+
"decode_raw",
|
|
57
|
+
"encode_raw",
|
|
58
|
+
"get_data_type",
|
|
59
|
+
"read",
|
|
60
|
+
"suggest_z_scale",
|
|
61
|
+
"write",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
__version__ = "1.0.0"
|