jcmsuite 7.4.2__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.
Potentially problematic release.
This version of jcmsuite might be problematic. Click here for more details.
- jcmsuite-7.4.2/PKG-INFO +180 -0
- jcmsuite-7.4.2/README.pypi.md +151 -0
- jcmsuite-7.4.2/pyproject.toml +128 -0
- jcmsuite-7.4.2/src/jcmsuite/__init__.py +22 -0
- jcmsuite-7.4.2/src/jcmsuite/_build_info.py +4 -0
- jcmsuite-7.4.2/src/jcmsuite/context/__init__.py +44 -0
- jcmsuite-7.4.2/src/jcmsuite/context/interface_metadata.py +158 -0
- jcmsuite-7.4.2/src/jcmsuite/context/models.py +213 -0
- jcmsuite-7.4.2/src/jcmsuite/context/scope.py +210 -0
- jcmsuite-7.4.2/src/jcmsuite/context/solver_context.py +569 -0
- jcmsuite-7.4.2/src/jcmsuite/context/subprocess_tools.py +172 -0
- jcmsuite-7.4.2/src/jcmsuite/contract.py +47 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/__init__.py +19 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/handler.py +925 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/internal/__init__.py +4 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/internal/bundle_protocol.py +64 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/internal/handler_helpers.py +368 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/internal/handler_resource_jobs.py +227 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/internal/handler_wait.py +564 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/models.py +349 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/namespaces.py +250 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/protocol.py +801 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/resources.py +407 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/scope.py +53 -0
- jcmsuite-7.4.2/src/jcmsuite/daemon/transport.py +223 -0
- jcmsuite-7.4.2/src/jcmsuite/editing/__init__.py +10 -0
- jcmsuite-7.4.2/src/jcmsuite/editing/editor.py +274 -0
- jcmsuite-7.4.2/src/jcmsuite/exceptions/__init__.py +32 -0
- jcmsuite-7.4.2/src/jcmsuite/exceptions/errors.py +173 -0
- jcmsuite-7.4.2/src/jcmsuite/geo/__init__.py +10 -0
- jcmsuite-7.4.2/src/jcmsuite/geo/mesh.py +302 -0
- jcmsuite-7.4.2/src/jcmsuite/info/__init__.py +10 -0
- jcmsuite-7.4.2/src/jcmsuite/info/runtime_info.py +45 -0
- jcmsuite-7.4.2/src/jcmsuite/internal/__init__.py +2 -0
- jcmsuite-7.4.2/src/jcmsuite/internal/diagnostics.py +74 -0
- jcmsuite-7.4.2/src/jcmsuite/internal/progress.py +80 -0
- jcmsuite-7.4.2/src/jcmsuite/loaders/__init__.py +18 -0
- jcmsuite-7.4.2/src/jcmsuite/loaders/blob_header.py +315 -0
- jcmsuite-7.4.2/src/jcmsuite/loaders/cartesian_field_reader.py +249 -0
- jcmsuite-7.4.2/src/jcmsuite/loaders/cartesian_fields.py +324 -0
- jcmsuite-7.4.2/src/jcmsuite/loaders/nested_mapping.py +69 -0
- jcmsuite-7.4.2/src/jcmsuite/loaders/powerflux.py +136 -0
- jcmsuite-7.4.2/src/jcmsuite/loaders/table.py +637 -0
- jcmsuite-7.4.2/src/jcmsuite/logging/__init__.py +22 -0
- jcmsuite-7.4.2/src/jcmsuite/logging/runtime.py +210 -0
- jcmsuite-7.4.2/src/jcmsuite/results/__init__.py +126 -0
- jcmsuite-7.4.2/src/jcmsuite/results/artifacts.py +806 -0
- jcmsuite-7.4.2/src/jcmsuite/results/discovery.py +82 -0
- jcmsuite-7.4.2/src/jcmsuite/results/field_exports.py +1062 -0
- jcmsuite-7.4.2/src/jcmsuite/results/field_payloads.py +453 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/__init__.py +4 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/__init__.py +4 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/common.py +56 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/pandas/__init__.py +4 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/pandas/common.py +165 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/pandas/payload.py +480 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/pandas/rows.py +484 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/preview.py +178 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/xarray/__init__.py +4 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/xarray/export.py +688 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/xarray/grouped.py +608 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/xarray/headers.py +290 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/xarray/runtime.py +99 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/xarray/shared.py +246 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/xarray/tabular.py +304 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/export/xarray/types.py +28 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/models/__init__.py +4 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/models/batch.py +1081 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/models/batch_postprocess.py +1728 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/models/bundle.py +343 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/models/core.py +556 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/models/submission.py +1157 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/resultbag/__init__.py +4 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/resultbag/access.py +489 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/resultbag/iteration.py +199 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/resultbag/query.py +226 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/resultbag/raw.py +407 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/resultbag/source_files.py +142 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/resultbag/store.py +881 -0
- jcmsuite-7.4.2/src/jcmsuite/results/internal/resultbag/utils.py +258 -0
- jcmsuite-7.4.2/src/jcmsuite/results/models.py +76 -0
- jcmsuite-7.4.2/src/jcmsuite/results/opening.py +55 -0
- jcmsuite-7.4.2/src/jcmsuite/results/pandas_export.py +325 -0
- jcmsuite-7.4.2/src/jcmsuite/results/payloads.py +478 -0
- jcmsuite-7.4.2/src/jcmsuite/results/postprocess.py +97 -0
- jcmsuite-7.4.2/src/jcmsuite/results/postprocess_payloads.py +757 -0
- jcmsuite-7.4.2/src/jcmsuite/results/postprocess_record.py +418 -0
- jcmsuite-7.4.2/src/jcmsuite/results/resultbag.py +279 -0
- jcmsuite-7.4.2/src/jcmsuite/results/resultbag_management.py +433 -0
- jcmsuite-7.4.2/src/jcmsuite/results/structured_derivatives.py +387 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/__init__.py +10 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/daemon_bundle_staging.py +100 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/daemon_bundle_wait.py +89 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/orchestration.py +1576 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/orchestration_execution.py +180 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/orchestration_routing.py +128 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/orchestration_support.py +323 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/path_resolution.py +98 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/progress.py +20 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/solver.py +709 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/staging.py +264 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/types.py +25 -0
- jcmsuite-7.4.2/src/jcmsuite/solve/working_dirs.py +227 -0
- jcmsuite-7.4.2/src/jcmsuite/templates/__init__.py +11 -0
- jcmsuite-7.4.2/src/jcmsuite/templates/converter.py +71 -0
- jcmsuite-7.4.2/src/jcmsuite/templates/formatting.py +335 -0
- jcmsuite-7.4.2/src/jcmsuite/templates/formatting_cli.py +47 -0
- jcmsuite-7.4.2/src/jcmsuite/templates/rendering.py +666 -0
- jcmsuite-7.4.2/src/jcmsuite/torch/__init__.py +25 -0
- jcmsuite-7.4.2/src/jcmsuite/torch/autograd.py +488 -0
- jcmsuite-7.4.2/src/jcmsuite/torch/coordinate_policy.py +82 -0
- jcmsuite-7.4.2/src/jcmsuite/torch/core.py +312 -0
- jcmsuite-7.4.2/src/jcmsuite/torch/results/__init__.py +51 -0
- jcmsuite-7.4.2/src/jcmsuite/torch/types.py +84 -0
- jcmsuite-7.4.2/src/jcmsuite/torch/validation.py +208 -0
- jcmsuite-7.4.2/src/jcmsuite/torch/wrappers.py +4332 -0
- jcmsuite-7.4.2/src/jcmsuite/view/__init__.py +10 -0
- jcmsuite-7.4.2/src/jcmsuite/view/viewer.py +122 -0
jcmsuite-7.4.2/PKG-INFO
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jcmsuite
|
|
3
|
+
Version: 7.4.2
|
|
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: progress
|
|
15
|
+
Provides-Extra: torch
|
|
16
|
+
Requires-Dist: jcmsuite-data-tree (>=7.4.2,<7.5.0)
|
|
17
|
+
Requires-Dist: numpy (>=2.1.0,<3.0)
|
|
18
|
+
Requires-Dist: pandas (>=2.2.3,<4.0)
|
|
19
|
+
Requires-Dist: scipy (>=1.14.1,<2.0)
|
|
20
|
+
Requires-Dist: torch (>=2.6,<3.0) ; extra == "all"
|
|
21
|
+
Requires-Dist: torch (>=2.6,<3.0) ; extra == "torch"
|
|
22
|
+
Requires-Dist: tqdm (>=4.50,<5.0) ; extra == "all"
|
|
23
|
+
Requires-Dist: tqdm (>=4.50,<5.0) ; extra == "progress"
|
|
24
|
+
Requires-Dist: xarray (>=2024.10.0,<2027.0)
|
|
25
|
+
Project-URL: Documentation, https://docs.jcmwave.com/JCMsuite/html/
|
|
26
|
+
Project-URL: Homepage, https://www.jcmwave.com
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# JCMsuite Python Interface (`jcmsuite`)
|
|
30
|
+
|
|
31
|
+
Python interface for JCMsuite solver workflows. Run projects, manage local and
|
|
32
|
+
daemon execution, and inspect or export result data from Python.
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- **Project execution:** Generate meshes and run JCMsuite projects from Python.
|
|
37
|
+
- **Parameterized projects:** Supply project keys to templates, including nested
|
|
38
|
+
values and numeric arrays, to vary geometry, materials, and sources.
|
|
39
|
+
- **Parameter scans:** Run ordered batches with isolated working directories.
|
|
40
|
+
- **Parallel execution:** Schedule solves on local or remote workstations and
|
|
41
|
+
configured cluster queues through the JCMsuite daemon.
|
|
42
|
+
- **Structured results:** Inspect costs, eigenvalues, postprocesses, and exported
|
|
43
|
+
fields. Supported result types export to dictionaries, pandas, and xarray.
|
|
44
|
+
- **Persistent results:** Store and reuse matching solves with `Resultbag`.
|
|
45
|
+
|
|
46
|
+
## Requirements
|
|
47
|
+
|
|
48
|
+
- Python 3.13 or later.
|
|
49
|
+
- A separate JCMsuite installation for solver operations.
|
|
50
|
+
|
|
51
|
+
Installing this Python package does not install the JCMsuite solver. Test
|
|
52
|
+
licenses are available to try JCMsuite; you do not need an existing commercial
|
|
53
|
+
license to get started. See the
|
|
54
|
+
[JCMsuite documentation](https://docs.jcmwave.com/JCMsuite/html/) for installation
|
|
55
|
+
instructions and license information.
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
python -m pip install jcmsuite
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The installation includes NumPy, pandas, SciPy, xarray, and the
|
|
64
|
+
`jcmsuite-data-tree` support package. Optional features are available as extras:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
python -m pip install "jcmsuite[progress]" # tqdm progress bars
|
|
68
|
+
python -m pip install "jcmsuite[torch]" # PyTorch integration
|
|
69
|
+
python -m pip install "jcmsuite[all]" # both optional features
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Getting Started
|
|
73
|
+
|
|
74
|
+
### Locate JCMsuite
|
|
75
|
+
|
|
76
|
+
Set the `JCMROOT` environment variable to your JCMsuite installation directory
|
|
77
|
+
before starting Python. Then inspect the installation:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import jcmsuite
|
|
81
|
+
|
|
82
|
+
jcmsuite.info()
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Alternatively, select an installation explicitly with a context. Replace the
|
|
86
|
+
example path with your installation directory:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from jcmsuite.context import create_context
|
|
90
|
+
|
|
91
|
+
context = create_context(jcm_root="/path/to/JCMsuite")
|
|
92
|
+
with context:
|
|
93
|
+
jcmsuite.info()
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The context is active only inside the `with` block. The examples below use
|
|
97
|
+
the default context configured through `JCMROOT`.
|
|
98
|
+
|
|
99
|
+
### Run A Project And Inspect Results
|
|
100
|
+
|
|
101
|
+
Pass the path of an existing JCMsuite project to `solve`:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
result = jcmsuite.solve("project.jcmp")
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`project.jcmp` represents a project that you supply; it is not included in this
|
|
108
|
+
package. By default, `solve` waits for completion and returns a `SolveResult`.
|
|
109
|
+
The available data depends on the project and its declared postprocesses.
|
|
110
|
+
For a project with at least one postprocess, inspect its first record:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
postprocess = result.postprocesses[0]
|
|
114
|
+
print(postprocess.to_dict())
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Field exports also support operations such as selecting a field and calculating
|
|
118
|
+
its intensity. Use `jcmsuite.view(result.file)` to open an available solution
|
|
119
|
+
fieldbag in JCMview. JCMview requires a graphical environment.
|
|
120
|
+
|
|
121
|
+
### Pass Project Keys And Run A Scan
|
|
122
|
+
|
|
123
|
+
For a project whose templates already accept a `radius` key, pass its value
|
|
124
|
+
through `keys`:
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
result = jcmsuite.solve("project.jcmp", keys={"radius": 0.3})
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
For a scan, pass a list of project-key dictionaries instead:
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
keys = [{"radius": radius} for radius in (0.3, 0.4, 0.5)]
|
|
134
|
+
results = jcmsuite.solve("project.jcmp", keys=keys, temporary=True, quiet=True)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The returned `BatchSolveResult` preserves input order. `temporary=True` gives
|
|
138
|
+
each solve an isolated working directory so that scan entries do not overwrite
|
|
139
|
+
each other's files. `quiet=True` suppresses local solver output. For compatible
|
|
140
|
+
postprocess data, combine the scan results with
|
|
141
|
+
`results.postprocesses[0].to_xarray()`.
|
|
142
|
+
|
|
143
|
+
### Run Solves In Parallel Or Reuse Results
|
|
144
|
+
|
|
145
|
+
To run the same scan through a local daemon, declare a resource and activate
|
|
146
|
+
the handler around the solve:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
handler = jcmsuite.daemon.handler()
|
|
150
|
+
handler.resources.add(
|
|
151
|
+
jcmsuite.daemon.Workstation(hostname="localhost", multiplicity=2, n_threads=1)
|
|
152
|
+
)
|
|
153
|
+
with handler:
|
|
154
|
+
results = jcmsuite.solve("project.jcmp", keys=keys, temporary=True, quiet=True)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
This configuration allows two concurrent solves with one solver thread each.
|
|
158
|
+
Choose values supported by your computer and available JCMsuite licenses.
|
|
159
|
+
The handler disconnects and stops the daemon when the block ends.
|
|
160
|
+
|
|
161
|
+
For repeated scans, pass a `Resultbag` with `resultbag=` to store results and
|
|
162
|
+
reuse entries that match the project, project keys, suffix pattern, and source-file
|
|
163
|
+
state. Open Resultbag files only from trusted sources: loading them uses Python
|
|
164
|
+
pickle and can execute code.
|
|
165
|
+
|
|
166
|
+
## Documentation and Support
|
|
167
|
+
|
|
168
|
+
See the [JCMsuite documentation](https://docs.jcmwave.com/JCMsuite/html/) for
|
|
169
|
+
manuals, tutorials, and installation instructions. For product and support
|
|
170
|
+
information, visit [JCMwave](https://www.jcmwave.com).
|
|
171
|
+
|
|
172
|
+
The related `jcmsuite-data-tree` and `jcmsuite-notebooks` packages provide
|
|
173
|
+
low-level tree helpers and notebook/Matlab conversion tools. They do not replace
|
|
174
|
+
the main `jcmsuite` solver interface.
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
This Python package is licensed under the MIT License. JCMsuite solver licensing
|
|
179
|
+
is separate.
|
|
180
|
+
|
|
@@ -0,0 +1,151 @@
|
|
|
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, pandas, SciPy, xarray, and the
|
|
36
|
+
`jcmsuite-data-tree` support 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[all]" # both optional features
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Getting Started
|
|
45
|
+
|
|
46
|
+
### Locate JCMsuite
|
|
47
|
+
|
|
48
|
+
Set the `JCMROOT` environment variable to your JCMsuite installation directory
|
|
49
|
+
before starting Python. Then inspect the installation:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import jcmsuite
|
|
53
|
+
|
|
54
|
+
jcmsuite.info()
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Alternatively, select an installation explicitly with a context. Replace the
|
|
58
|
+
example path with your installation directory:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from jcmsuite.context import create_context
|
|
62
|
+
|
|
63
|
+
context = create_context(jcm_root="/path/to/JCMsuite")
|
|
64
|
+
with context:
|
|
65
|
+
jcmsuite.info()
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The context is active only inside the `with` block. The examples below use
|
|
69
|
+
the default context configured through `JCMROOT`.
|
|
70
|
+
|
|
71
|
+
### Run A Project And Inspect Results
|
|
72
|
+
|
|
73
|
+
Pass the path of an existing JCMsuite project to `solve`:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
result = jcmsuite.solve("project.jcmp")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`project.jcmp` represents a project that you supply; it is not included in this
|
|
80
|
+
package. By default, `solve` waits for completion and returns a `SolveResult`.
|
|
81
|
+
The available data depends on the project and its declared postprocesses.
|
|
82
|
+
For a project with at least one postprocess, inspect its first record:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
postprocess = result.postprocesses[0]
|
|
86
|
+
print(postprocess.to_dict())
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Field exports also support operations such as selecting a field and calculating
|
|
90
|
+
its intensity. Use `jcmsuite.view(result.file)` to open an available solution
|
|
91
|
+
fieldbag in JCMview. JCMview requires a graphical environment.
|
|
92
|
+
|
|
93
|
+
### Pass Project Keys And Run A Scan
|
|
94
|
+
|
|
95
|
+
For a project whose templates already accept a `radius` key, pass its value
|
|
96
|
+
through `keys`:
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
result = jcmsuite.solve("project.jcmp", keys={"radius": 0.3})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
For a scan, pass a list of project-key dictionaries instead:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
keys = [{"radius": radius} for radius in (0.3, 0.4, 0.5)]
|
|
106
|
+
results = jcmsuite.solve("project.jcmp", keys=keys, temporary=True, quiet=True)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The returned `BatchSolveResult` preserves input order. `temporary=True` gives
|
|
110
|
+
each solve an isolated working directory so that scan entries do not overwrite
|
|
111
|
+
each other's files. `quiet=True` suppresses local solver output. For compatible
|
|
112
|
+
postprocess data, combine the scan results with
|
|
113
|
+
`results.postprocesses[0].to_xarray()`.
|
|
114
|
+
|
|
115
|
+
### Run Solves In Parallel Or Reuse Results
|
|
116
|
+
|
|
117
|
+
To run the same scan through a local daemon, declare a resource and activate
|
|
118
|
+
the handler around the solve:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
handler = jcmsuite.daemon.handler()
|
|
122
|
+
handler.resources.add(
|
|
123
|
+
jcmsuite.daemon.Workstation(hostname="localhost", multiplicity=2, n_threads=1)
|
|
124
|
+
)
|
|
125
|
+
with handler:
|
|
126
|
+
results = jcmsuite.solve("project.jcmp", keys=keys, temporary=True, quiet=True)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
This configuration allows two concurrent solves with one solver thread each.
|
|
130
|
+
Choose values supported by your computer and available JCMsuite licenses.
|
|
131
|
+
The handler disconnects and stops the daemon when the block ends.
|
|
132
|
+
|
|
133
|
+
For repeated scans, pass a `Resultbag` with `resultbag=` to store results and
|
|
134
|
+
reuse entries that match the project, project keys, suffix pattern, and source-file
|
|
135
|
+
state. Open Resultbag files only from trusted sources: loading them uses Python
|
|
136
|
+
pickle and can execute code.
|
|
137
|
+
|
|
138
|
+
## Documentation and Support
|
|
139
|
+
|
|
140
|
+
See the [JCMsuite documentation](https://docs.jcmwave.com/JCMsuite/html/) for
|
|
141
|
+
manuals, tutorials, and installation instructions. For product and support
|
|
142
|
+
information, visit [JCMwave](https://www.jcmwave.com).
|
|
143
|
+
|
|
144
|
+
The related `jcmsuite-data-tree` and `jcmsuite-notebooks` packages provide
|
|
145
|
+
low-level tree helpers and notebook/Matlab conversion tools. They do not replace
|
|
146
|
+
the main `jcmsuite` solver interface.
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
This Python package is licensed under the MIT License. JCMsuite solver licensing
|
|
151
|
+
is separate.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "jcmsuite"
|
|
3
|
+
version = "7.4.2"
|
|
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
|
+
"pandas>=2.2.3,<4.0",
|
|
23
|
+
"scipy>=1.14.1,<2.0",
|
|
24
|
+
"xarray>=2024.10.0,<2027.0",
|
|
25
|
+
"jcmsuite-data-tree>=7.4.2,<7.5.0",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
progress = [
|
|
30
|
+
"tqdm>=4.50,<5.0",
|
|
31
|
+
]
|
|
32
|
+
torch = [
|
|
33
|
+
"torch>=2.6,<3.0",
|
|
34
|
+
]
|
|
35
|
+
all = [
|
|
36
|
+
"tqdm>=4.50,<5.0",
|
|
37
|
+
"torch>=2.6,<3.0",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://www.jcmwave.com"
|
|
42
|
+
Documentation = "https://docs.jcmwave.com/JCMsuite/html/"
|
|
43
|
+
|
|
44
|
+
[project.scripts]
|
|
45
|
+
jcmsuite-format = "jcmsuite.templates.formatting_cli:main"
|
|
46
|
+
|
|
47
|
+
[tool.poetry]
|
|
48
|
+
requires-poetry = ">=2.4.2,<3.0"
|
|
49
|
+
packages = [
|
|
50
|
+
{ include = "jcmsuite", from = "src" },
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[build-system]
|
|
54
|
+
requires = ["poetry-core"]
|
|
55
|
+
build-backend = "poetry.core.masonry.api"
|
|
56
|
+
|
|
57
|
+
[tool.poetry.dependencies]
|
|
58
|
+
numpy = ">=2.1.0,<3.0"
|
|
59
|
+
pandas = ">=2.2.3,<4.0"
|
|
60
|
+
scipy = ">=1.14.1,<2.0"
|
|
61
|
+
xarray = ">=2024.10.0,<2027.0"
|
|
62
|
+
jcmsuite-data-tree = ">=7.4.2,<7.5.0"
|
|
63
|
+
[tool.jcmsuite.release]
|
|
64
|
+
data_tree_package_name = "jcmsuite-data-tree"
|
|
65
|
+
data_tree_package_path = "packages/jcmsuite_data_tree"
|
|
66
|
+
data_tree_version_constraint = ">=7.4.2,<7.5.0"
|
|
67
|
+
notebooks_package_name = "jcmsuite-notebooks"
|
|
68
|
+
notebooks_package_path = "packages/jcmsuite_notebooks"
|
|
69
|
+
|
|
70
|
+
[tool.poetry.group.dev.dependencies]
|
|
71
|
+
nox = { version = "^2026.8.17", extras = ["pbs"] }
|
|
72
|
+
pre-commit = "^4.6.2"
|
|
73
|
+
black = "26.5.1"
|
|
74
|
+
isort = "^9.0.1"
|
|
75
|
+
mypy = "^2.3.1"
|
|
76
|
+
pyright = "^1.1.411"
|
|
77
|
+
ruff = "^0.16.5"
|
|
78
|
+
coverage = "^7.16"
|
|
79
|
+
|
|
80
|
+
# Dependencies for regression testing against legacy code
|
|
81
|
+
[tool.poetry.group.test.dependencies]
|
|
82
|
+
colorama = "^0.4.6"
|
|
83
|
+
notebook = "^7.0.0"
|
|
84
|
+
requests = "^2.34.2"
|
|
85
|
+
unittest-xml-reporting = ">=3.2"
|
|
86
|
+
|
|
87
|
+
[tool.poetry.group.build.dependencies]
|
|
88
|
+
jinja2 = "^3.1"
|
|
89
|
+
|
|
90
|
+
[tool.poetry.group.docs.dependencies]
|
|
91
|
+
sphinx = "^9.1.0"
|
|
92
|
+
myst-parser = "^5.1.0"
|
|
93
|
+
sphinx-rtd-theme = "^3.0.2"
|
|
94
|
+
|
|
95
|
+
[tool.poetry.group.ci.dependencies]
|
|
96
|
+
black = "26.5.1"
|
|
97
|
+
isort = "^9.0.1"
|
|
98
|
+
mypy = "^2.3.1"
|
|
99
|
+
pyright = "^1.1.411"
|
|
100
|
+
ruff = "^0.16.5"
|
|
101
|
+
junit-xml = "^1.9"
|
|
102
|
+
pylint = "^4.0.8"
|
|
103
|
+
pylint_junit = "^0.3.5"
|
|
104
|
+
|
|
105
|
+
[tool.ruff]
|
|
106
|
+
output-format = "junit"
|
|
107
|
+
exclude = [ "tests", "legacy_jcmwave", "scripts/testing/local"]
|
|
108
|
+
# Scratch CI checkouts have no .git directory, so Ruff cannot rely on .gitignore.
|
|
109
|
+
# Slash-containing patterns refer to root outputs, preserving scripts/build.
|
|
110
|
+
extend-exclude = [".venv", ".nox", ".tox", ".cache", "ci-results", "build/*", "dist/*", "tmp/*"]
|
|
111
|
+
|
|
112
|
+
[tool.ruff.lint]
|
|
113
|
+
select = ["E4", "E7", "E9", "F"]
|
|
114
|
+
|
|
115
|
+
[tool.black]
|
|
116
|
+
target-version = ["py313"]
|
|
117
|
+
|
|
118
|
+
[tool.mypy]
|
|
119
|
+
check_untyped_defs = true
|
|
120
|
+
python_version = "3.13"
|
|
121
|
+
exclude = ["^tests/", "^legacy_jcmwave/"] # Regex
|
|
122
|
+
|
|
123
|
+
[tool.coverage.run]
|
|
124
|
+
source = [ "jcmsuite" ]
|
|
125
|
+
omit = [
|
|
126
|
+
"tests/",
|
|
127
|
+
"legacy_jcmwave/"
|
|
128
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
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 . import context as context
|
|
9
|
+
from . import daemon as daemon
|
|
10
|
+
from . import editing as editing
|
|
11
|
+
from . import results as results
|
|
12
|
+
from . import templates as templates
|
|
13
|
+
from . import torch as torch
|
|
14
|
+
from .contract import NAMESPACED_API_MODULE_MAP as NAMESPACED_API_MODULE_MAP
|
|
15
|
+
from .contract import PUBLIC_API_EXPORTS as PUBLIC_API_EXPORTS
|
|
16
|
+
from .contract import PUBLIC_API_MODULE_MAP as PUBLIC_API_MODULE_MAP
|
|
17
|
+
from .geo import geo as geo
|
|
18
|
+
from .info import info as info
|
|
19
|
+
from .solve import solve as solve
|
|
20
|
+
from .view import view as view
|
|
21
|
+
|
|
22
|
+
__all__ = ["info", "solve", "geo", "view"]
|
|
@@ -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
|
+
]
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (c) 2001-2026 JCMwave GmbH
|
|
3
|
+
|
|
4
|
+
"""Helpers for Python-interface package metadata shown by ``jcmsuite.info``."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
import subprocess
|
|
10
|
+
import tomllib
|
|
11
|
+
from importlib import import_module, metadata
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
from .models import JCMInterfaceDetails
|
|
15
|
+
|
|
16
|
+
PACKAGE_NAME: str = "jcmsuite"
|
|
17
|
+
UNKNOWN_BUILD_SHA: str = "unknown"
|
|
18
|
+
UNKNOWN_BUILD_TIMESTAMP: str = "unknown"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _load_embedded_git_sha() -> str | None:
|
|
22
|
+
"""Return the git SHA baked into the installed package when available."""
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
build_info_module = import_module(f"{PACKAGE_NAME}._build_info")
|
|
26
|
+
except ImportError:
|
|
27
|
+
return None
|
|
28
|
+
|
|
29
|
+
raw_sha: object = getattr(build_info_module, "BUILD_GIT_SHA", None)
|
|
30
|
+
if not isinstance(raw_sha, str):
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
git_sha: str = raw_sha.strip()
|
|
34
|
+
if not git_sha or git_sha == UNKNOWN_BUILD_SHA:
|
|
35
|
+
return None
|
|
36
|
+
return git_sha
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _load_embedded_build_timestamp() -> str | None:
|
|
40
|
+
"""Return the build timestamp baked into the installed package."""
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
build_info_module = import_module(f"{PACKAGE_NAME}._build_info")
|
|
44
|
+
except ImportError:
|
|
45
|
+
return None
|
|
46
|
+
|
|
47
|
+
raw_timestamp: object = getattr(build_info_module, "BUILD_TIMESTAMP", None)
|
|
48
|
+
if not isinstance(raw_timestamp, str):
|
|
49
|
+
return None
|
|
50
|
+
|
|
51
|
+
build_timestamp: str = raw_timestamp.strip()
|
|
52
|
+
if not build_timestamp or build_timestamp == UNKNOWN_BUILD_TIMESTAMP:
|
|
53
|
+
return None
|
|
54
|
+
return build_timestamp
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _load_environment_git_sha() -> str | None:
|
|
58
|
+
"""Return an interface git SHA from well-known CI/build env vars."""
|
|
59
|
+
|
|
60
|
+
env_key: str
|
|
61
|
+
for env_key in ("JCMSUITE_INTERFACE_GIT_SHA", "CI_COMMIT_SHA"):
|
|
62
|
+
raw_value: str | None = os.environ.get(env_key)
|
|
63
|
+
if raw_value is None:
|
|
64
|
+
continue
|
|
65
|
+
git_sha: str = raw_value.strip()
|
|
66
|
+
if git_sha:
|
|
67
|
+
return git_sha
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _load_checkout_git_sha() -> str | None:
|
|
72
|
+
"""Return the current checkout SHA when running from a git worktree."""
|
|
73
|
+
|
|
74
|
+
source_path: Path = Path(__file__).resolve()
|
|
75
|
+
candidate_root: Path
|
|
76
|
+
for candidate_root in (source_path.parent, *source_path.parents):
|
|
77
|
+
if not (candidate_root / ".git").exists():
|
|
78
|
+
continue
|
|
79
|
+
completed: subprocess.CompletedProcess[str] = subprocess.run(
|
|
80
|
+
["git", "-C", str(candidate_root), "rev-parse", "HEAD"],
|
|
81
|
+
check=False,
|
|
82
|
+
text=True,
|
|
83
|
+
capture_output=True,
|
|
84
|
+
)
|
|
85
|
+
if completed.returncode != 0:
|
|
86
|
+
return None
|
|
87
|
+
git_sha: str = completed.stdout.strip()
|
|
88
|
+
return git_sha or None
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _load_package_version() -> str | None:
|
|
93
|
+
"""Return the local source-tree version or the installed package version."""
|
|
94
|
+
|
|
95
|
+
source_path: Path = Path(__file__).resolve()
|
|
96
|
+
candidate_root: Path
|
|
97
|
+
for candidate_root in (source_path.parent, *source_path.parents):
|
|
98
|
+
pyproject_path: Path = candidate_root / "pyproject.toml"
|
|
99
|
+
if not pyproject_path.is_file():
|
|
100
|
+
continue
|
|
101
|
+
pyproject_data: dict[str, object] = tomllib.loads(
|
|
102
|
+
pyproject_path.read_text(encoding="utf-8")
|
|
103
|
+
)
|
|
104
|
+
project_data: object = pyproject_data.get("project")
|
|
105
|
+
if not isinstance(project_data, dict):
|
|
106
|
+
return None
|
|
107
|
+
raw_version: object = project_data.get("version")
|
|
108
|
+
if isinstance(raw_version, str) and raw_version.strip():
|
|
109
|
+
return raw_version.strip()
|
|
110
|
+
return None
|
|
111
|
+
|
|
112
|
+
try:
|
|
113
|
+
return metadata.version(PACKAGE_NAME)
|
|
114
|
+
except metadata.PackageNotFoundError:
|
|
115
|
+
return None
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def load_interface_details() -> JCMInterfaceDetails:
|
|
119
|
+
"""Resolve structured metadata for the Python interface package."""
|
|
120
|
+
|
|
121
|
+
embedded_git_sha: str | None = _load_embedded_git_sha()
|
|
122
|
+
embedded_build_timestamp: str | None = _load_embedded_build_timestamp()
|
|
123
|
+
if embedded_git_sha is not None:
|
|
124
|
+
return JCMInterfaceDetails(
|
|
125
|
+
package_name=PACKAGE_NAME,
|
|
126
|
+
version=_load_package_version(),
|
|
127
|
+
git_commit_sha=embedded_git_sha,
|
|
128
|
+
git_commit_sha_source="embedded",
|
|
129
|
+
build_timestamp=embedded_build_timestamp,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
environment_git_sha: str | None = _load_environment_git_sha()
|
|
133
|
+
if environment_git_sha is not None:
|
|
134
|
+
return JCMInterfaceDetails(
|
|
135
|
+
package_name=PACKAGE_NAME,
|
|
136
|
+
version=_load_package_version(),
|
|
137
|
+
git_commit_sha=environment_git_sha,
|
|
138
|
+
git_commit_sha_source="environment",
|
|
139
|
+
build_timestamp=embedded_build_timestamp,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
checkout_git_sha: str | None = _load_checkout_git_sha()
|
|
143
|
+
if checkout_git_sha is not None:
|
|
144
|
+
return JCMInterfaceDetails(
|
|
145
|
+
package_name=PACKAGE_NAME,
|
|
146
|
+
version=_load_package_version(),
|
|
147
|
+
git_commit_sha=checkout_git_sha,
|
|
148
|
+
git_commit_sha_source="git",
|
|
149
|
+
build_timestamp=embedded_build_timestamp,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
return JCMInterfaceDetails(
|
|
153
|
+
package_name=PACKAGE_NAME,
|
|
154
|
+
version=_load_package_version(),
|
|
155
|
+
git_commit_sha=None,
|
|
156
|
+
git_commit_sha_source="unknown",
|
|
157
|
+
build_timestamp=embedded_build_timestamp,
|
|
158
|
+
)
|