jcmsuite 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.
- jcmsuite-1.0.0/PKG-INFO +194 -0
- jcmsuite-1.0.0/README.pypi.md +161 -0
- jcmsuite-1.0.0/pyproject.toml +140 -0
- jcmsuite-1.0.0/src/jcmsuite/__init__.py +49 -0
- jcmsuite-1.0.0/src/jcmsuite/_build_info.py +4 -0
- jcmsuite-1.0.0/src/jcmsuite/context/__init__.py +44 -0
- jcmsuite-1.0.0/src/jcmsuite/context/interface_metadata.py +158 -0
- jcmsuite-1.0.0/src/jcmsuite/context/models.py +213 -0
- jcmsuite-1.0.0/src/jcmsuite/context/scope.py +210 -0
- jcmsuite-1.0.0/src/jcmsuite/context/solver_context.py +569 -0
- jcmsuite-1.0.0/src/jcmsuite/context/subprocess_tools.py +172 -0
- jcmsuite-1.0.0/src/jcmsuite/contract.py +47 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/__init__.py +19 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/handler.py +925 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/internal/__init__.py +4 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/internal/bundle_protocol.py +64 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/internal/handler_helpers.py +368 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/internal/handler_resource_jobs.py +227 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/internal/handler_wait.py +564 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/models.py +349 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/namespaces.py +250 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/protocol.py +801 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/resources.py +407 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/scope.py +53 -0
- jcmsuite-1.0.0/src/jcmsuite/daemon/transport.py +223 -0
- jcmsuite-1.0.0/src/jcmsuite/editing/__init__.py +10 -0
- jcmsuite-1.0.0/src/jcmsuite/editing/editor.py +274 -0
- jcmsuite-1.0.0/src/jcmsuite/exceptions/__init__.py +32 -0
- jcmsuite-1.0.0/src/jcmsuite/exceptions/errors.py +173 -0
- jcmsuite-1.0.0/src/jcmsuite/geo/__init__.py +10 -0
- jcmsuite-1.0.0/src/jcmsuite/geo/mesh.py +302 -0
- jcmsuite-1.0.0/src/jcmsuite/info/__init__.py +10 -0
- jcmsuite-1.0.0/src/jcmsuite/info/runtime_info.py +45 -0
- jcmsuite-1.0.0/src/jcmsuite/internal/__init__.py +2 -0
- jcmsuite-1.0.0/src/jcmsuite/internal/diagnostics.py +74 -0
- jcmsuite-1.0.0/src/jcmsuite/internal/progress.py +80 -0
- jcmsuite-1.0.0/src/jcmsuite/loaders/__init__.py +18 -0
- jcmsuite-1.0.0/src/jcmsuite/loaders/blob_header.py +315 -0
- jcmsuite-1.0.0/src/jcmsuite/loaders/cartesian_field_reader.py +249 -0
- jcmsuite-1.0.0/src/jcmsuite/loaders/cartesian_fields.py +324 -0
- jcmsuite-1.0.0/src/jcmsuite/loaders/nested_mapping.py +69 -0
- jcmsuite-1.0.0/src/jcmsuite/loaders/powerflux.py +136 -0
- jcmsuite-1.0.0/src/jcmsuite/loaders/table.py +573 -0
- jcmsuite-1.0.0/src/jcmsuite/logging/__init__.py +22 -0
- jcmsuite-1.0.0/src/jcmsuite/logging/runtime.py +210 -0
- jcmsuite-1.0.0/src/jcmsuite/results/__init__.py +126 -0
- jcmsuite-1.0.0/src/jcmsuite/results/artifacts.py +778 -0
- jcmsuite-1.0.0/src/jcmsuite/results/discovery.py +82 -0
- jcmsuite-1.0.0/src/jcmsuite/results/field_exports.py +897 -0
- jcmsuite-1.0.0/src/jcmsuite/results/field_payloads.py +453 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/__init__.py +4 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/export/__init__.py +4 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/export/common.py +28 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/export/companion.py +16 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/export/companion_xarray.py +16 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/export/pandas/__init__.py +4 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/export/pandas/common.py +105 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/export/pandas/payload.py +415 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/export/preview.py +178 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/export/xarray/__init__.py +4 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/export/xarray/types.py +28 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/models/__init__.py +4 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/models/batch.py +1087 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/models/batch_postprocess.py +1503 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/models/bundle.py +343 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/models/core.py +556 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/models/submission.py +1157 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/resultbag/__init__.py +4 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/resultbag/access.py +531 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/resultbag/iteration.py +199 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/resultbag/query.py +230 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/resultbag/raw.py +407 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/resultbag/source_files.py +142 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/resultbag/store.py +882 -0
- jcmsuite-1.0.0/src/jcmsuite/results/internal/resultbag/utils.py +258 -0
- jcmsuite-1.0.0/src/jcmsuite/results/models.py +76 -0
- jcmsuite-1.0.0/src/jcmsuite/results/opening.py +55 -0
- jcmsuite-1.0.0/src/jcmsuite/results/pandas_export.py +165 -0
- jcmsuite-1.0.0/src/jcmsuite/results/payloads.py +458 -0
- jcmsuite-1.0.0/src/jcmsuite/results/postprocess.py +97 -0
- jcmsuite-1.0.0/src/jcmsuite/results/postprocess_payloads.py +762 -0
- jcmsuite-1.0.0/src/jcmsuite/results/postprocess_record.py +406 -0
- jcmsuite-1.0.0/src/jcmsuite/results/resultbag.py +285 -0
- jcmsuite-1.0.0/src/jcmsuite/results/resultbag_management.py +433 -0
- jcmsuite-1.0.0/src/jcmsuite/results/structured_derivatives.py +387 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/__init__.py +10 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/daemon_bundle_staging.py +100 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/daemon_bundle_wait.py +89 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/orchestration.py +1576 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/orchestration_execution.py +180 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/orchestration_routing.py +128 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/orchestration_support.py +323 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/path_resolution.py +98 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/progress.py +20 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/solver.py +709 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/staging.py +276 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/types.py +25 -0
- jcmsuite-1.0.0/src/jcmsuite/solve/working_dirs.py +227 -0
- jcmsuite-1.0.0/src/jcmsuite/templates/__init__.py +11 -0
- jcmsuite-1.0.0/src/jcmsuite/templates/converter.py +71 -0
- jcmsuite-1.0.0/src/jcmsuite/templates/formatting.py +335 -0
- jcmsuite-1.0.0/src/jcmsuite/templates/formatting_cli.py +47 -0
- jcmsuite-1.0.0/src/jcmsuite/templates/rendering.py +666 -0
- jcmsuite-1.0.0/src/jcmsuite/view/__init__.py +10 -0
- jcmsuite-1.0.0/src/jcmsuite/view/viewer.py +122 -0
jcmsuite-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jcmsuite
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: The JCMwave Python interface provides access to the JCMsuite software.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Author: Matthias Plock
|
|
7
|
+
Author-email: matthias.plock@jcmwave.com
|
|
8
|
+
Requires-Python: >=3.13
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Provides-Extra: all
|
|
14
|
+
Provides-Extra: pandas
|
|
15
|
+
Provides-Extra: progress
|
|
16
|
+
Provides-Extra: torch
|
|
17
|
+
Provides-Extra: xarray
|
|
18
|
+
Requires-Dist: jcmsuite-data-tree (==1.0.0)
|
|
19
|
+
Requires-Dist: jcmsuite-pandas (==1.0.0) ; extra == "all"
|
|
20
|
+
Requires-Dist: jcmsuite-pandas (==1.0.0) ; extra == "pandas"
|
|
21
|
+
Requires-Dist: jcmsuite-torch (==1.0.0) ; extra == "all"
|
|
22
|
+
Requires-Dist: jcmsuite-torch (==1.0.0) ; extra == "torch"
|
|
23
|
+
Requires-Dist: jcmsuite-xarray (==1.0.0) ; extra == "all"
|
|
24
|
+
Requires-Dist: jcmsuite-xarray (==1.0.0) ; extra == "xarray"
|
|
25
|
+
Requires-Dist: numpy (>=2.1.0,<3.0)
|
|
26
|
+
Requires-Dist: scipy (>=1.14.1,<2.0)
|
|
27
|
+
Requires-Dist: tqdm (>=4.50,<5.0) ; extra == "all"
|
|
28
|
+
Requires-Dist: tqdm (>=4.50,<5.0) ; extra == "progress"
|
|
29
|
+
Project-URL: Documentation, https://docs.jcmwave.com/JCMsuite/html/
|
|
30
|
+
Project-URL: Homepage, https://www.jcmwave.com
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# JCMsuite Python Interface (`jcmsuite`)
|
|
34
|
+
|
|
35
|
+
Python interface for JCMsuite solver workflows. Run projects, manage local and
|
|
36
|
+
daemon execution, and inspect or export result data from Python.
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- **Project execution:** Generate meshes and run JCMsuite projects from Python.
|
|
41
|
+
- **Parameterized projects:** Supply project keys to templates, including nested
|
|
42
|
+
values and numeric arrays, to vary geometry, materials, and sources.
|
|
43
|
+
- **Parameter scans:** Run ordered batches with isolated working directories.
|
|
44
|
+
- **Parallel execution:** Schedule solves on local or remote workstations and
|
|
45
|
+
configured cluster queues through the JCMsuite daemon.
|
|
46
|
+
- **Structured results:** Inspect costs, eigenvalues, postprocesses, and exported
|
|
47
|
+
fields. Supported result types export to dictionaries, pandas, and xarray.
|
|
48
|
+
- **Persistent results:** Store and reuse matching solves with `Resultbag`.
|
|
49
|
+
|
|
50
|
+
## Requirements
|
|
51
|
+
|
|
52
|
+
- Python 3.13 or later.
|
|
53
|
+
- A separate JCMsuite installation for solver operations.
|
|
54
|
+
|
|
55
|
+
Installing this Python package does not install the JCMsuite solver. Test
|
|
56
|
+
licenses are available to try JCMsuite; you do not need an existing commercial
|
|
57
|
+
license to get started. See the
|
|
58
|
+
[JCMsuite documentation](https://docs.jcmwave.com/JCMsuite/html/) for installation
|
|
59
|
+
instructions and license information.
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
python -m pip install jcmsuite
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The installation includes NumPy, SciPy, and the `jcmsuite-data-tree` support
|
|
68
|
+
package. Optional features are available as extras:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
python -m pip install "jcmsuite[progress]" # tqdm progress bars
|
|
72
|
+
python -m pip install "jcmsuite[torch]" # PyTorch integration
|
|
73
|
+
python -m pip install "jcmsuite[pandas]" # DataFrame exports
|
|
74
|
+
python -m pip install "jcmsuite[xarray]" # xarray exports
|
|
75
|
+
python -m pip install "jcmsuite[all]" # all optional features
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The Torch extra installs `jcmsuite-torch` at the exact core version. It provides
|
|
79
|
+
the existing `jcmsuite.torch` namespace. Core-only installations do not contain
|
|
80
|
+
the Torch implementation and do not require PyTorch.
|
|
81
|
+
Install `jcmsuite[pandas]` to use DataFrame exports. The extra installs
|
|
82
|
+
`jcmsuite-pandas` at the exact core version.
|
|
83
|
+
Install `jcmsuite[xarray]` to use xarray exports. The extra installs
|
|
84
|
+
`jcmsuite-xarray` at the exact core version.
|
|
85
|
+
|
|
86
|
+
## Getting Started
|
|
87
|
+
|
|
88
|
+
### Locate JCMsuite
|
|
89
|
+
|
|
90
|
+
Set the `JCMROOT` environment variable to your JCMsuite installation directory
|
|
91
|
+
before starting Python. Then inspect the installation:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
import jcmsuite
|
|
95
|
+
|
|
96
|
+
jcmsuite.info()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Alternatively, select an installation explicitly with a context. Replace the
|
|
100
|
+
example path with your installation directory:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from jcmsuite.context import create_context
|
|
104
|
+
|
|
105
|
+
context = create_context(jcm_root="/path/to/JCMsuite")
|
|
106
|
+
with context:
|
|
107
|
+
jcmsuite.info()
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The context is active only inside the `with` block. The examples below use
|
|
111
|
+
the default context configured through `JCMROOT`.
|
|
112
|
+
|
|
113
|
+
### Run A Project And Inspect Results
|
|
114
|
+
|
|
115
|
+
Pass the path of an existing JCMsuite project to `solve`:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
result = jcmsuite.solve("project.jcmp")
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`project.jcmp` represents a project that you supply; it is not included in this
|
|
122
|
+
package. By default, `solve` waits for completion and returns a `SolveResult`.
|
|
123
|
+
The available data depends on the project and its declared postprocesses.
|
|
124
|
+
For a project with at least one postprocess, inspect its first record:
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
postprocess = result.postprocesses[0]
|
|
128
|
+
print(postprocess.to_dict())
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Field exports also support operations such as selecting a field and calculating
|
|
132
|
+
its intensity. Use `jcmsuite.view(result.file)` to open an available solution
|
|
133
|
+
fieldbag in JCMview. JCMview requires a graphical environment.
|
|
134
|
+
|
|
135
|
+
### Pass Project Keys And Run A Scan
|
|
136
|
+
|
|
137
|
+
For a project whose templates already accept a `radius` key, pass its value
|
|
138
|
+
through `keys`:
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
result = jcmsuite.solve("project.jcmp", keys={"radius": 0.3})
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
For a scan, pass a list of project-key dictionaries instead:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
keys = [{"radius": radius} for radius in (0.3, 0.4, 0.5)]
|
|
148
|
+
results = jcmsuite.solve("project.jcmp", keys=keys, temporary=True, quiet=True)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The returned `BatchSolveResult` preserves input order. `temporary=True` gives
|
|
152
|
+
each solve an isolated working directory so that scan entries do not overwrite
|
|
153
|
+
each other's files. `quiet=True` suppresses local solver output. For compatible
|
|
154
|
+
postprocess data, combine the scan results with
|
|
155
|
+
`results.postprocesses[0].to_xarray()`.
|
|
156
|
+
|
|
157
|
+
### Run Solves In Parallel Or Reuse Results
|
|
158
|
+
|
|
159
|
+
To run the same scan through a local daemon, declare a resource and activate
|
|
160
|
+
the handler around the solve:
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
handler = jcmsuite.daemon.handler()
|
|
164
|
+
handler.resources.add(
|
|
165
|
+
jcmsuite.daemon.Workstation(hostname="localhost", multiplicity=2, n_threads=1)
|
|
166
|
+
)
|
|
167
|
+
with handler:
|
|
168
|
+
results = jcmsuite.solve("project.jcmp", keys=keys, temporary=True, quiet=True)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
This configuration allows two concurrent solves with one solver thread each.
|
|
172
|
+
Choose values supported by your computer and available JCMsuite licenses.
|
|
173
|
+
The handler disconnects and stops the daemon when the block ends.
|
|
174
|
+
|
|
175
|
+
For repeated scans, pass a `Resultbag` with `resultbag=` to store results and
|
|
176
|
+
reuse entries that match the project, project keys, suffix pattern, and source-file
|
|
177
|
+
state. Open Resultbag files only from trusted sources: loading them uses Python
|
|
178
|
+
pickle and can execute code.
|
|
179
|
+
|
|
180
|
+
## Documentation and Support
|
|
181
|
+
|
|
182
|
+
See the [JCMsuite documentation](https://docs.jcmwave.com/JCMsuite/html/) for
|
|
183
|
+
manuals, tutorials, and installation instructions. For product and support
|
|
184
|
+
information, visit [JCMwave](https://www.jcmwave.com).
|
|
185
|
+
|
|
186
|
+
The related `jcmsuite-data-tree` and `jcmsuite-notebooks` packages provide
|
|
187
|
+
low-level tree helpers and notebook/Matlab conversion tools. They do not replace
|
|
188
|
+
the main `jcmsuite` solver interface.
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
This Python package is licensed under the MIT License. JCMsuite solver licensing
|
|
193
|
+
is separate.
|
|
194
|
+
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# JCMsuite Python Interface (`jcmsuite`)
|
|
2
|
+
|
|
3
|
+
Python interface for JCMsuite solver workflows. Run projects, manage local and
|
|
4
|
+
daemon execution, and inspect or export result data from Python.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- **Project execution:** Generate meshes and run JCMsuite projects from Python.
|
|
9
|
+
- **Parameterized projects:** Supply project keys to templates, including nested
|
|
10
|
+
values and numeric arrays, to vary geometry, materials, and sources.
|
|
11
|
+
- **Parameter scans:** Run ordered batches with isolated working directories.
|
|
12
|
+
- **Parallel execution:** Schedule solves on local or remote workstations and
|
|
13
|
+
configured cluster queues through the JCMsuite daemon.
|
|
14
|
+
- **Structured results:** Inspect costs, eigenvalues, postprocesses, and exported
|
|
15
|
+
fields. Supported result types export to dictionaries, pandas, and xarray.
|
|
16
|
+
- **Persistent results:** Store and reuse matching solves with `Resultbag`.
|
|
17
|
+
|
|
18
|
+
## Requirements
|
|
19
|
+
|
|
20
|
+
- Python 3.13 or later.
|
|
21
|
+
- A separate JCMsuite installation for solver operations.
|
|
22
|
+
|
|
23
|
+
Installing this Python package does not install the JCMsuite solver. Test
|
|
24
|
+
licenses are available to try JCMsuite; you do not need an existing commercial
|
|
25
|
+
license to get started. See the
|
|
26
|
+
[JCMsuite documentation](https://docs.jcmwave.com/JCMsuite/html/) for installation
|
|
27
|
+
instructions and license information.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
python -m pip install jcmsuite
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The installation includes NumPy, SciPy, and the `jcmsuite-data-tree` support
|
|
36
|
+
package. Optional features are available as extras:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python -m pip install "jcmsuite[progress]" # tqdm progress bars
|
|
40
|
+
python -m pip install "jcmsuite[torch]" # PyTorch integration
|
|
41
|
+
python -m pip install "jcmsuite[pandas]" # DataFrame exports
|
|
42
|
+
python -m pip install "jcmsuite[xarray]" # xarray exports
|
|
43
|
+
python -m pip install "jcmsuite[all]" # all optional features
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The Torch extra installs `jcmsuite-torch` at the exact core version. It provides
|
|
47
|
+
the existing `jcmsuite.torch` namespace. Core-only installations do not contain
|
|
48
|
+
the Torch implementation and do not require PyTorch.
|
|
49
|
+
Install `jcmsuite[pandas]` to use DataFrame exports. The extra installs
|
|
50
|
+
`jcmsuite-pandas` at the exact core version.
|
|
51
|
+
Install `jcmsuite[xarray]` to use xarray exports. The extra installs
|
|
52
|
+
`jcmsuite-xarray` at the exact core version.
|
|
53
|
+
|
|
54
|
+
## Getting Started
|
|
55
|
+
|
|
56
|
+
### Locate JCMsuite
|
|
57
|
+
|
|
58
|
+
Set the `JCMROOT` environment variable to your JCMsuite installation directory
|
|
59
|
+
before starting Python. Then inspect the installation:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import jcmsuite
|
|
63
|
+
|
|
64
|
+
jcmsuite.info()
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Alternatively, select an installation explicitly with a context. Replace the
|
|
68
|
+
example path with your installation directory:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from jcmsuite.context import create_context
|
|
72
|
+
|
|
73
|
+
context = create_context(jcm_root="/path/to/JCMsuite")
|
|
74
|
+
with context:
|
|
75
|
+
jcmsuite.info()
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The context is active only inside the `with` block. The examples below use
|
|
79
|
+
the default context configured through `JCMROOT`.
|
|
80
|
+
|
|
81
|
+
### Run A Project And Inspect Results
|
|
82
|
+
|
|
83
|
+
Pass the path of an existing JCMsuite project to `solve`:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
result = jcmsuite.solve("project.jcmp")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`project.jcmp` represents a project that you supply; it is not included in this
|
|
90
|
+
package. By default, `solve` waits for completion and returns a `SolveResult`.
|
|
91
|
+
The available data depends on the project and its declared postprocesses.
|
|
92
|
+
For a project with at least one postprocess, inspect its first record:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
postprocess = result.postprocesses[0]
|
|
96
|
+
print(postprocess.to_dict())
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Field exports also support operations such as selecting a field and calculating
|
|
100
|
+
its intensity. Use `jcmsuite.view(result.file)` to open an available solution
|
|
101
|
+
fieldbag in JCMview. JCMview requires a graphical environment.
|
|
102
|
+
|
|
103
|
+
### Pass Project Keys And Run A Scan
|
|
104
|
+
|
|
105
|
+
For a project whose templates already accept a `radius` key, pass its value
|
|
106
|
+
through `keys`:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
result = jcmsuite.solve("project.jcmp", keys={"radius": 0.3})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
For a scan, pass a list of project-key dictionaries instead:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
keys = [{"radius": radius} for radius in (0.3, 0.4, 0.5)]
|
|
116
|
+
results = jcmsuite.solve("project.jcmp", keys=keys, temporary=True, quiet=True)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The returned `BatchSolveResult` preserves input order. `temporary=True` gives
|
|
120
|
+
each solve an isolated working directory so that scan entries do not overwrite
|
|
121
|
+
each other's files. `quiet=True` suppresses local solver output. For compatible
|
|
122
|
+
postprocess data, combine the scan results with
|
|
123
|
+
`results.postprocesses[0].to_xarray()`.
|
|
124
|
+
|
|
125
|
+
### Run Solves In Parallel Or Reuse Results
|
|
126
|
+
|
|
127
|
+
To run the same scan through a local daemon, declare a resource and activate
|
|
128
|
+
the handler around the solve:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
handler = jcmsuite.daemon.handler()
|
|
132
|
+
handler.resources.add(
|
|
133
|
+
jcmsuite.daemon.Workstation(hostname="localhost", multiplicity=2, n_threads=1)
|
|
134
|
+
)
|
|
135
|
+
with handler:
|
|
136
|
+
results = jcmsuite.solve("project.jcmp", keys=keys, temporary=True, quiet=True)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
This configuration allows two concurrent solves with one solver thread each.
|
|
140
|
+
Choose values supported by your computer and available JCMsuite licenses.
|
|
141
|
+
The handler disconnects and stops the daemon when the block ends.
|
|
142
|
+
|
|
143
|
+
For repeated scans, pass a `Resultbag` with `resultbag=` to store results and
|
|
144
|
+
reuse entries that match the project, project keys, suffix pattern, and source-file
|
|
145
|
+
state. Open Resultbag files only from trusted sources: loading them uses Python
|
|
146
|
+
pickle and can execute code.
|
|
147
|
+
|
|
148
|
+
## Documentation and Support
|
|
149
|
+
|
|
150
|
+
See the [JCMsuite documentation](https://docs.jcmwave.com/JCMsuite/html/) for
|
|
151
|
+
manuals, tutorials, and installation instructions. For product and support
|
|
152
|
+
information, visit [JCMwave](https://www.jcmwave.com).
|
|
153
|
+
|
|
154
|
+
The related `jcmsuite-data-tree` and `jcmsuite-notebooks` packages provide
|
|
155
|
+
low-level tree helpers and notebook/Matlab conversion tools. They do not replace
|
|
156
|
+
the main `jcmsuite` solver interface.
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
This Python package is licensed under the MIT License. JCMsuite solver licensing
|
|
161
|
+
is separate.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "jcmsuite"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
readme = "README.pypi.md"
|
|
5
|
+
license = "MIT"
|
|
6
|
+
description = "The JCMwave Python interface provides access to the JCMsuite software."
|
|
7
|
+
authors = [
|
|
8
|
+
{"name" = "Matthias Plock", "email" = "matthias.plock@jcmwave.com"},
|
|
9
|
+
{"name" = "Lin Zschiedrich", "email" = "lin.zschiedrich@jcmwave.com"},
|
|
10
|
+
{"name" = "Martin Hammerschmidt", "email" = "martin.hammerschmidt@jcmwave.com"},
|
|
11
|
+
{"name" = "Philipp-Immanuel Schneider", "email" = "philipp-immanuel.schneider@jcmwave.com"}
|
|
12
|
+
]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Science/Research",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Programming Language :: Python :: 3.14",
|
|
18
|
+
]
|
|
19
|
+
requires-python = ">=3.13"
|
|
20
|
+
dependencies = [
|
|
21
|
+
"numpy>=2.1.0,<3.0",
|
|
22
|
+
"scipy>=1.14.1,<2.0",
|
|
23
|
+
"jcmsuite-data-tree==1.0.0",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.optional-dependencies]
|
|
27
|
+
progress = [
|
|
28
|
+
"tqdm>=4.50,<5.0",
|
|
29
|
+
]
|
|
30
|
+
torch = [
|
|
31
|
+
"jcmsuite-torch==1.0.0",
|
|
32
|
+
]
|
|
33
|
+
pandas = [
|
|
34
|
+
"jcmsuite-pandas==1.0.0",
|
|
35
|
+
]
|
|
36
|
+
xarray = [
|
|
37
|
+
"jcmsuite-xarray==1.0.0",
|
|
38
|
+
]
|
|
39
|
+
all = [
|
|
40
|
+
"tqdm>=4.50,<5.0",
|
|
41
|
+
"jcmsuite-torch==1.0.0",
|
|
42
|
+
"jcmsuite-pandas==1.0.0",
|
|
43
|
+
"jcmsuite-xarray==1.0.0",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://www.jcmwave.com"
|
|
48
|
+
Documentation = "https://docs.jcmwave.com/JCMsuite/html/"
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
jcmsuite-format = "jcmsuite.templates.formatting_cli:main"
|
|
52
|
+
|
|
53
|
+
[tool.poetry]
|
|
54
|
+
requires-poetry = ">=2.4.2,<3.0"
|
|
55
|
+
packages = [
|
|
56
|
+
{ include = "jcmsuite", from = "src" },
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[build-system]
|
|
60
|
+
requires = ["poetry-core"]
|
|
61
|
+
build-backend = "poetry.core.masonry.api"
|
|
62
|
+
|
|
63
|
+
[tool.poetry.dependencies]
|
|
64
|
+
numpy = ">=2.1.0,<3.0"
|
|
65
|
+
scipy = ">=1.14.1,<2.0"
|
|
66
|
+
jcmsuite-data-tree = "==1.0.0"
|
|
67
|
+
[tool.jcmsuite.release]
|
|
68
|
+
data_tree_package_name = "jcmsuite-data-tree"
|
|
69
|
+
data_tree_package_path = "packages/jcmsuite_data_tree"
|
|
70
|
+
data_tree_version_constraint = "==1.0.0"
|
|
71
|
+
notebooks_package_name = "jcmsuite-notebooks"
|
|
72
|
+
notebooks_package_path = "packages/jcmsuite_notebooks"
|
|
73
|
+
|
|
74
|
+
[tool.pyright]
|
|
75
|
+
extraPaths = [
|
|
76
|
+
"src",
|
|
77
|
+
"packages/jcmsuite_torch/src",
|
|
78
|
+
"packages/jcmsuite_pandas/src",
|
|
79
|
+
"packages/jcmsuite_xarray/src",
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
[tool.poetry.group.dev.dependencies]
|
|
83
|
+
nox = { version = "^2026.8.17", extras = ["pbs"] }
|
|
84
|
+
pre-commit = "^4.6.2"
|
|
85
|
+
black = "26.5.1"
|
|
86
|
+
isort = "^9.0.1"
|
|
87
|
+
mypy = "^2.3.1"
|
|
88
|
+
pyright = { version = "^1.1.411", extras = ["nodejs"] }
|
|
89
|
+
ruff = "^0.16.5"
|
|
90
|
+
coverage = "^7.16"
|
|
91
|
+
|
|
92
|
+
# Dependencies for regression testing against legacy code
|
|
93
|
+
[tool.poetry.group.test.dependencies]
|
|
94
|
+
colorama = "^0.4.6"
|
|
95
|
+
notebook = "^7.0.0"
|
|
96
|
+
requests = "^2.34.2"
|
|
97
|
+
unittest-xml-reporting = ">=3.2"
|
|
98
|
+
|
|
99
|
+
[tool.poetry.group.build.dependencies]
|
|
100
|
+
jinja2 = "^3.1"
|
|
101
|
+
|
|
102
|
+
[tool.poetry.group.docs.dependencies]
|
|
103
|
+
sphinx = "^9.1.0"
|
|
104
|
+
myst-parser = "^5.1.0"
|
|
105
|
+
sphinx-rtd-theme = "^3.0.2"
|
|
106
|
+
|
|
107
|
+
[tool.poetry.group.ci.dependencies]
|
|
108
|
+
black = "26.5.1"
|
|
109
|
+
isort = "^9.0.1"
|
|
110
|
+
mypy = "^2.3.1"
|
|
111
|
+
pyright = { version = "^1.1.411", extras = ["nodejs"] }
|
|
112
|
+
ruff = "^0.16.5"
|
|
113
|
+
junit-xml = "^1.9"
|
|
114
|
+
pylint = "^4.0.8"
|
|
115
|
+
pylint_junit = "^0.3.5"
|
|
116
|
+
|
|
117
|
+
[tool.ruff]
|
|
118
|
+
output-format = "junit"
|
|
119
|
+
exclude = [ "tests", "legacy_jcmwave", "scripts/testing/local"]
|
|
120
|
+
# Scratch CI checkouts have no .git directory, so Ruff cannot rely on .gitignore.
|
|
121
|
+
# Slash-containing patterns refer to root outputs, preserving scripts/build.
|
|
122
|
+
extend-exclude = [".venv", ".nox", ".tox", ".cache", "ci-results", "build/*", "dist/*", "tmp/*"]
|
|
123
|
+
|
|
124
|
+
[tool.ruff.lint]
|
|
125
|
+
select = ["E4", "E7", "E9", "F"]
|
|
126
|
+
|
|
127
|
+
[tool.black]
|
|
128
|
+
target-version = ["py313"]
|
|
129
|
+
|
|
130
|
+
[tool.mypy]
|
|
131
|
+
check_untyped_defs = true
|
|
132
|
+
python_version = "3.13"
|
|
133
|
+
exclude = ["^tests/", "^legacy_jcmwave/"] # Regex
|
|
134
|
+
|
|
135
|
+
[tool.coverage.run]
|
|
136
|
+
source = [ "jcmsuite" ]
|
|
137
|
+
omit = [
|
|
138
|
+
"tests/",
|
|
139
|
+
"legacy_jcmwave/"
|
|
140
|
+
]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (c) 2001-2026 JCMwave GmbH
|
|
3
|
+
|
|
4
|
+
"""Top-level public API surface for `jcmsuite`."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from importlib import import_module
|
|
9
|
+
from pkgutil import extend_path
|
|
10
|
+
from types import ModuleType
|
|
11
|
+
from typing import TYPE_CHECKING
|
|
12
|
+
|
|
13
|
+
# The optional lockstep distribution owns jcmsuite.torch. Extend the package
|
|
14
|
+
# search path for editable installs as well as wheels installed side by side.
|
|
15
|
+
__path__ = extend_path(__path__, __name__)
|
|
16
|
+
|
|
17
|
+
from . import context as context
|
|
18
|
+
from . import daemon as daemon
|
|
19
|
+
from . import editing as editing
|
|
20
|
+
from . import results as results
|
|
21
|
+
from . import templates as templates
|
|
22
|
+
from .contract import NAMESPACED_API_MODULE_MAP as NAMESPACED_API_MODULE_MAP
|
|
23
|
+
from .contract import PUBLIC_API_EXPORTS as PUBLIC_API_EXPORTS
|
|
24
|
+
from .contract import PUBLIC_API_MODULE_MAP as PUBLIC_API_MODULE_MAP
|
|
25
|
+
from .geo import geo as geo
|
|
26
|
+
from .info import info as info
|
|
27
|
+
from .solve import solve as solve
|
|
28
|
+
from .view import view as view
|
|
29
|
+
|
|
30
|
+
__all__ = ["info", "solve", "geo", "view"]
|
|
31
|
+
|
|
32
|
+
if TYPE_CHECKING:
|
|
33
|
+
from . import torch as torch
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def __getattr__(name: str) -> ModuleType:
|
|
37
|
+
if name != "torch":
|
|
38
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
39
|
+
try:
|
|
40
|
+
module: ModuleType = import_module(".torch", __name__)
|
|
41
|
+
except ModuleNotFoundError as error:
|
|
42
|
+
if error.name != "jcmsuite.torch":
|
|
43
|
+
raise
|
|
44
|
+
raise ModuleNotFoundError(
|
|
45
|
+
'Install the matching Torch integration with pip install "jcmsuite[torch]".',
|
|
46
|
+
name="jcmsuite.torch",
|
|
47
|
+
) from error
|
|
48
|
+
globals()[name] = module
|
|
49
|
+
return module
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (c) 2001-2026 JCMwave GmbH
|
|
3
|
+
|
|
4
|
+
"""Public runtime context API for `jcmsuite`."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from ..exceptions import RuntimeContextError
|
|
9
|
+
from .models import (
|
|
10
|
+
BackendMode,
|
|
11
|
+
GPUSelection,
|
|
12
|
+
JCMInfoDetails,
|
|
13
|
+
JCMInstallationDetails,
|
|
14
|
+
JCMInterfaceDetails,
|
|
15
|
+
JCMLicenseDetails,
|
|
16
|
+
JCMSystemDetails,
|
|
17
|
+
)
|
|
18
|
+
from .scope import (
|
|
19
|
+
create_context,
|
|
20
|
+
get_current_context,
|
|
21
|
+
get_default_context,
|
|
22
|
+
reset_default_context,
|
|
23
|
+
resolve_context,
|
|
24
|
+
set_default_context,
|
|
25
|
+
)
|
|
26
|
+
from .solver_context import SolverContext
|
|
27
|
+
|
|
28
|
+
__all__: list[str] = [
|
|
29
|
+
"BackendMode",
|
|
30
|
+
"GPUSelection",
|
|
31
|
+
"JCMInfoDetails",
|
|
32
|
+
"JCMInterfaceDetails",
|
|
33
|
+
"JCMInstallationDetails",
|
|
34
|
+
"JCMLicenseDetails",
|
|
35
|
+
"JCMSystemDetails",
|
|
36
|
+
"RuntimeContextError",
|
|
37
|
+
"SolverContext",
|
|
38
|
+
"create_context",
|
|
39
|
+
"get_current_context",
|
|
40
|
+
"get_default_context",
|
|
41
|
+
"resolve_context",
|
|
42
|
+
"reset_default_context",
|
|
43
|
+
"set_default_context",
|
|
44
|
+
]
|