RSSeismicScripting 3.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.
- rsseismicscripting-3.0.0/License.txt +20 -0
- rsseismicscripting-3.0.0/PKG-INFO +88 -0
- rsseismicscripting-3.0.0/README.md +68 -0
- rsseismicscripting-3.0.0/pyproject.toml +34 -0
- rsseismicscripting-3.0.0/setup.cfg +4 -0
- rsseismicscripting-3.0.0/src/RSSeismicScripting.egg-info/PKG-INFO +88 -0
- rsseismicscripting-3.0.0/src/RSSeismicScripting.egg-info/SOURCES.txt +125 -0
- rsseismicscripting-3.0.0/src/RSSeismicScripting.egg-info/dependency_links.txt +1 -0
- rsseismicscripting-3.0.0/src/RSSeismicScripting.egg-info/requires.txt +4 -0
- rsseismicscripting-3.0.0/src/RSSeismicScripting.egg-info/top_level.txt +1 -0
- rsseismicscripting-3.0.0/src/rsseismic/Application.py +196 -0
- rsseismicscripting-3.0.0/src/rsseismic/ApplicationManager.py +111 -0
- rsseismicscripting-3.0.0/src/rsseismic/BedrockLayer.py +29 -0
- rsseismicscripting-3.0.0/src/rsseismic/MeanProfile.py +169 -0
- rsseismicscripting-3.0.0/src/rsseismic/MeanProfileSoilLayer.py +119 -0
- rsseismicscripting-3.0.0/src/rsseismic/Model.py +204 -0
- rsseismicscripting-3.0.0/src/rsseismic/Motions.py +140 -0
- rsseismicscripting-3.0.0/src/rsseismic/ProfileGenerationSettings.py +29 -0
- rsseismicscripting-3.0.0/src/rsseismic/Profiles.py +186 -0
- rsseismicscripting-3.0.0/src/rsseismic/ProjectSettings.py +46 -0
- rsseismicscripting-3.0.0/src/rsseismic/ReferenceCurve.py +73 -0
- rsseismicscripting-3.0.0/src/rsseismic/Results.py +419 -0
- rsseismicscripting-3.0.0/src/rsseismic/SoilLayer.py +34 -0
- rsseismicscripting-3.0.0/src/rsseismic/SoilLayerCurve.py +124 -0
- rsseismicscripting-3.0.0/src/rsseismic/SoilLayerOperations.py +120 -0
- rsseismicscripting-3.0.0/src/rsseismic/__init__.py +79 -0
- rsseismicscripting-3.0.0/src/rsseismic/_application_paths.py +74 -0
- rsseismicscripting-3.0.0/src/rsseismic/_batch_compute.py +420 -0
- rsseismicscripting-3.0.0/src/rsseismic/_client.py +81 -0
- rsseismicscripting-3.0.0/src/rsseismic/_proto_converters.py +345 -0
- rsseismicscripting-3.0.0/src/rsseismic/_proxyObject.py +11 -0
- rsseismicscripting-3.0.0/src/rsseismic/_result_bulk_dataframes.py +202 -0
- rsseismicscripting-3.0.0/src/rsseismic/_result_dataframes.py +77 -0
- rsseismicscripting-3.0.0/src/rsseismic/_rpc_helpers.py +55 -0
- rsseismicscripting-3.0.0/src/rsseismic/enums/__init__.py +23 -0
- rsseismicscripting-3.0.0/src/rsseismic/enums/_generated.py +120 -0
- rsseismicscripting-3.0.0/src/rsseismic/enums/fitting_procedure.py +15 -0
- rsseismicscripting-3.0.0/src/rsseismic/exceptions.py +11 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ApplicationService_pb2.py +46 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ApplicationService_pb2.pyi +67 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ApplicationService_pb2_grpc.py +274 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/BedrockLayerDataService_pb2.py +27 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/BedrockLayerDataService_pb2.pyi +5 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/BedrockLayerDataService_pb2_grpc.py +231 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/CommonMessages_pb2.py +50 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/CommonMessages_pb2.pyi +113 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/CommonMessages_pb2_grpc.py +29 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/MeanProfileService_pb2.py +62 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/MeanProfileService_pb2.pyi +176 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/MeanProfileService_pb2_grpc.py +458 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/MeanProfileSoilLayerDataService_pb2.py +45 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/MeanProfileSoilLayerDataService_pb2.pyi +87 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/MeanProfileSoilLayerDataService_pb2_grpc.py +360 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ModelService_pb2.py +54 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ModelService_pb2.pyi +122 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ModelService_pb2_grpc.py +360 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/MotionService_pb2.py +78 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/MotionService_pb2.pyi +224 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/MotionService_pb2_grpc.py +575 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ProfileGenerationSettingsService_pb2.py +27 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ProfileGenerationSettingsService_pb2.pyi +5 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ProfileGenerationSettingsService_pb2_grpc.py +145 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ProfileService_pb2.py +76 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ProfileService_pb2.pyi +246 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ProfileService_pb2_grpc.py +532 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ProjectSettingsDataService_pb2.py +35 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ProjectSettingsDataService_pb2.pyi +40 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ProjectSettingsDataService_pb2_grpc.py +232 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ReferenceCurveDataService_pb2.py +41 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ReferenceCurveDataService_pb2.pyi +73 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ReferenceCurveDataService_pb2_grpc.py +281 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ResultsService_pb2.py +82 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ResultsService_pb2.pyi +373 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/ResultsService_pb2_grpc.py +489 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/SoilLayerCurveDataService_pb2.py +52 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/SoilLayerCurveDataService_pb2.pyi +150 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/SoilLayerCurveDataService_pb2_grpc.py +280 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/SoilLayerDataService_pb2.py +27 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/SoilLayerDataService_pb2.pyi +5 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/SoilLayerDataService_pb2_grpc.py +231 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/SoilLayerService_pb2.py +46 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/SoilLayerService_pb2.pyi +122 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/SoilLayerService_pb2_grpc.py +317 -0
- rsseismicscripting-3.0.0/src/rsseismic/generatedFiles/__init__.py +4 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/_PropertyAccessor.py +151 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/__init__.py +6 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/bedrockLayer/__init__.py +1 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/bedrockLayer/_generated.py +127 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/meanProfileSoilLayer/__init__.py +1 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/meanProfileSoilLayer/_generated.py +87 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/profileGenerationSettings/__init__.py +1 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/profileGenerationSettings/_generated.py +195 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/projectSettings/__init__.py +1 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/projectSettings/_generated.py +270 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/referenceCurve/__init__.py +1 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/referenceCurve/_generated.py +264 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/soilLayer/__init__.py +1 -0
- rsseismicscripting-3.0.0/src/rsseismic/properties/soilLayer/_generated.py +523 -0
- rsseismicscripting-3.0.0/src/rsseismic/types.py +311 -0
- rsseismicscripting-3.0.0/tests/test_application_manager.py +28 -0
- rsseismicscripting-3.0.0/tests/test_auto_profile_workflow.py +76 -0
- rsseismicscripting-3.0.0/tests/test_batch_compute.py +297 -0
- rsseismicscripting-3.0.0/tests/test_bedrock_layer.py +95 -0
- rsseismicscripting-3.0.0/tests/test_connection.py +29 -0
- rsseismicscripting-3.0.0/tests/test_fem_verification_workflow.py +189 -0
- rsseismicscripting-3.0.0/tests/test_generated_enums.py +55 -0
- rsseismicscripting-3.0.0/tests/test_generated_property_enums.py +174 -0
- rsseismicscripting-3.0.0/tests/test_mean_profile.py +271 -0
- rsseismicscripting-3.0.0/tests/test_mean_profile_soil_layer.py +175 -0
- rsseismicscripting-3.0.0/tests/test_model_generate_profiles.py +124 -0
- rsseismicscripting-3.0.0/tests/test_model_run_compute.py +73 -0
- rsseismicscripting-3.0.0/tests/test_motions.py +276 -0
- rsseismicscripting-3.0.0/tests/test_multi_open_scripting.py +227 -0
- rsseismicscripting-3.0.0/tests/test_profile_generation_settings.py +95 -0
- rsseismicscripting-3.0.0/tests/test_profiles.py +387 -0
- rsseismicscripting-3.0.0/tests/test_project_settings.py +125 -0
- rsseismicscripting-3.0.0/tests/test_reference_curve.py +204 -0
- rsseismicscripting-3.0.0/tests/test_result_bulk_dataframes.py +290 -0
- rsseismicscripting-3.0.0/tests/test_result_bulk_dataframes_integration.py +231 -0
- rsseismicscripting-3.0.0/tests/test_result_dataframes.py +113 -0
- rsseismicscripting-3.0.0/tests/test_results.py +122 -0
- rsseismicscripting-3.0.0/tests/test_results_dataframes_integration.py +195 -0
- rsseismicscripting-3.0.0/tests/test_rpc_helpers.py +40 -0
- rsseismicscripting-3.0.0/tests/test_single_profile_workflow.py +88 -0
- rsseismicscripting-3.0.0/tests/test_soil_layer.py +111 -0
- rsseismicscripting-3.0.0/tests/test_soil_layer_curve.py +216 -0
- rsseismicscripting-3.0.0/tests/test_soil_layer_operations.py +172 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2026 Rocscience Inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: RSSeismicScripting
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Client library for interacting with RSSeismic (DeepSoil) through Python
|
|
5
|
+
Author: Rocscience
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://www.rocscience.com/software/rsseismic
|
|
8
|
+
Project-URL: Documentation, https://rocscience.github.io/rsseismic-scripting/
|
|
9
|
+
Keywords: Rocscience,RSSeismic,DeepSoil,Scripting,RocScript,Geotechnical,Seismic
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: License.txt
|
|
15
|
+
Requires-Dist: grpcio>=1.64.1
|
|
16
|
+
Requires-Dist: protobuf<6.0
|
|
17
|
+
Requires-Dist: pandas>=2.0
|
|
18
|
+
Requires-Dist: matplotlib>=3.7
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
## Introduction
|
|
22
|
+
|
|
23
|
+
This repo contains the reference manual for the RSSeismic scripting library. The RSSeismic scripting library is used to interact with the RSSeismic application through Python.
|
|
24
|
+
|
|
25
|
+
| Resource | Link |
|
|
26
|
+
|----------|------|
|
|
27
|
+
| **Reference manual (this site)** | https://rocscience.github.io/rsseismic-scripting/ |
|
|
28
|
+
| **PyPI package** | https://pypi.org/project/RSSeismicScripting/ |
|
|
29
|
+
| **RSSeismic release notes** | https://www.rocscience.com/support/rsseismic/release-notes |
|
|
30
|
+
| **Program downloads** | https://www.rocscience.com/support/program-downloads |
|
|
31
|
+
|
|
32
|
+
### Goal
|
|
33
|
+
|
|
34
|
+
Each function exposed corresponds to an equivalent operation you could have done through the UI.
|
|
35
|
+
Using this idea, the user should be able to edit models and get results without having to go through the UI at all.
|
|
36
|
+
Although only a limited set of functionality is exposed for now, the library covers the main scripting workflows. For a list of what is exposed in the current library, see [Exposed Functionality](#exposed-functionality).
|
|
37
|
+
|
|
38
|
+
### Python UI equivalents
|
|
39
|
+
|
|
40
|
+
Events and workflows done in the UI will have equivalents in the Python library.
|
|
41
|
+
Wherever a dialog is shown in the UI, there will be an equivalent class with methods that mimic the dialog's behavior.
|
|
42
|
+
Wherever a warning or error dialog is displayed, an exception will be thrown, or a warning will be displayed in Python instead.
|
|
43
|
+
Wherever you can select and manipulate an entity, identifiers can be used in the library to get references to those entities in Python and objects will be constructed to help you interface with them.
|
|
44
|
+
|
|
45
|
+
### How it works
|
|
46
|
+
|
|
47
|
+
Each function in the library is a wrapper to make an API call to the application.
|
|
48
|
+
Objects retrieved through function calls will often not contain any data themselves, but will instead be proxies, allowing you to get information from the objects in the application.
|
|
49
|
+
For this reason, debugging will sometimes be tricky, as not all data will always be available for you to inspect unless you get it and assign it to a variable yourself.
|
|
50
|
+
|
|
51
|
+
### Warnings
|
|
52
|
+
|
|
53
|
+
References can be *invalidated* whenever the corresponding object in the application is destroyed or reloaded. You will need to watch out for expired references and renew them when needed as it can cause crashes or incorrect results if not managed properly.
|
|
54
|
+
|
|
55
|
+
## Exposed Functionality
|
|
56
|
+
|
|
57
|
+
The library exposes a focused set of RSSeismic workflows through Python. In this version you can:
|
|
58
|
+
|
|
59
|
+
- **Application connection**: Launch RSSeismic with the scripting server (`startApplication`), connect on a port, `ping`, open `.rsseismicfile` projects, create blank projects, adjust `maxConcurrentAnalyses`, run **batch compute** across many project files, and close the client connection.
|
|
60
|
+
|
|
61
|
+
- **Project lifecycle (`Model`)**: Save, save as, close, **run compute** (with optional timeout and partial-success handling), clear results, and automatic profile **generate** / **reset** when that feature is enabled on the project.
|
|
62
|
+
|
|
63
|
+
- **Profiles (`model.Profiles`)**: List, create, copy, delete, and rename profiles; active profile; list soil layers and bedrock; output depths; get **SoilLayer** / **BedrockLayer** property proxies.
|
|
64
|
+
|
|
65
|
+
- **Profile layer CRUD (`model.SoilLayers`)**: Insert, append, delete, duplicate, and move soil layers on the active profile.
|
|
66
|
+
|
|
67
|
+
- **Mean profile (`model.MeanProfile`)**: Structure CRUD on the automatic-generation template; **MeanProfileSoilLayer** properties including vary-with-depth shear wave / shear strength tables and **ReferenceCurve** (without auto-generate on template layers).
|
|
68
|
+
|
|
69
|
+
- **Profile generation settings (`model.ProfileGenerationSettings`)**: Typed getters/setters for randomization, profile count, and related generation parameters.
|
|
70
|
+
|
|
71
|
+
- **Project settings (`model.ProjectSettings`)**: Typed project properties (analysis mode, solver, motions configuration, automatic profile generation, etc.), plus **unit system** get/change.
|
|
72
|
+
|
|
73
|
+
- **Ground motions (`model.Motions`)**: Motion directory preferences (add/remove/list), refresh project motion list, **uni-directional** motion list/selection or **bi-directional** pair list/selection, select-all and per-directory select/deselect.
|
|
74
|
+
|
|
75
|
+
- **Layer properties**: **SoilLayer** (thickness, soil model, unit weight, …), **ReferenceCurve** (curve model, points, generate reference curve on profile layers), **SoilLayerCurve** (dynamics, discrete points, **curve fit** via `FittingProcedureModel`), **BedrockLayer** on realized profiles.
|
|
76
|
+
|
|
77
|
+
- **Results (`model.Results`)**: Result paths and database metadata; compute-aligned motion/layer discovery; **pandas DataFrames** for profile/layer time histories, profile summaries, result series (`ResultSeriesKind`), strain convergence, and real-time displacement; bulk fetch helpers for many motions/layers.
|
|
78
|
+
|
|
79
|
+
- **Public types and enums**: Summary dataclasses (`ProfileSummary`, `MotionInfo`, `ResultDatabaseInfo`, …), `ResultSeriesKind`, `ResultMotionType`, `UnitSystem`, and property enums under `rsseismic.enums` (for example `SoilModel`, `AnalysisMode`, `InputMotionConfiguration`, `FittingProcedureModel`).
|
|
80
|
+
|
|
81
|
+
RPC failures raise **`ScriptingError`**. Some successful RPCs carry advisory text in `errorMessage`; the client logs those as **warnings** (for example duplicate motion directory add).
|
|
82
|
+
|
|
83
|
+
For method-level detail, use the [Scripting reference manual](https://rocscience.github.io/rsseismic-scripting/) (API reference and example scripts).
|
|
84
|
+
|
|
85
|
+
## Getting Started
|
|
86
|
+
|
|
87
|
+
- **Tutorials and workflows (Rocscience Help):** https://www.rocscience.com/help/rsseismic/tutorials/
|
|
88
|
+
- **Product documentation:** https://www.rocscience.com/help/rsseismic/documentation/
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
## Introduction
|
|
2
|
+
|
|
3
|
+
This repo contains the reference manual for the RSSeismic scripting library. The RSSeismic scripting library is used to interact with the RSSeismic application through Python.
|
|
4
|
+
|
|
5
|
+
| Resource | Link |
|
|
6
|
+
|----------|------|
|
|
7
|
+
| **Reference manual (this site)** | https://rocscience.github.io/rsseismic-scripting/ |
|
|
8
|
+
| **PyPI package** | https://pypi.org/project/RSSeismicScripting/ |
|
|
9
|
+
| **RSSeismic release notes** | https://www.rocscience.com/support/rsseismic/release-notes |
|
|
10
|
+
| **Program downloads** | https://www.rocscience.com/support/program-downloads |
|
|
11
|
+
|
|
12
|
+
### Goal
|
|
13
|
+
|
|
14
|
+
Each function exposed corresponds to an equivalent operation you could have done through the UI.
|
|
15
|
+
Using this idea, the user should be able to edit models and get results without having to go through the UI at all.
|
|
16
|
+
Although only a limited set of functionality is exposed for now, the library covers the main scripting workflows. For a list of what is exposed in the current library, see [Exposed Functionality](#exposed-functionality).
|
|
17
|
+
|
|
18
|
+
### Python UI equivalents
|
|
19
|
+
|
|
20
|
+
Events and workflows done in the UI will have equivalents in the Python library.
|
|
21
|
+
Wherever a dialog is shown in the UI, there will be an equivalent class with methods that mimic the dialog's behavior.
|
|
22
|
+
Wherever a warning or error dialog is displayed, an exception will be thrown, or a warning will be displayed in Python instead.
|
|
23
|
+
Wherever you can select and manipulate an entity, identifiers can be used in the library to get references to those entities in Python and objects will be constructed to help you interface with them.
|
|
24
|
+
|
|
25
|
+
### How it works
|
|
26
|
+
|
|
27
|
+
Each function in the library is a wrapper to make an API call to the application.
|
|
28
|
+
Objects retrieved through function calls will often not contain any data themselves, but will instead be proxies, allowing you to get information from the objects in the application.
|
|
29
|
+
For this reason, debugging will sometimes be tricky, as not all data will always be available for you to inspect unless you get it and assign it to a variable yourself.
|
|
30
|
+
|
|
31
|
+
### Warnings
|
|
32
|
+
|
|
33
|
+
References can be *invalidated* whenever the corresponding object in the application is destroyed or reloaded. You will need to watch out for expired references and renew them when needed as it can cause crashes or incorrect results if not managed properly.
|
|
34
|
+
|
|
35
|
+
## Exposed Functionality
|
|
36
|
+
|
|
37
|
+
The library exposes a focused set of RSSeismic workflows through Python. In this version you can:
|
|
38
|
+
|
|
39
|
+
- **Application connection**: Launch RSSeismic with the scripting server (`startApplication`), connect on a port, `ping`, open `.rsseismicfile` projects, create blank projects, adjust `maxConcurrentAnalyses`, run **batch compute** across many project files, and close the client connection.
|
|
40
|
+
|
|
41
|
+
- **Project lifecycle (`Model`)**: Save, save as, close, **run compute** (with optional timeout and partial-success handling), clear results, and automatic profile **generate** / **reset** when that feature is enabled on the project.
|
|
42
|
+
|
|
43
|
+
- **Profiles (`model.Profiles`)**: List, create, copy, delete, and rename profiles; active profile; list soil layers and bedrock; output depths; get **SoilLayer** / **BedrockLayer** property proxies.
|
|
44
|
+
|
|
45
|
+
- **Profile layer CRUD (`model.SoilLayers`)**: Insert, append, delete, duplicate, and move soil layers on the active profile.
|
|
46
|
+
|
|
47
|
+
- **Mean profile (`model.MeanProfile`)**: Structure CRUD on the automatic-generation template; **MeanProfileSoilLayer** properties including vary-with-depth shear wave / shear strength tables and **ReferenceCurve** (without auto-generate on template layers).
|
|
48
|
+
|
|
49
|
+
- **Profile generation settings (`model.ProfileGenerationSettings`)**: Typed getters/setters for randomization, profile count, and related generation parameters.
|
|
50
|
+
|
|
51
|
+
- **Project settings (`model.ProjectSettings`)**: Typed project properties (analysis mode, solver, motions configuration, automatic profile generation, etc.), plus **unit system** get/change.
|
|
52
|
+
|
|
53
|
+
- **Ground motions (`model.Motions`)**: Motion directory preferences (add/remove/list), refresh project motion list, **uni-directional** motion list/selection or **bi-directional** pair list/selection, select-all and per-directory select/deselect.
|
|
54
|
+
|
|
55
|
+
- **Layer properties**: **SoilLayer** (thickness, soil model, unit weight, …), **ReferenceCurve** (curve model, points, generate reference curve on profile layers), **SoilLayerCurve** (dynamics, discrete points, **curve fit** via `FittingProcedureModel`), **BedrockLayer** on realized profiles.
|
|
56
|
+
|
|
57
|
+
- **Results (`model.Results`)**: Result paths and database metadata; compute-aligned motion/layer discovery; **pandas DataFrames** for profile/layer time histories, profile summaries, result series (`ResultSeriesKind`), strain convergence, and real-time displacement; bulk fetch helpers for many motions/layers.
|
|
58
|
+
|
|
59
|
+
- **Public types and enums**: Summary dataclasses (`ProfileSummary`, `MotionInfo`, `ResultDatabaseInfo`, …), `ResultSeriesKind`, `ResultMotionType`, `UnitSystem`, and property enums under `rsseismic.enums` (for example `SoilModel`, `AnalysisMode`, `InputMotionConfiguration`, `FittingProcedureModel`).
|
|
60
|
+
|
|
61
|
+
RPC failures raise **`ScriptingError`**. Some successful RPCs carry advisory text in `errorMessage`; the client logs those as **warnings** (for example duplicate motion directory add).
|
|
62
|
+
|
|
63
|
+
For method-level detail, use the [Scripting reference manual](https://rocscience.github.io/rsseismic-scripting/) (API reference and example scripts).
|
|
64
|
+
|
|
65
|
+
## Getting Started
|
|
66
|
+
|
|
67
|
+
- **Tutorials and workflows (Rocscience Help):** https://www.rocscience.com/help/rsseismic/tutorials/
|
|
68
|
+
- **Product documentation:** https://www.rocscience.com/help/rsseismic/documentation/
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "RSSeismicScripting"
|
|
7
|
+
version = "3.0.0"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"grpcio>=1.64.1",
|
|
10
|
+
"protobuf<6.0",
|
|
11
|
+
"pandas>=2.0",
|
|
12
|
+
"matplotlib>=3.7",
|
|
13
|
+
]
|
|
14
|
+
authors = [
|
|
15
|
+
{ name = "Rocscience" },
|
|
16
|
+
]
|
|
17
|
+
description = "Client library for interacting with RSSeismic (DeepSoil) through Python"
|
|
18
|
+
readme = "README.md"
|
|
19
|
+
requires-python = ">=3.9"
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Topic :: Scientific/Engineering",
|
|
23
|
+
]
|
|
24
|
+
keywords = ["Rocscience", "RSSeismic", "DeepSoil", "Scripting", "RocScript", "Geotechnical", "Seismic"]
|
|
25
|
+
|
|
26
|
+
license = "MIT"
|
|
27
|
+
license-files = ["License.txt"]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://www.rocscience.com/software/rsseismic"
|
|
31
|
+
Documentation = "https://rocscience.github.io/rsseismic-scripting/"
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["src"]
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: RSSeismicScripting
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Client library for interacting with RSSeismic (DeepSoil) through Python
|
|
5
|
+
Author: Rocscience
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://www.rocscience.com/software/rsseismic
|
|
8
|
+
Project-URL: Documentation, https://rocscience.github.io/rsseismic-scripting/
|
|
9
|
+
Keywords: Rocscience,RSSeismic,DeepSoil,Scripting,RocScript,Geotechnical,Seismic
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: License.txt
|
|
15
|
+
Requires-Dist: grpcio>=1.64.1
|
|
16
|
+
Requires-Dist: protobuf<6.0
|
|
17
|
+
Requires-Dist: pandas>=2.0
|
|
18
|
+
Requires-Dist: matplotlib>=3.7
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
## Introduction
|
|
22
|
+
|
|
23
|
+
This repo contains the reference manual for the RSSeismic scripting library. The RSSeismic scripting library is used to interact with the RSSeismic application through Python.
|
|
24
|
+
|
|
25
|
+
| Resource | Link |
|
|
26
|
+
|----------|------|
|
|
27
|
+
| **Reference manual (this site)** | https://rocscience.github.io/rsseismic-scripting/ |
|
|
28
|
+
| **PyPI package** | https://pypi.org/project/RSSeismicScripting/ |
|
|
29
|
+
| **RSSeismic release notes** | https://www.rocscience.com/support/rsseismic/release-notes |
|
|
30
|
+
| **Program downloads** | https://www.rocscience.com/support/program-downloads |
|
|
31
|
+
|
|
32
|
+
### Goal
|
|
33
|
+
|
|
34
|
+
Each function exposed corresponds to an equivalent operation you could have done through the UI.
|
|
35
|
+
Using this idea, the user should be able to edit models and get results without having to go through the UI at all.
|
|
36
|
+
Although only a limited set of functionality is exposed for now, the library covers the main scripting workflows. For a list of what is exposed in the current library, see [Exposed Functionality](#exposed-functionality).
|
|
37
|
+
|
|
38
|
+
### Python UI equivalents
|
|
39
|
+
|
|
40
|
+
Events and workflows done in the UI will have equivalents in the Python library.
|
|
41
|
+
Wherever a dialog is shown in the UI, there will be an equivalent class with methods that mimic the dialog's behavior.
|
|
42
|
+
Wherever a warning or error dialog is displayed, an exception will be thrown, or a warning will be displayed in Python instead.
|
|
43
|
+
Wherever you can select and manipulate an entity, identifiers can be used in the library to get references to those entities in Python and objects will be constructed to help you interface with them.
|
|
44
|
+
|
|
45
|
+
### How it works
|
|
46
|
+
|
|
47
|
+
Each function in the library is a wrapper to make an API call to the application.
|
|
48
|
+
Objects retrieved through function calls will often not contain any data themselves, but will instead be proxies, allowing you to get information from the objects in the application.
|
|
49
|
+
For this reason, debugging will sometimes be tricky, as not all data will always be available for you to inspect unless you get it and assign it to a variable yourself.
|
|
50
|
+
|
|
51
|
+
### Warnings
|
|
52
|
+
|
|
53
|
+
References can be *invalidated* whenever the corresponding object in the application is destroyed or reloaded. You will need to watch out for expired references and renew them when needed as it can cause crashes or incorrect results if not managed properly.
|
|
54
|
+
|
|
55
|
+
## Exposed Functionality
|
|
56
|
+
|
|
57
|
+
The library exposes a focused set of RSSeismic workflows through Python. In this version you can:
|
|
58
|
+
|
|
59
|
+
- **Application connection**: Launch RSSeismic with the scripting server (`startApplication`), connect on a port, `ping`, open `.rsseismicfile` projects, create blank projects, adjust `maxConcurrentAnalyses`, run **batch compute** across many project files, and close the client connection.
|
|
60
|
+
|
|
61
|
+
- **Project lifecycle (`Model`)**: Save, save as, close, **run compute** (with optional timeout and partial-success handling), clear results, and automatic profile **generate** / **reset** when that feature is enabled on the project.
|
|
62
|
+
|
|
63
|
+
- **Profiles (`model.Profiles`)**: List, create, copy, delete, and rename profiles; active profile; list soil layers and bedrock; output depths; get **SoilLayer** / **BedrockLayer** property proxies.
|
|
64
|
+
|
|
65
|
+
- **Profile layer CRUD (`model.SoilLayers`)**: Insert, append, delete, duplicate, and move soil layers on the active profile.
|
|
66
|
+
|
|
67
|
+
- **Mean profile (`model.MeanProfile`)**: Structure CRUD on the automatic-generation template; **MeanProfileSoilLayer** properties including vary-with-depth shear wave / shear strength tables and **ReferenceCurve** (without auto-generate on template layers).
|
|
68
|
+
|
|
69
|
+
- **Profile generation settings (`model.ProfileGenerationSettings`)**: Typed getters/setters for randomization, profile count, and related generation parameters.
|
|
70
|
+
|
|
71
|
+
- **Project settings (`model.ProjectSettings`)**: Typed project properties (analysis mode, solver, motions configuration, automatic profile generation, etc.), plus **unit system** get/change.
|
|
72
|
+
|
|
73
|
+
- **Ground motions (`model.Motions`)**: Motion directory preferences (add/remove/list), refresh project motion list, **uni-directional** motion list/selection or **bi-directional** pair list/selection, select-all and per-directory select/deselect.
|
|
74
|
+
|
|
75
|
+
- **Layer properties**: **SoilLayer** (thickness, soil model, unit weight, …), **ReferenceCurve** (curve model, points, generate reference curve on profile layers), **SoilLayerCurve** (dynamics, discrete points, **curve fit** via `FittingProcedureModel`), **BedrockLayer** on realized profiles.
|
|
76
|
+
|
|
77
|
+
- **Results (`model.Results`)**: Result paths and database metadata; compute-aligned motion/layer discovery; **pandas DataFrames** for profile/layer time histories, profile summaries, result series (`ResultSeriesKind`), strain convergence, and real-time displacement; bulk fetch helpers for many motions/layers.
|
|
78
|
+
|
|
79
|
+
- **Public types and enums**: Summary dataclasses (`ProfileSummary`, `MotionInfo`, `ResultDatabaseInfo`, …), `ResultSeriesKind`, `ResultMotionType`, `UnitSystem`, and property enums under `rsseismic.enums` (for example `SoilModel`, `AnalysisMode`, `InputMotionConfiguration`, `FittingProcedureModel`).
|
|
80
|
+
|
|
81
|
+
RPC failures raise **`ScriptingError`**. Some successful RPCs carry advisory text in `errorMessage`; the client logs those as **warnings** (for example duplicate motion directory add).
|
|
82
|
+
|
|
83
|
+
For method-level detail, use the [Scripting reference manual](https://rocscience.github.io/rsseismic-scripting/) (API reference and example scripts).
|
|
84
|
+
|
|
85
|
+
## Getting Started
|
|
86
|
+
|
|
87
|
+
- **Tutorials and workflows (Rocscience Help):** https://www.rocscience.com/help/rsseismic/tutorials/
|
|
88
|
+
- **Product documentation:** https://www.rocscience.com/help/rsseismic/documentation/
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
License.txt
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/RSSeismicScripting.egg-info/PKG-INFO
|
|
5
|
+
src/RSSeismicScripting.egg-info/SOURCES.txt
|
|
6
|
+
src/RSSeismicScripting.egg-info/dependency_links.txt
|
|
7
|
+
src/RSSeismicScripting.egg-info/requires.txt
|
|
8
|
+
src/RSSeismicScripting.egg-info/top_level.txt
|
|
9
|
+
src/rsseismic/Application.py
|
|
10
|
+
src/rsseismic/ApplicationManager.py
|
|
11
|
+
src/rsseismic/BedrockLayer.py
|
|
12
|
+
src/rsseismic/MeanProfile.py
|
|
13
|
+
src/rsseismic/MeanProfileSoilLayer.py
|
|
14
|
+
src/rsseismic/Model.py
|
|
15
|
+
src/rsseismic/Motions.py
|
|
16
|
+
src/rsseismic/ProfileGenerationSettings.py
|
|
17
|
+
src/rsseismic/Profiles.py
|
|
18
|
+
src/rsseismic/ProjectSettings.py
|
|
19
|
+
src/rsseismic/ReferenceCurve.py
|
|
20
|
+
src/rsseismic/Results.py
|
|
21
|
+
src/rsseismic/SoilLayer.py
|
|
22
|
+
src/rsseismic/SoilLayerCurve.py
|
|
23
|
+
src/rsseismic/SoilLayerOperations.py
|
|
24
|
+
src/rsseismic/__init__.py
|
|
25
|
+
src/rsseismic/_application_paths.py
|
|
26
|
+
src/rsseismic/_batch_compute.py
|
|
27
|
+
src/rsseismic/_client.py
|
|
28
|
+
src/rsseismic/_proto_converters.py
|
|
29
|
+
src/rsseismic/_proxyObject.py
|
|
30
|
+
src/rsseismic/_result_bulk_dataframes.py
|
|
31
|
+
src/rsseismic/_result_dataframes.py
|
|
32
|
+
src/rsseismic/_rpc_helpers.py
|
|
33
|
+
src/rsseismic/exceptions.py
|
|
34
|
+
src/rsseismic/types.py
|
|
35
|
+
src/rsseismic/enums/__init__.py
|
|
36
|
+
src/rsseismic/enums/_generated.py
|
|
37
|
+
src/rsseismic/enums/fitting_procedure.py
|
|
38
|
+
src/rsseismic/generatedFiles/ApplicationService_pb2.py
|
|
39
|
+
src/rsseismic/generatedFiles/ApplicationService_pb2.pyi
|
|
40
|
+
src/rsseismic/generatedFiles/ApplicationService_pb2_grpc.py
|
|
41
|
+
src/rsseismic/generatedFiles/BedrockLayerDataService_pb2.py
|
|
42
|
+
src/rsseismic/generatedFiles/BedrockLayerDataService_pb2.pyi
|
|
43
|
+
src/rsseismic/generatedFiles/BedrockLayerDataService_pb2_grpc.py
|
|
44
|
+
src/rsseismic/generatedFiles/CommonMessages_pb2.py
|
|
45
|
+
src/rsseismic/generatedFiles/CommonMessages_pb2.pyi
|
|
46
|
+
src/rsseismic/generatedFiles/CommonMessages_pb2_grpc.py
|
|
47
|
+
src/rsseismic/generatedFiles/MeanProfileService_pb2.py
|
|
48
|
+
src/rsseismic/generatedFiles/MeanProfileService_pb2.pyi
|
|
49
|
+
src/rsseismic/generatedFiles/MeanProfileService_pb2_grpc.py
|
|
50
|
+
src/rsseismic/generatedFiles/MeanProfileSoilLayerDataService_pb2.py
|
|
51
|
+
src/rsseismic/generatedFiles/MeanProfileSoilLayerDataService_pb2.pyi
|
|
52
|
+
src/rsseismic/generatedFiles/MeanProfileSoilLayerDataService_pb2_grpc.py
|
|
53
|
+
src/rsseismic/generatedFiles/ModelService_pb2.py
|
|
54
|
+
src/rsseismic/generatedFiles/ModelService_pb2.pyi
|
|
55
|
+
src/rsseismic/generatedFiles/ModelService_pb2_grpc.py
|
|
56
|
+
src/rsseismic/generatedFiles/MotionService_pb2.py
|
|
57
|
+
src/rsseismic/generatedFiles/MotionService_pb2.pyi
|
|
58
|
+
src/rsseismic/generatedFiles/MotionService_pb2_grpc.py
|
|
59
|
+
src/rsseismic/generatedFiles/ProfileGenerationSettingsService_pb2.py
|
|
60
|
+
src/rsseismic/generatedFiles/ProfileGenerationSettingsService_pb2.pyi
|
|
61
|
+
src/rsseismic/generatedFiles/ProfileGenerationSettingsService_pb2_grpc.py
|
|
62
|
+
src/rsseismic/generatedFiles/ProfileService_pb2.py
|
|
63
|
+
src/rsseismic/generatedFiles/ProfileService_pb2.pyi
|
|
64
|
+
src/rsseismic/generatedFiles/ProfileService_pb2_grpc.py
|
|
65
|
+
src/rsseismic/generatedFiles/ProjectSettingsDataService_pb2.py
|
|
66
|
+
src/rsseismic/generatedFiles/ProjectSettingsDataService_pb2.pyi
|
|
67
|
+
src/rsseismic/generatedFiles/ProjectSettingsDataService_pb2_grpc.py
|
|
68
|
+
src/rsseismic/generatedFiles/ReferenceCurveDataService_pb2.py
|
|
69
|
+
src/rsseismic/generatedFiles/ReferenceCurveDataService_pb2.pyi
|
|
70
|
+
src/rsseismic/generatedFiles/ReferenceCurveDataService_pb2_grpc.py
|
|
71
|
+
src/rsseismic/generatedFiles/ResultsService_pb2.py
|
|
72
|
+
src/rsseismic/generatedFiles/ResultsService_pb2.pyi
|
|
73
|
+
src/rsseismic/generatedFiles/ResultsService_pb2_grpc.py
|
|
74
|
+
src/rsseismic/generatedFiles/SoilLayerCurveDataService_pb2.py
|
|
75
|
+
src/rsseismic/generatedFiles/SoilLayerCurveDataService_pb2.pyi
|
|
76
|
+
src/rsseismic/generatedFiles/SoilLayerCurveDataService_pb2_grpc.py
|
|
77
|
+
src/rsseismic/generatedFiles/SoilLayerDataService_pb2.py
|
|
78
|
+
src/rsseismic/generatedFiles/SoilLayerDataService_pb2.pyi
|
|
79
|
+
src/rsseismic/generatedFiles/SoilLayerDataService_pb2_grpc.py
|
|
80
|
+
src/rsseismic/generatedFiles/SoilLayerService_pb2.py
|
|
81
|
+
src/rsseismic/generatedFiles/SoilLayerService_pb2.pyi
|
|
82
|
+
src/rsseismic/generatedFiles/SoilLayerService_pb2_grpc.py
|
|
83
|
+
src/rsseismic/generatedFiles/__init__.py
|
|
84
|
+
src/rsseismic/properties/_PropertyAccessor.py
|
|
85
|
+
src/rsseismic/properties/__init__.py
|
|
86
|
+
src/rsseismic/properties/bedrockLayer/__init__.py
|
|
87
|
+
src/rsseismic/properties/bedrockLayer/_generated.py
|
|
88
|
+
src/rsseismic/properties/meanProfileSoilLayer/__init__.py
|
|
89
|
+
src/rsseismic/properties/meanProfileSoilLayer/_generated.py
|
|
90
|
+
src/rsseismic/properties/profileGenerationSettings/__init__.py
|
|
91
|
+
src/rsseismic/properties/profileGenerationSettings/_generated.py
|
|
92
|
+
src/rsseismic/properties/projectSettings/__init__.py
|
|
93
|
+
src/rsseismic/properties/projectSettings/_generated.py
|
|
94
|
+
src/rsseismic/properties/referenceCurve/__init__.py
|
|
95
|
+
src/rsseismic/properties/referenceCurve/_generated.py
|
|
96
|
+
src/rsseismic/properties/soilLayer/__init__.py
|
|
97
|
+
src/rsseismic/properties/soilLayer/_generated.py
|
|
98
|
+
tests/test_application_manager.py
|
|
99
|
+
tests/test_auto_profile_workflow.py
|
|
100
|
+
tests/test_batch_compute.py
|
|
101
|
+
tests/test_bedrock_layer.py
|
|
102
|
+
tests/test_connection.py
|
|
103
|
+
tests/test_fem_verification_workflow.py
|
|
104
|
+
tests/test_generated_enums.py
|
|
105
|
+
tests/test_generated_property_enums.py
|
|
106
|
+
tests/test_mean_profile.py
|
|
107
|
+
tests/test_mean_profile_soil_layer.py
|
|
108
|
+
tests/test_model_generate_profiles.py
|
|
109
|
+
tests/test_model_run_compute.py
|
|
110
|
+
tests/test_motions.py
|
|
111
|
+
tests/test_multi_open_scripting.py
|
|
112
|
+
tests/test_profile_generation_settings.py
|
|
113
|
+
tests/test_profiles.py
|
|
114
|
+
tests/test_project_settings.py
|
|
115
|
+
tests/test_reference_curve.py
|
|
116
|
+
tests/test_result_bulk_dataframes.py
|
|
117
|
+
tests/test_result_bulk_dataframes_integration.py
|
|
118
|
+
tests/test_result_dataframes.py
|
|
119
|
+
tests/test_results.py
|
|
120
|
+
tests/test_results_dataframes_integration.py
|
|
121
|
+
tests/test_rpc_helpers.py
|
|
122
|
+
tests/test_single_profile_workflow.py
|
|
123
|
+
tests/test_soil_layer.py
|
|
124
|
+
tests/test_soil_layer_curve.py
|
|
125
|
+
tests/test_soil_layer_operations.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rsseismic
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
from rsseismic._application_paths import getInstalledExecutablePath
|
|
6
|
+
from rsseismic._client import Client, DEFAULT_SCRIPTING_PORT
|
|
7
|
+
from rsseismic.ApplicationManager import ApplicationManager
|
|
8
|
+
from rsseismic._rpc_helpers import require_success
|
|
9
|
+
from rsseismic.exceptions import ScriptingError
|
|
10
|
+
from rsseismic.generatedFiles import ApplicationService_pb2 as ApplicationService_pb2
|
|
11
|
+
from rsseismic.generatedFiles import ApplicationService_pb2_grpc as ApplicationService_pb2_grpc
|
|
12
|
+
from rsseismic._batch_compute import (
|
|
13
|
+
BatchComputeJobResult,
|
|
14
|
+
BatchComputeResult,
|
|
15
|
+
run_batch_compute,
|
|
16
|
+
)
|
|
17
|
+
from rsseismic.Model import Model
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class RSSeismicApplication:
|
|
21
|
+
"""
|
|
22
|
+
Entry point for connecting to a running RSSeismic scripting server.
|
|
23
|
+
|
|
24
|
+
Mirrors RS3's RS3Modeler: connect on a port, open projects, return Model proxies.
|
|
25
|
+
Use startApplication() to launch RSSeismic with -startScriptingServer when it is
|
|
26
|
+
not already running.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init__(self, port: int = DEFAULT_SCRIPTING_PORT, host: str = "localhost"):
|
|
30
|
+
self._client = Client(port=port, host=host)
|
|
31
|
+
self._port = port
|
|
32
|
+
self._host = host
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def port(self) -> int:
|
|
36
|
+
return self._port
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def client(self) -> Client:
|
|
40
|
+
return self._client
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def startApplication(
|
|
44
|
+
cls,
|
|
45
|
+
port: int = DEFAULT_SCRIPTING_PORT,
|
|
46
|
+
overridePathToExecutable: str | None = None,
|
|
47
|
+
timeout: float = ApplicationManager.defaultTimeout,
|
|
48
|
+
) -> None:
|
|
49
|
+
"""
|
|
50
|
+
Launch RSSeismic and wait until the scripting server on port accepts ping.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
port: Scripting port (49152–65535). Same value as DEFAULT_SCRIPTING_PORT / 60058.
|
|
54
|
+
overridePathToExecutable: Full path to RSSeismic.exe. When omitted, the latest
|
|
55
|
+
RSSeismic install is resolved from the Windows registry.
|
|
56
|
+
timeout: Seconds to wait for the server to become reachable.
|
|
57
|
+
|
|
58
|
+
Raises:
|
|
59
|
+
ValueError: port out of range
|
|
60
|
+
RuntimeError: port occupied, executable not found, or registry lookup failed
|
|
61
|
+
TimeoutError: server not ready within timeout
|
|
62
|
+
"""
|
|
63
|
+
executable_path = (
|
|
64
|
+
overridePathToExecutable
|
|
65
|
+
if overridePathToExecutable
|
|
66
|
+
else getInstalledExecutablePath()
|
|
67
|
+
)
|
|
68
|
+
app_manager = ApplicationManager()
|
|
69
|
+
app_logger = logging.getLogger("Rocscience.RSSeismic")
|
|
70
|
+
app_manager.startApplication(
|
|
71
|
+
executable_path,
|
|
72
|
+
port,
|
|
73
|
+
cls._verifyServerRunning,
|
|
74
|
+
app_logger,
|
|
75
|
+
timeout,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
@staticmethod
|
|
79
|
+
def _verifyServerRunning(port: int) -> None:
|
|
80
|
+
client = Client(port=port)
|
|
81
|
+
try:
|
|
82
|
+
client.ping()
|
|
83
|
+
finally:
|
|
84
|
+
client.closeConnection()
|
|
85
|
+
|
|
86
|
+
def ping(self) -> None:
|
|
87
|
+
"""Verify the scripting server is reachable."""
|
|
88
|
+
self._client.ping()
|
|
89
|
+
|
|
90
|
+
def getMaxConcurrentAnalyses(self) -> int:
|
|
91
|
+
"""
|
|
92
|
+
Return the effective maxConcurrentAnalyses from RSSeismic preferences.
|
|
93
|
+
|
|
94
|
+
This is the within-project cap on simultaneous engine runs used during
|
|
95
|
+
RunCompute. Batch parallel_degree capping uses this value when available.
|
|
96
|
+
"""
|
|
97
|
+
stub = ApplicationService_pb2_grpc.ApplicationServiceStub(self._client.channel)
|
|
98
|
+
request = ApplicationService_pb2.GetMaxConcurrentAnalysesRequest()
|
|
99
|
+
response = self._client.callFunction(stub.GetMaxConcurrentAnalyses, request)
|
|
100
|
+
return int(response.maxConcurrentAnalyses)
|
|
101
|
+
|
|
102
|
+
def setMaxConcurrentAnalyses(self, maxConcurrentAnalyses: int) -> int:
|
|
103
|
+
"""
|
|
104
|
+
Set maxConcurrentAnalyses in RSSeismic preferences (within-project engine cap).
|
|
105
|
+
|
|
106
|
+
Values are clamped to 1..256, matching the Preferences UI. Returns the effective
|
|
107
|
+
value after save (same semantics as getMaxConcurrentAnalyses).
|
|
108
|
+
"""
|
|
109
|
+
stub = ApplicationService_pb2_grpc.ApplicationServiceStub(self._client.channel)
|
|
110
|
+
request = ApplicationService_pb2.SetMaxConcurrentAnalysesRequest(
|
|
111
|
+
maxConcurrentAnalyses=maxConcurrentAnalyses,
|
|
112
|
+
)
|
|
113
|
+
response = self._client.callFunction(stub.SetMaxConcurrentAnalyses, request)
|
|
114
|
+
|
|
115
|
+
if not response.success:
|
|
116
|
+
raise ScriptingError(
|
|
117
|
+
response.errorMessage or "SetMaxConcurrentAnalyses failed."
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
return int(response.maxConcurrentAnalyses)
|
|
121
|
+
|
|
122
|
+
def openFile(self, path: str) -> Model:
|
|
123
|
+
"""Open a DeepSoil project file and return a Model handle."""
|
|
124
|
+
stub = ApplicationService_pb2_grpc.ApplicationServiceStub(self._client.channel)
|
|
125
|
+
request = ApplicationService_pb2.OpenFileRequest(fileName=path)
|
|
126
|
+
response = self._client.callFunction(stub.OpenFile, request)
|
|
127
|
+
require_success(response, "OpenFile")
|
|
128
|
+
|
|
129
|
+
if not response.modelID:
|
|
130
|
+
raise ScriptingError("OpenFile succeeded but returned an empty modelID.")
|
|
131
|
+
|
|
132
|
+
return Model(self._client, response.modelID)
|
|
133
|
+
|
|
134
|
+
def newProject(self) -> Model:
|
|
135
|
+
"""Create a blank project with default settings and return a Model handle."""
|
|
136
|
+
stub = ApplicationService_pb2_grpc.ApplicationServiceStub(self._client.channel)
|
|
137
|
+
request = ApplicationService_pb2.NewProjectRequest()
|
|
138
|
+
response = self._client.callFunction(stub.NewProject, request)
|
|
139
|
+
|
|
140
|
+
if not response.success:
|
|
141
|
+
raise ScriptingError("NewProject failed.")
|
|
142
|
+
|
|
143
|
+
if not response.modelID:
|
|
144
|
+
raise ScriptingError("NewProject succeeded but returned an empty modelID.")
|
|
145
|
+
|
|
146
|
+
return Model(self._client, response.modelID)
|
|
147
|
+
|
|
148
|
+
def runBatchCompute(
|
|
149
|
+
self,
|
|
150
|
+
file_paths: list[str],
|
|
151
|
+
motion_names: list[str] | None = None,
|
|
152
|
+
*,
|
|
153
|
+
parallel_degree: int = 1,
|
|
154
|
+
max_concurrent_analyses: int | None = None,
|
|
155
|
+
timeout: float | None = None,
|
|
156
|
+
close_save_project: bool = False,
|
|
157
|
+
continue_on_error: bool = True,
|
|
158
|
+
) -> BatchComputeResult:
|
|
159
|
+
"""
|
|
160
|
+
Run compute for many project files (open → motion selection → compute → close).
|
|
161
|
+
|
|
162
|
+
Motion selection applies to the open session only; it is not stored in the
|
|
163
|
+
project file. Each job calls setMotionSelection before runCompute.
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
file_paths: Project files to process (.rsseismicfile). Duplicate paths are omitted.
|
|
167
|
+
motion_names: Motions to select for every project. When None, each project keeps
|
|
168
|
+
its current selection or uses the first available motion.
|
|
169
|
+
parallel_degree: How many projects may run at once (cross-project only). Capped
|
|
170
|
+
using maxConcurrentAnalyses from RSSeismic preferences when available.
|
|
171
|
+
max_concurrent_analyses: When set, applies this within-project engine cap for the
|
|
172
|
+
batch via setMaxConcurrentAnalyses and restores the previous preference after
|
|
173
|
+
the batch. When None, uses getMaxConcurrentAnalyses().
|
|
174
|
+
timeout: Optional RunCompute deadline in seconds for each project.
|
|
175
|
+
close_save_project: When True, save each project on close.
|
|
176
|
+
continue_on_error: When False, stop starting new jobs after the first failure
|
|
177
|
+
(in-flight jobs may still finish).
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
BatchComputeResult with per-file outcomes in input order.
|
|
181
|
+
"""
|
|
182
|
+
return run_batch_compute(
|
|
183
|
+
self,
|
|
184
|
+
file_paths,
|
|
185
|
+
motion_names,
|
|
186
|
+
parallel_degree=parallel_degree,
|
|
187
|
+
max_concurrent_analyses=max_concurrent_analyses,
|
|
188
|
+
timeout=timeout,
|
|
189
|
+
close_save_project=close_save_project,
|
|
190
|
+
continue_on_error=continue_on_error,
|
|
191
|
+
logger=logging.getLogger("Rocscience.RSSeismic"),
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
def close(self) -> None:
|
|
195
|
+
"""Close the gRPC connection."""
|
|
196
|
+
self._client.closeConnection()
|