loop-link 0.1.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.
- loop_link-0.1.0/LICENSE +21 -0
- loop_link-0.1.0/PKG-INFO +115 -0
- loop_link-0.1.0/README.md +82 -0
- loop_link-0.1.0/pyproject.toml +38 -0
- loop_link-0.1.0/setup.cfg +4 -0
- loop_link-0.1.0/src/loop_link/__init__.py +61 -0
- loop_link-0.1.0/src/loop_link/_websocket.py +436 -0
- loop_link-0.1.0/src/loop_link/adapters/__init__.py +51 -0
- loop_link-0.1.0/src/loop_link/adapters/loopstructural.py +83 -0
- loop_link-0.1.0/src/loop_link/adapters/pandas.py +227 -0
- loop_link-0.1.0/src/loop_link/adapters/pyvista.py +267 -0
- loop_link-0.1.0/src/loop_link/commands.py +418 -0
- loop_link-0.1.0/src/loop_link/discovery.py +170 -0
- loop_link-0.1.0/src/loop_link/encode.py +688 -0
- loop_link-0.1.0/src/loop_link/errors.py +279 -0
- loop_link-0.1.0/src/loop_link/fetch.py +610 -0
- loop_link-0.1.0/src/loop_link/objects.py +581 -0
- loop_link-0.1.0/src/loop_link/orientation.py +164 -0
- loop_link-0.1.0/src/loop_link/protocol.py +235 -0
- loop_link-0.1.0/src/loop_link/push.py +166 -0
- loop_link-0.1.0/src/loop_link/selection.py +215 -0
- loop_link-0.1.0/src/loop_link/testing/__init__.py +7 -0
- loop_link-0.1.0/src/loop_link/testing/fake_viewer.py +1587 -0
- loop_link-0.1.0/src/loop_link/tool.py +343 -0
- loop_link-0.1.0/src/loop_link/version.py +12 -0
- loop_link-0.1.0/src/loop_link/viewer.py +1518 -0
- loop_link-0.1.0/src/loop_link.egg-info/PKG-INFO +115 -0
- loop_link-0.1.0/src/loop_link.egg-info/SOURCES.txt +52 -0
- loop_link-0.1.0/src/loop_link.egg-info/dependency_links.txt +1 -0
- loop_link-0.1.0/src/loop_link.egg-info/requires.txt +16 -0
- loop_link-0.1.0/src/loop_link.egg-info/top_level.txt +1 -0
- loop_link-0.1.0/tests/test_adapter_loopstructural.py +177 -0
- loop_link-0.1.0/tests/test_adapter_pandas.py +221 -0
- loop_link-0.1.0/tests/test_adapter_pyvista.py +295 -0
- loop_link-0.1.0/tests/test_codec_real.py +335 -0
- loop_link-0.1.0/tests/test_colour.py +417 -0
- loop_link-0.1.0/tests/test_commands.py +353 -0
- loop_link-0.1.0/tests/test_discovery.py +292 -0
- loop_link-0.1.0/tests/test_encode.py +622 -0
- loop_link-0.1.0/tests/test_errors.py +129 -0
- loop_link-0.1.0/tests/test_fake_viewer.py +1036 -0
- loop_link-0.1.0/tests/test_fetch.py +1043 -0
- loop_link-0.1.0/tests/test_filter.py +365 -0
- loop_link-0.1.0/tests/test_fixtures.py +178 -0
- loop_link-0.1.0/tests/test_import.py +67 -0
- loop_link-0.1.0/tests/test_objects.py +399 -0
- loop_link-0.1.0/tests/test_orientation.py +212 -0
- loop_link-0.1.0/tests/test_performance.py +54 -0
- loop_link-0.1.0/tests/test_protocol.py +261 -0
- loop_link-0.1.0/tests/test_push.py +320 -0
- loop_link-0.1.0/tests/test_roundtrip.py +263 -0
- loop_link-0.1.0/tests/test_selection.py +551 -0
- loop_link-0.1.0/tests/test_tool.py +786 -0
- loop_link-0.1.0/tests/test_viewer.py +627 -0
loop_link-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Lachlan Grose
|
|
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.
|
loop_link-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: loop-link
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Send geoscience data to the LoopConnect viewer
|
|
5
|
+
Author-email: Lachlan Grose <lachlan.grose@monash.edu>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Classifier: Operating System :: POSIX
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: numpy
|
|
21
|
+
Provides-Extra: pyvista
|
|
22
|
+
Requires-Dist: pyvista; extra == "pyvista"
|
|
23
|
+
Provides-Extra: loopstructural
|
|
24
|
+
Requires-Dist: loop-common; extra == "loopstructural"
|
|
25
|
+
Provides-Extra: pandas
|
|
26
|
+
Requires-Dist: pandas; extra == "pandas"
|
|
27
|
+
Provides-Extra: tests
|
|
28
|
+
Requires-Dist: pytest; extra == "tests"
|
|
29
|
+
Requires-Dist: pyvista; extra == "tests"
|
|
30
|
+
Requires-Dist: loop-common; extra == "tests"
|
|
31
|
+
Requires-Dist: pandas; extra == "tests"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# loop-link
|
|
35
|
+
|
|
36
|
+
Send geoscience data from Python to the LoopConnect viewer.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
pip install loop-link
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Optional extras: `pyvista`, `loopstructural`, `pandas`.
|
|
45
|
+
|
|
46
|
+
## Token
|
|
47
|
+
|
|
48
|
+
The package needs a token. It reads the `GEOVIEWER_TOKEN` environment
|
|
49
|
+
variable. If this variable is not set, it uses the token that the viewer
|
|
50
|
+
saved.
|
|
51
|
+
|
|
52
|
+
## Example
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import numpy as np
|
|
56
|
+
from loop_link import Viewer, Points
|
|
57
|
+
|
|
58
|
+
viewer = Viewer()
|
|
59
|
+
xyz = np.random.rand(100, 3)
|
|
60
|
+
viewer.connect()
|
|
61
|
+
viewer.send(Points(xyz), id="random-points", name="random points")
|
|
62
|
+
viewer.close()
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Select and fetch
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from loop_link import Viewer, BlockModel
|
|
69
|
+
|
|
70
|
+
grid = BlockModel((0, 0, 0), (1, 1, 1), (4, 4, 4))
|
|
71
|
+
viewer = Viewer()
|
|
72
|
+
viewer.send(grid, id="grid")
|
|
73
|
+
viewer.select("grid", cells=[12, 13])
|
|
74
|
+
sel = viewer.selection()
|
|
75
|
+
print(sel.object_id, sel.cells)
|
|
76
|
+
watcher = viewer.watch_selection(print, interval=0.5)
|
|
77
|
+
watcher.stop()
|
|
78
|
+
result = viewer.fetch("grid")
|
|
79
|
+
print(result.object)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Select, read and fetch use the tool connection. They work while another program holds the data connection.
|
|
83
|
+
A viewer without geoviewer protocol 1.18 gives `MissingFeatureError`.
|
|
84
|
+
A fetch of a drillhole keeps the first interval set. It warns about dropped properties.
|
|
85
|
+
|
|
86
|
+
## Filter and colour
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from loop_link import BlockModel, ColourSettings, Viewer
|
|
90
|
+
|
|
91
|
+
grid = BlockModel((0, 0, 0), (1, 1, 1), (4, 4, 4))
|
|
92
|
+
viewer = Viewer()
|
|
93
|
+
viewer.send(grid, id="grid", colour=ColourSettings(array="grade", colour_map="viridis", range=(0.0, 1.0), scale="linear"))
|
|
94
|
+
result = viewer.filter_range("grid", "grade", 0.5, 1.0)
|
|
95
|
+
print(result.passing, result.total)
|
|
96
|
+
viewer.filter_values("grid", "unit", [0, 2], exclude=True)
|
|
97
|
+
viewer.filter_remove("grid", "grade")
|
|
98
|
+
viewer.set_colour_map("grid", "coolwarm")
|
|
99
|
+
print(viewer.colour_map_names())
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Filter and colour use the tool connection. They work while another program holds the data connection.
|
|
103
|
+
The colour map names come from the viewer. A viewer without geoviewer protocol 1.18 gives `MissingFeatureError` for `colour_map_names()`.
|
|
104
|
+
A filter call waits for the end of the build by default. `wait=False` does not wait, `cancel` is a `threading.Event`, and `progress` gets the fraction.
|
|
105
|
+
The counts need a viewer of protocol 1.20. An older viewer gives a `FilterResult` with no counts.
|
|
106
|
+
`state` is `building` when the viewer stopped to wait (the build goes on) and `unbuilt` when the viewer has no counts for the new filters.
|
|
107
|
+
A value filter uses the integer ids of the categories. These are the codes of `Categorical`.
|
|
108
|
+
|
|
109
|
+
## Test against the real codec
|
|
110
|
+
|
|
111
|
+
Some tests give the frames of `loop_link` to the real geoviewer codec.
|
|
112
|
+
The geoviewer repository is private, so these tests are optional.
|
|
113
|
+
Set `LOOP_LINK_GEOVIEWER_REPO` to a geoviewer checkout and install Rust (`cargo`).
|
|
114
|
+
The tests build a small validator program the first time that they run.
|
|
115
|
+
Without the variable, or without `cargo`, these tests skip.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# loop-link
|
|
2
|
+
|
|
3
|
+
Send geoscience data from Python to the LoopConnect viewer.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
pip install loop-link
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Optional extras: `pyvista`, `loopstructural`, `pandas`.
|
|
12
|
+
|
|
13
|
+
## Token
|
|
14
|
+
|
|
15
|
+
The package needs a token. It reads the `GEOVIEWER_TOKEN` environment
|
|
16
|
+
variable. If this variable is not set, it uses the token that the viewer
|
|
17
|
+
saved.
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import numpy as np
|
|
23
|
+
from loop_link import Viewer, Points
|
|
24
|
+
|
|
25
|
+
viewer = Viewer()
|
|
26
|
+
xyz = np.random.rand(100, 3)
|
|
27
|
+
viewer.connect()
|
|
28
|
+
viewer.send(Points(xyz), id="random-points", name="random points")
|
|
29
|
+
viewer.close()
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Select and fetch
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from loop_link import Viewer, BlockModel
|
|
36
|
+
|
|
37
|
+
grid = BlockModel((0, 0, 0), (1, 1, 1), (4, 4, 4))
|
|
38
|
+
viewer = Viewer()
|
|
39
|
+
viewer.send(grid, id="grid")
|
|
40
|
+
viewer.select("grid", cells=[12, 13])
|
|
41
|
+
sel = viewer.selection()
|
|
42
|
+
print(sel.object_id, sel.cells)
|
|
43
|
+
watcher = viewer.watch_selection(print, interval=0.5)
|
|
44
|
+
watcher.stop()
|
|
45
|
+
result = viewer.fetch("grid")
|
|
46
|
+
print(result.object)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Select, read and fetch use the tool connection. They work while another program holds the data connection.
|
|
50
|
+
A viewer without geoviewer protocol 1.18 gives `MissingFeatureError`.
|
|
51
|
+
A fetch of a drillhole keeps the first interval set. It warns about dropped properties.
|
|
52
|
+
|
|
53
|
+
## Filter and colour
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from loop_link import BlockModel, ColourSettings, Viewer
|
|
57
|
+
|
|
58
|
+
grid = BlockModel((0, 0, 0), (1, 1, 1), (4, 4, 4))
|
|
59
|
+
viewer = Viewer()
|
|
60
|
+
viewer.send(grid, id="grid", colour=ColourSettings(array="grade", colour_map="viridis", range=(0.0, 1.0), scale="linear"))
|
|
61
|
+
result = viewer.filter_range("grid", "grade", 0.5, 1.0)
|
|
62
|
+
print(result.passing, result.total)
|
|
63
|
+
viewer.filter_values("grid", "unit", [0, 2], exclude=True)
|
|
64
|
+
viewer.filter_remove("grid", "grade")
|
|
65
|
+
viewer.set_colour_map("grid", "coolwarm")
|
|
66
|
+
print(viewer.colour_map_names())
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Filter and colour use the tool connection. They work while another program holds the data connection.
|
|
70
|
+
The colour map names come from the viewer. A viewer without geoviewer protocol 1.18 gives `MissingFeatureError` for `colour_map_names()`.
|
|
71
|
+
A filter call waits for the end of the build by default. `wait=False` does not wait, `cancel` is a `threading.Event`, and `progress` gets the fraction.
|
|
72
|
+
The counts need a viewer of protocol 1.20. An older viewer gives a `FilterResult` with no counts.
|
|
73
|
+
`state` is `building` when the viewer stopped to wait (the build goes on) and `unbuilt` when the viewer has no counts for the new filters.
|
|
74
|
+
A value filter uses the integer ids of the categories. These are the codes of `Categorical`.
|
|
75
|
+
|
|
76
|
+
## Test against the real codec
|
|
77
|
+
|
|
78
|
+
Some tests give the frames of `loop_link` to the real geoviewer codec.
|
|
79
|
+
The geoviewer repository is private, so these tests are optional.
|
|
80
|
+
Set `LOOP_LINK_GEOVIEWER_REPO` to a geoviewer checkout and install Rust (`cargo`).
|
|
81
|
+
The tests build a small validator program the first time that they run.
|
|
82
|
+
Without the variable, or without `cargo`, these tests skip.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "loop-link"
|
|
7
|
+
description = "Send geoscience data to the LoopConnect viewer"
|
|
8
|
+
version = "0.1.0"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
authors = [{ name = "Lachlan Grose", email = "lachlan.grose@monash.edu" }]
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
license = { text = "MIT" }
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"Intended Audience :: Science/Research",
|
|
16
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: Microsoft :: Windows",
|
|
19
|
+
"Operating System :: POSIX",
|
|
20
|
+
"Operating System :: MacOS",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
]
|
|
25
|
+
dependencies = ["numpy"]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
pyvista = ["pyvista"]
|
|
29
|
+
loopstructural = ["loop-common"]
|
|
30
|
+
pandas = ["pandas"]
|
|
31
|
+
tests = ["pytest", "pyvista", "loop-common", "pandas"]
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["src"]
|
|
35
|
+
include = ["loop_link", "loop_link.*"]
|
|
36
|
+
|
|
37
|
+
[tool.pytest.ini_options]
|
|
38
|
+
markers = ["slow: tests that take a long time to run"]
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""loop-link: send geoscience data to the LoopConnect viewer."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .commands import ColourSettings, FilterResult
|
|
6
|
+
from .errors import (
|
|
7
|
+
BusyError,
|
|
8
|
+
CancelledError,
|
|
9
|
+
InvalidInputError,
|
|
10
|
+
LoopLinkError,
|
|
11
|
+
MissingExtraError,
|
|
12
|
+
MissingFeatureError,
|
|
13
|
+
NoViewerError,
|
|
14
|
+
ObjectTooLargeError,
|
|
15
|
+
Refusal,
|
|
16
|
+
StaleRevisionError,
|
|
17
|
+
TokenError,
|
|
18
|
+
UnsupportedObjectError,
|
|
19
|
+
ViewerClosedError,
|
|
20
|
+
ViewerRefusedError,
|
|
21
|
+
)
|
|
22
|
+
from .fetch import FetchResult
|
|
23
|
+
from .objects import BlockModel, Categorical, Drillhole, Lines, Points, Surface, TetraMesh, Vectors
|
|
24
|
+
from .push import PushResult, push_objects
|
|
25
|
+
from .selection import Selection, SelectionWatcher
|
|
26
|
+
from .version import __version__
|
|
27
|
+
from .viewer import InventoryEntry, Viewer
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
"BlockModel",
|
|
31
|
+
"BusyError",
|
|
32
|
+
"CancelledError",
|
|
33
|
+
"Categorical",
|
|
34
|
+
"ColourSettings",
|
|
35
|
+
"Drillhole",
|
|
36
|
+
"FetchResult",
|
|
37
|
+
"FilterResult",
|
|
38
|
+
"InvalidInputError",
|
|
39
|
+
"InventoryEntry",
|
|
40
|
+
"Lines",
|
|
41
|
+
"LoopLinkError",
|
|
42
|
+
"MissingExtraError",
|
|
43
|
+
"MissingFeatureError",
|
|
44
|
+
"NoViewerError",
|
|
45
|
+
"ObjectTooLargeError",
|
|
46
|
+
"Points",
|
|
47
|
+
"PushResult",
|
|
48
|
+
"Refusal",
|
|
49
|
+
"Selection",
|
|
50
|
+
"SelectionWatcher",
|
|
51
|
+
"StaleRevisionError",
|
|
52
|
+
"Surface",
|
|
53
|
+
"TetraMesh",
|
|
54
|
+
"TokenError",
|
|
55
|
+
"UnsupportedObjectError",
|
|
56
|
+
"Vectors",
|
|
57
|
+
"Viewer",
|
|
58
|
+
"ViewerClosedError",
|
|
59
|
+
"ViewerRefusedError",
|
|
60
|
+
"push_objects",
|
|
61
|
+
]
|