curve-apps 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-2024 Mira Geoscience
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,205 @@
1
+ Metadata-Version: 2.1
2
+ Name: curve-apps
3
+ Version: 0.1.0
4
+ Summary: Find edges on 2D grids or vertices.
5
+ Home-page: https://www.mirageoscience.com/mining-industry-software/python-integration/
6
+ License: MIT
7
+ Author: Mira Geoscience
8
+ Author-email: support@mirageoscience.com
9
+ Maintainer: Dominique Fournier
10
+ Maintainer-email: dominiquef@mirageoscience.com
11
+ Requires-Python: >=3.9,<3.11
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Natural Language :: English
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Operating System :: POSIX
19
+ Classifier: Operating System :: Unix
20
+ Classifier: Programming Language :: Python
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.9
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Topic :: Scientific/Engineering
25
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
26
+ Classifier: Topic :: Scientific/Engineering :: Physics
27
+ Requires-Dist: Pillow (>=10.3.0,<10.4.0)
28
+ Requires-Dist: geoapps-utils (>=0.3.0,<0.4.0)
29
+ Requires-Dist: geoh5py (>=0.9.0,<0.10.0)
30
+ Requires-Dist: h5py (>=3.2.1,<4.0.0)
31
+ Requires-Dist: numpy (>=1.23.5,<1.24.0)
32
+ Requires-Dist: pydantic (>=2.5.2,<2.6.0)
33
+ Requires-Dist: pywavelets (>=1.4.1,<1.5.0)
34
+ Requires-Dist: scikit-image (>=0.20.0,<0.21.0)
35
+ Requires-Dist: scipy (>=1.10.1,<1.11.0)
36
+ Requires-Dist: tifffile (==2024.2.12)
37
+ Requires-Dist: tqdm (>=4.66.1,<4.67.0)
38
+ Project-URL: Documentation, https://mirageoscience-curve-apps.readthedocs-hosted.com/
39
+ Project-URL: Repository, https://github.com/MiraGeoscience/curve-apps
40
+ Description-Content-Type: text/x-rst
41
+
42
+ |coverage| |maintainability| |precommit_ci| |docs| |style| |version| |status| |pyversions|
43
+
44
+
45
+ .. |docs| image:: https://readthedocs.org/projects/curve-apps/badge/
46
+ :alt: Documentation Status
47
+ :target: https://curve-apps.readthedocs.io/en/latest/?badge=latest
48
+
49
+ .. |coverage| image:: https://codecov.io/gh/MiraGeoscience/curve-apps/branch/develop/graph/badge.svg
50
+ :alt: Code coverage
51
+ :target: https://codecov.io/gh/MiraGeoscience/curve-apps
52
+
53
+ .. |style| image:: https://img.shields.io/badge/code%20style-black-000000.svg
54
+ :alt: Coding style
55
+ :target: https://github.com/pf/black
56
+
57
+ .. |version| image:: https://img.shields.io/pypi/v/edge-detection.svg
58
+ :alt: version on PyPI
59
+ :target: https://pypi.python.org/pypi/edge-detection/
60
+
61
+ .. |status| image:: https://img.shields.io/pypi/status/edge-detection.svg
62
+ :alt: version status on PyPI
63
+ :target: https://pypi.python.org/pypi/edge-detection/
64
+
65
+ .. |pyversions| image:: https://img.shields.io/pypi/pyversions/edge-detection.svg
66
+ :alt: Python versions
67
+ :target: https://pypi.python.org/pypi/edge-detection/
68
+
69
+ .. |precommit_ci| image:: https://results.pre-commit.ci/badge/github/MiraGeoscience/edge-detection/develop.svg
70
+ :alt: pre-commit.ci status
71
+ :target: https://results.pre-commit.ci/latest/github/MiraGeoscience/edge-detection/develop
72
+
73
+ .. |maintainability| image:: https://api.codeclimate.com/v1/badges/_token_/maintainability
74
+ :target: https://codeclimate.com/github/MiraGeoscience/edge-detection/maintainability
75
+ :alt: Maintainability
76
+
77
+
78
+ curve-apps
79
+ ==========
80
+
81
+ Auto-detection of trends and edges in geoscientific data.
82
+
83
+ .. contents:: Table of Contents
84
+ :local:
85
+ :depth: 3
86
+
87
+ Documentation
88
+ ^^^^^^^^^^^^^
89
+ `Online documentation <https://edge-detection.readthedocs.io/en/latest/>`_
90
+
91
+
92
+ Installation
93
+ ^^^^^^^^^^^^
94
+ **curve-apps** is currently written and tested for Python 3.10.
95
+
96
+ Install Conda
97
+ -------------
98
+
99
+ To install **curve-apps**, you need to install **Conda** first.
100
+
101
+ We recommend to install **Conda** using `miniforge`_.
102
+
103
+ .. _miniforge: https://github.com/conda-forge/miniforge
104
+
105
+ Within a conda environment
106
+ --------------------------
107
+
108
+ You can install (or update) a conda environment with all the requires packages to run **curve-apps**.
109
+ To do so you can directly run the **Install_or_Update.bat** file by double left clicking on it.
110
+
111
+ Install with conda
112
+ ------------------
113
+
114
+ You can install the package using ``conda`` and the ``.lock`` files from a conda prompt:
115
+
116
+ .. code-block:: bash
117
+
118
+ conda env create -n my-env -f environments/[the_desired_env].lock.yml
119
+
120
+ Install with PyPI
121
+ -----------------
122
+
123
+ You should not install the package from PyPI, as the app requires conda packages to run.
124
+ Still, you can install it in a conda environment without its dependencies (``--no-deps``).
125
+
126
+ From PyPI
127
+ ~~~~~~~~~
128
+
129
+ To install the **curve-apps** package published on PyPI:
130
+
131
+ .. code-block:: bash
132
+
133
+ pip install -U --no-deps curve-apps
134
+
135
+ From a Git tag or branch
136
+ ~~~~~~~~~~~~~~~~~~~~~~~~
137
+ If the package is not on PiPY yet, you can install it from a Git tag:
138
+
139
+ .. code-block:: bash
140
+
141
+ pip install -U --no-deps --force-reinstall https://github.com/MiraGeoscience/curve-apps/archive/refs/tags/TAG.zip
142
+
143
+ Or to install the latest changes available on a given Git branch:
144
+
145
+ .. code-block:: bash
146
+
147
+ pip install -U --no-deps --force-reinstall https://github.com/MiraGeoscience/curve-apps/archive/refs/heads/BRANCH.zip
148
+
149
+ .. note::
150
+ The ``--force-reinstall`` option is used to make sure the updated version
151
+ of the sources is installed, and not the cached version, even if the version number
152
+ did not change. The ``-U`` or ``--upgrade`` option is used to make sure to get the latest version,
153
+ on not merely reinstall the same version. As the package is aimed to be in a **Conda environment**, the option ``--no-deps`` is used to avoid installing the dependencies with pip, as they will be installed with conda.
154
+
155
+ From a local copy of the sources
156
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
157
+ If you have a git clone of the package sources locally,
158
+ you can install **curve-apps** from the local copy of the sources with:
159
+
160
+ .. code-block:: bash
161
+
162
+ pip install -U --force-reinstall path/to/project_folder_with_pyproject_toml
163
+
164
+ Or in **editable mode**, so that you can edit the sources and see the effect immediately at runtime:
165
+
166
+ .. code-block:: bash
167
+
168
+ pip install -e -U --force-reinstall path/to/project_folder_with_pyproject_toml
169
+
170
+ Setup for development
171
+ ^^^^^^^^^^^^^^^^^^^^^
172
+ To configure the development environment and tools, please see `README-dev.rst`_.
173
+
174
+ .. _README-dev.rst: README-dev.rst
175
+
176
+ License
177
+ ^^^^^^^
178
+ curve-apps is free software: you can redistribute it and/or modify
179
+ it under the terms of the GNU Lesser General Public License as published by
180
+ the Free Software Foundation, either version 3 of the License, or
181
+ (at your option) any later version.
182
+
183
+ curve-apps is distributed in the hope that it will be useful,
184
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
185
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
186
+ GNU Lesser General Public License for more details.
187
+
188
+ You should have received a copy of the GNU Lesser General Public License
189
+ along with curve-apps. If not, see <https://www.gnu.org/licenses/>.
190
+
191
+
192
+ Third Party Software
193
+ ^^^^^^^^^^^^^^^^^^^^
194
+ The curve-apps Software may provide links to third party libraries or code (collectively “Third Party Software”)
195
+ to implement various functions. Third Party Software does not comprise part of the Software.
196
+ The use of Third Party Software is governed by the terms of such software license(s).
197
+ Third Party Software notices and/or additional terms and conditions are located in the
198
+ `THIRD_PARTY_SOFTWARE.rst`_ file.
199
+
200
+ .. _THIRD_PARTY_SOFTWARE.rst: ./docs/THIRD_PARTY_SOFTWARE.rst
201
+
202
+ Copyright
203
+ ^^^^^^^^^
204
+ Copyright (c) 2024 Mira Geoscience Ltd.
205
+
@@ -0,0 +1,163 @@
1
+ |coverage| |maintainability| |precommit_ci| |docs| |style| |version| |status| |pyversions|
2
+
3
+
4
+ .. |docs| image:: https://readthedocs.org/projects/curve-apps/badge/
5
+ :alt: Documentation Status
6
+ :target: https://curve-apps.readthedocs.io/en/latest/?badge=latest
7
+
8
+ .. |coverage| image:: https://codecov.io/gh/MiraGeoscience/curve-apps/branch/develop/graph/badge.svg
9
+ :alt: Code coverage
10
+ :target: https://codecov.io/gh/MiraGeoscience/curve-apps
11
+
12
+ .. |style| image:: https://img.shields.io/badge/code%20style-black-000000.svg
13
+ :alt: Coding style
14
+ :target: https://github.com/pf/black
15
+
16
+ .. |version| image:: https://img.shields.io/pypi/v/edge-detection.svg
17
+ :alt: version on PyPI
18
+ :target: https://pypi.python.org/pypi/edge-detection/
19
+
20
+ .. |status| image:: https://img.shields.io/pypi/status/edge-detection.svg
21
+ :alt: version status on PyPI
22
+ :target: https://pypi.python.org/pypi/edge-detection/
23
+
24
+ .. |pyversions| image:: https://img.shields.io/pypi/pyversions/edge-detection.svg
25
+ :alt: Python versions
26
+ :target: https://pypi.python.org/pypi/edge-detection/
27
+
28
+ .. |precommit_ci| image:: https://results.pre-commit.ci/badge/github/MiraGeoscience/edge-detection/develop.svg
29
+ :alt: pre-commit.ci status
30
+ :target: https://results.pre-commit.ci/latest/github/MiraGeoscience/edge-detection/develop
31
+
32
+ .. |maintainability| image:: https://api.codeclimate.com/v1/badges/_token_/maintainability
33
+ :target: https://codeclimate.com/github/MiraGeoscience/edge-detection/maintainability
34
+ :alt: Maintainability
35
+
36
+
37
+ curve-apps
38
+ ==========
39
+
40
+ Auto-detection of trends and edges in geoscientific data.
41
+
42
+ .. contents:: Table of Contents
43
+ :local:
44
+ :depth: 3
45
+
46
+ Documentation
47
+ ^^^^^^^^^^^^^
48
+ `Online documentation <https://edge-detection.readthedocs.io/en/latest/>`_
49
+
50
+
51
+ Installation
52
+ ^^^^^^^^^^^^
53
+ **curve-apps** is currently written and tested for Python 3.10.
54
+
55
+ Install Conda
56
+ -------------
57
+
58
+ To install **curve-apps**, you need to install **Conda** first.
59
+
60
+ We recommend to install **Conda** using `miniforge`_.
61
+
62
+ .. _miniforge: https://github.com/conda-forge/miniforge
63
+
64
+ Within a conda environment
65
+ --------------------------
66
+
67
+ You can install (or update) a conda environment with all the requires packages to run **curve-apps**.
68
+ To do so you can directly run the **Install_or_Update.bat** file by double left clicking on it.
69
+
70
+ Install with conda
71
+ ------------------
72
+
73
+ You can install the package using ``conda`` and the ``.lock`` files from a conda prompt:
74
+
75
+ .. code-block:: bash
76
+
77
+ conda env create -n my-env -f environments/[the_desired_env].lock.yml
78
+
79
+ Install with PyPI
80
+ -----------------
81
+
82
+ You should not install the package from PyPI, as the app requires conda packages to run.
83
+ Still, you can install it in a conda environment without its dependencies (``--no-deps``).
84
+
85
+ From PyPI
86
+ ~~~~~~~~~
87
+
88
+ To install the **curve-apps** package published on PyPI:
89
+
90
+ .. code-block:: bash
91
+
92
+ pip install -U --no-deps curve-apps
93
+
94
+ From a Git tag or branch
95
+ ~~~~~~~~~~~~~~~~~~~~~~~~
96
+ If the package is not on PiPY yet, you can install it from a Git tag:
97
+
98
+ .. code-block:: bash
99
+
100
+ pip install -U --no-deps --force-reinstall https://github.com/MiraGeoscience/curve-apps/archive/refs/tags/TAG.zip
101
+
102
+ Or to install the latest changes available on a given Git branch:
103
+
104
+ .. code-block:: bash
105
+
106
+ pip install -U --no-deps --force-reinstall https://github.com/MiraGeoscience/curve-apps/archive/refs/heads/BRANCH.zip
107
+
108
+ .. note::
109
+ The ``--force-reinstall`` option is used to make sure the updated version
110
+ of the sources is installed, and not the cached version, even if the version number
111
+ did not change. The ``-U`` or ``--upgrade`` option is used to make sure to get the latest version,
112
+ on not merely reinstall the same version. As the package is aimed to be in a **Conda environment**, the option ``--no-deps`` is used to avoid installing the dependencies with pip, as they will be installed with conda.
113
+
114
+ From a local copy of the sources
115
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116
+ If you have a git clone of the package sources locally,
117
+ you can install **curve-apps** from the local copy of the sources with:
118
+
119
+ .. code-block:: bash
120
+
121
+ pip install -U --force-reinstall path/to/project_folder_with_pyproject_toml
122
+
123
+ Or in **editable mode**, so that you can edit the sources and see the effect immediately at runtime:
124
+
125
+ .. code-block:: bash
126
+
127
+ pip install -e -U --force-reinstall path/to/project_folder_with_pyproject_toml
128
+
129
+ Setup for development
130
+ ^^^^^^^^^^^^^^^^^^^^^
131
+ To configure the development environment and tools, please see `README-dev.rst`_.
132
+
133
+ .. _README-dev.rst: README-dev.rst
134
+
135
+ License
136
+ ^^^^^^^
137
+ curve-apps is free software: you can redistribute it and/or modify
138
+ it under the terms of the GNU Lesser General Public License as published by
139
+ the Free Software Foundation, either version 3 of the License, or
140
+ (at your option) any later version.
141
+
142
+ curve-apps is distributed in the hope that it will be useful,
143
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
144
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
145
+ GNU Lesser General Public License for more details.
146
+
147
+ You should have received a copy of the GNU Lesser General Public License
148
+ along with curve-apps. If not, see <https://www.gnu.org/licenses/>.
149
+
150
+
151
+ Third Party Software
152
+ ^^^^^^^^^^^^^^^^^^^^
153
+ The curve-apps Software may provide links to third party libraries or code (collectively “Third Party Software”)
154
+ to implement various functions. Third Party Software does not comprise part of the Software.
155
+ The use of Third Party Software is governed by the terms of such software license(s).
156
+ Third Party Software notices and/or additional terms and conditions are located in the
157
+ `THIRD_PARTY_SOFTWARE.rst`_ file.
158
+
159
+ .. _THIRD_PARTY_SOFTWARE.rst: ./docs/THIRD_PARTY_SOFTWARE.rst
160
+
161
+ Copyright
162
+ ^^^^^^^^^
163
+ Copyright (c) 2024 Mira Geoscience Ltd.
@@ -0,0 +1,23 @@
1
+ # Copyright (c) 2024 Mira Geoscience Ltd.
2
+ #
3
+ # This file is part of curve-apps package.
4
+ #
5
+ # All rights reserved.
6
+
7
+ from __future__ import annotations
8
+
9
+ from pathlib import Path
10
+
11
+ __version__ = "0.1.0"
12
+
13
+
14
+ def assets_path() -> Path:
15
+ """Return the path to the assets folder."""
16
+
17
+ parent = Path(__file__).parent
18
+ folder_name = f"{parent.name}-assets"
19
+ assets_folder = parent.parent / folder_name
20
+ if not assets_folder.is_dir():
21
+ raise RuntimeError(f"Assets folder not found: {assets_folder}")
22
+
23
+ return assets_folder
@@ -0,0 +1,103 @@
1
+ # Copyright (c) 2024 Mira Geoscience Ltd.
2
+ #
3
+ # This file is part of edge-detection package.
4
+ #
5
+ # All rights reserved.
6
+ #
7
+ #
8
+ # This file is part of curve-apps.
9
+ #
10
+ # curve-apps is distributed under the terms and conditions of the MIT License
11
+ # (see LICENSE file at the root of this source code package).
12
+
13
+
14
+ from __future__ import annotations
15
+
16
+ import logging
17
+ import tempfile
18
+ from abc import abstractmethod
19
+
20
+ from geoapps_utils.driver.data import BaseData
21
+ from geoapps_utils.driver.driver import BaseDriver
22
+ from geoh5py.groups import ContainerGroup
23
+ from geoh5py.objects import ObjectBase
24
+ from geoh5py.ui_json import InputFile
25
+
26
+ logger = logging.getLogger(__name__)
27
+
28
+
29
+ class BaseCurveDriver(BaseDriver):
30
+ """
31
+ Driver for the edge detection application.
32
+
33
+ :param parameters: Application parameters.
34
+ """
35
+
36
+ _parameter_class: type[BaseData]
37
+ _default_name: str
38
+
39
+ def __init__(self, parameters: BaseData | InputFile):
40
+ if isinstance(parameters, InputFile):
41
+ parameters = self._parameter_class.build(parameters)
42
+
43
+ # TODO need to re-type params in base class
44
+ super().__init__(parameters)
45
+
46
+ def run(self):
47
+ """
48
+ Run method of the driver.
49
+ """
50
+ with self.workspace.open(mode="r+") as workspace:
51
+ parent = None
52
+ if self.params.output.out_group is not None:
53
+ parent = ContainerGroup.create(
54
+ workspace=workspace,
55
+ name=self.params.output.out_group,
56
+ )
57
+
58
+ name = self.params.output.export_as
59
+ if name is None:
60
+ name = self._default_name
61
+
62
+ logger.info("Begin process.")
63
+ output = self.create_output(name, parent=parent)
64
+ logger.info("Process completed.")
65
+
66
+ if output is not None:
67
+ self.update_monitoring_directory(
68
+ parent if parent is not None else output
69
+ )
70
+
71
+ logger.info("Curve object '%s' saved to '%s'.", name, str(workspace.h5file))
72
+
73
+ @abstractmethod
74
+ def create_output(self, name: str, parent: ContainerGroup | None = None):
75
+ """
76
+ Create output.
77
+ """
78
+
79
+ @property
80
+ def params(self) -> BaseData:
81
+ """Application parameters."""
82
+ return self._params
83
+
84
+ @params.setter
85
+ def params(self, val: BaseData):
86
+ if not isinstance(val, BaseData):
87
+ raise TypeError("Parameters must be of type Parameters.")
88
+ self._params = val
89
+
90
+ def add_ui_json(self, entity: ObjectBase | ContainerGroup):
91
+ """
92
+ Add ui.json file to entity.
93
+
94
+ :param entity: Object to add ui.json file to.
95
+ """
96
+ param_dict = self.params.flatten()
97
+ self.params.input_file.update_ui_values(param_dict)
98
+
99
+ with tempfile.TemporaryDirectory() as temp_dir:
100
+ file_path = self.params.input_file.write_ui_json(
101
+ path=temp_dir, name=self.params.name + ".ui.json"
102
+ )
103
+ entity.add_file(str(file_path))
@@ -0,0 +1,5 @@
1
+ # Copyright (c) 2024 Mira Geoscience Ltd.
2
+ #
3
+ # This file is part of curve-apps package.
4
+ #
5
+ # All rights reserved.