timoshenko-engine 2.0.3__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/PKG-INFO +18 -7
  2. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/README.md +16 -6
  3. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/pyproject.toml +8 -2
  4. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/__init__.py +121 -30
  5. timoshenko_engine-2.1.0/src/timoshenko/_spectral.py +34 -0
  6. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/adapters.py +21 -6
  7. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/assets.py +10 -2
  8. timoshenko_engine-2.1.0/src/timoshenko/beams.py +142 -0
  9. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/csv_source.py +33 -9
  10. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/health.py +16 -10
  11. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/mechanics.py +2 -1
  12. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/modal.py +57 -14
  13. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/monitor.py +23 -4
  14. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/mqtt.py +52 -14
  15. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/multichannel.py +22 -7
  16. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/observations.py +6 -2
  17. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/oma.py +46 -20
  18. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/plugins.py +19 -7
  19. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/polygon.py +111 -14
  20. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/pressure.py +6 -3
  21. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/project.py +9 -2
  22. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/report.py +43 -25
  23. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/sections.py +27 -6
  24. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/sensors.py +3 -2
  25. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/sensorthings.py +67 -16
  26. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/session.py +54 -15
  27. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/shafts.py +10 -3
  28. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/stability.py +15 -6
  29. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/storage.py +62 -15
  30. timoshenko_engine-2.1.0/src/timoshenko/structural.py +1640 -0
  31. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/structure.py +12 -4
  32. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/uncertainty.py +42 -13
  33. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/update.py +6 -2
  34. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/vibration.py +23 -7
  35. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko_engine.egg-info/PKG-INFO +18 -7
  36. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko_engine.egg-info/SOURCES.txt +5 -0
  37. timoshenko_engine-2.1.0/tests/test_adapters.py +791 -0
  38. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/tests/test_formulas.py +38 -11
  39. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/tests/test_modal.py +145 -17
  40. timoshenko_engine-2.1.0/tests/test_multichannel_csv.py +21 -0
  41. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/tests/test_package.py +24 -10
  42. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/tests/test_polygon.py +70 -11
  43. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/tests/test_project_report.py +59 -11
  44. timoshenko_engine-2.1.0/tests/test_sensor_inputs.py +193 -0
  45. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/tests/test_storage_session.py +129 -8
  46. timoshenko_engine-2.1.0/tests/test_structural.py +1406 -0
  47. timoshenko_engine-2.1.0/tests/test_uncertainty.py +293 -0
  48. timoshenko_engine-2.0.3/src/timoshenko/beams.py +0 -75
  49. timoshenko_engine-2.0.3/tests/test_adapters.py +0 -425
  50. timoshenko_engine-2.0.3/tests/test_uncertainty.py +0 -79
  51. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/LICENSE +0 -0
  52. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/setup.cfg +0 -0
  53. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/_validation.py +0 -0
  54. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/py.typed +0 -0
  55. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko/strength.py +0 -0
  56. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko_engine.egg-info/dependency_links.txt +0 -0
  57. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko_engine.egg-info/entry_points.txt +0 -0
  58. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko_engine.egg-info/requires.txt +0 -0
  59. {timoshenko_engine-2.0.3 → timoshenko_engine-2.1.0}/src/timoshenko_engine.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: timoshenko-engine
3
- Version: 2.0.3
3
+ Version: 2.1.0
4
4
  Summary: Composable structural engineering calculations and analysis primitives for Python applications.
5
5
  Author: Ayberk Korkmaz
6
6
  License-Expression: Apache-2.0
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
21
22
  Classifier: Topic :: Scientific/Engineering
22
23
  Classifier: Typing :: Typed
23
24
  Requires-Python: >=3.10
@@ -93,7 +94,7 @@ structure = tm.Structure(
93
94
  story_masses_kg=[120_000.0, 110_000.0],
94
95
  story_stiffness_n_m=[85_000_000.0, 70_000_000.0],
95
96
  )
96
- print(structure.natural_frequencies_hz) # (2.626, 6.476)
97
+ print(structure.natural_frequencies_hz) # (2.626, 6.476)
97
98
 
98
99
  fs = 100.0
99
100
  t = np.arange(60_000) / fs
@@ -102,10 +103,10 @@ signal = np.sin(2 * np.pi * f1 * t) + 0.4 * np.sin(2 * np.pi * f2 * t)
102
103
  sensors = tm.SensorData(signal, sampling_hz=fs, unit="m/s^2")
103
104
 
104
105
  result = tm.monitor(structure, sensors, review_threshold_pct=3.0)
105
- print(result.structure.update_scale_factor) # 0.903, since stiffness scales with frequency squared
106
+ print(result.structure.update_scale_factor) # 0.903, since stiffness scales with frequency squared
106
107
  for change in result.health.mode_changes:
107
108
  print(change.mode_number, change.change_pct) # 1 -5.0, then 2 -5.0
108
- print(result.health.review_recommended) # True
109
+ print(result.health.review_recommended) # True
109
110
  ```
110
111
 
111
112
  <p align="center">
@@ -128,8 +129,12 @@ import timoshenko as tm
128
129
 
129
130
  section = tm.rectangle_section(width_m=0.3, height_m=0.6)
130
131
  beam = tm.simply_supported_uniform_load(
131
- 20_000.0, 6.0, 30e9, section.second_moment_y_m4,
132
- shear_modulus_pa=12.5e9, area_m2=section.area_m2,
132
+ 20_000.0,
133
+ 6.0,
134
+ 30e9,
135
+ section.second_moment_y_m4,
136
+ shear_modulus_pa=12.5e9,
137
+ area_m2=section.area_m2,
133
138
  )
134
139
  print(beam.bending_m, beam.shear_m) # 2.083 mm bending, 0.048 mm shear
135
140
 
@@ -141,12 +146,17 @@ frequency = tm.propagate_uncertainty(
141
146
  print(frequency.estimate, frequency.standard_uncertainty) # 6.366 Hz ± 0.090 Hz
142
147
  ```
143
148
 
149
+ Planar members can also be assembled into a small-displacement linear frame
150
+ model. Supports, nodal loads, local uniform loads and member masses are
151
+ explicit model inputs. See [2D frame analysis](https://timoshenko.readthedocs.io/en/latest/structural-analysis/)
152
+ for the stiffness, mass and scope assumptions.
153
+
144
154
  ## What it provides
145
155
 
146
156
  | Area | Components |
147
157
  |---|---|
148
158
  | Engineering calculations | Section properties (including polygons with holes), beam deflection with shear, torsion, Euler buckling, plane stress, thin-wall pressure, SDOF vibration, Rayleigh damping, and GUM / Monte Carlo uncertainty |
149
- | Structural models | Lumped-mass shear-building models and their natural frequencies |
159
+ | Structural models | Lumped-mass shear buildings and linear elastic planar trusses and frames with static, modal, P-delta and buckling analysis |
150
160
  | Modal analysis | Single-channel peak picking with resolution-checked damping, and multi-channel FDD with complex mode shapes |
151
161
  | Model comparison | Nearest-frequency mode pairing, global stiffness updating, and evidence-oriented health assessment |
152
162
  | Monitoring | Bounded rolling-window sessions, restart from local history, and source adapters for CSV, MQTT, and OGC SensorThings |
@@ -226,6 +236,7 @@ The full documentation is at
226
236
  python -m pip install -e ".[test,lint]"
227
237
  python -m pytest --cov
228
238
  python -m ruff check .
239
+ python -m ruff format --check .
229
240
  python -m mypy
230
241
  ```
231
242
 
@@ -55,7 +55,7 @@ structure = tm.Structure(
55
55
  story_masses_kg=[120_000.0, 110_000.0],
56
56
  story_stiffness_n_m=[85_000_000.0, 70_000_000.0],
57
57
  )
58
- print(structure.natural_frequencies_hz) # (2.626, 6.476)
58
+ print(structure.natural_frequencies_hz) # (2.626, 6.476)
59
59
 
60
60
  fs = 100.0
61
61
  t = np.arange(60_000) / fs
@@ -64,10 +64,10 @@ signal = np.sin(2 * np.pi * f1 * t) + 0.4 * np.sin(2 * np.pi * f2 * t)
64
64
  sensors = tm.SensorData(signal, sampling_hz=fs, unit="m/s^2")
65
65
 
66
66
  result = tm.monitor(structure, sensors, review_threshold_pct=3.0)
67
- print(result.structure.update_scale_factor) # 0.903, since stiffness scales with frequency squared
67
+ print(result.structure.update_scale_factor) # 0.903, since stiffness scales with frequency squared
68
68
  for change in result.health.mode_changes:
69
69
  print(change.mode_number, change.change_pct) # 1 -5.0, then 2 -5.0
70
- print(result.health.review_recommended) # True
70
+ print(result.health.review_recommended) # True
71
71
  ```
72
72
 
73
73
  <p align="center">
@@ -90,8 +90,12 @@ import timoshenko as tm
90
90
 
91
91
  section = tm.rectangle_section(width_m=0.3, height_m=0.6)
92
92
  beam = tm.simply_supported_uniform_load(
93
- 20_000.0, 6.0, 30e9, section.second_moment_y_m4,
94
- shear_modulus_pa=12.5e9, area_m2=section.area_m2,
93
+ 20_000.0,
94
+ 6.0,
95
+ 30e9,
96
+ section.second_moment_y_m4,
97
+ shear_modulus_pa=12.5e9,
98
+ area_m2=section.area_m2,
95
99
  )
96
100
  print(beam.bending_m, beam.shear_m) # 2.083 mm bending, 0.048 mm shear
97
101
 
@@ -103,12 +107,17 @@ frequency = tm.propagate_uncertainty(
103
107
  print(frequency.estimate, frequency.standard_uncertainty) # 6.366 Hz ± 0.090 Hz
104
108
  ```
105
109
 
110
+ Planar members can also be assembled into a small-displacement linear frame
111
+ model. Supports, nodal loads, local uniform loads and member masses are
112
+ explicit model inputs. See [2D frame analysis](https://timoshenko.readthedocs.io/en/latest/structural-analysis/)
113
+ for the stiffness, mass and scope assumptions.
114
+
106
115
  ## What it provides
107
116
 
108
117
  | Area | Components |
109
118
  |---|---|
110
119
  | Engineering calculations | Section properties (including polygons with holes), beam deflection with shear, torsion, Euler buckling, plane stress, thin-wall pressure, SDOF vibration, Rayleigh damping, and GUM / Monte Carlo uncertainty |
111
- | Structural models | Lumped-mass shear-building models and their natural frequencies |
120
+ | Structural models | Lumped-mass shear buildings and linear elastic planar trusses and frames with static, modal, P-delta and buckling analysis |
112
121
  | Modal analysis | Single-channel peak picking with resolution-checked damping, and multi-channel FDD with complex mode shapes |
113
122
  | Model comparison | Nearest-frequency mode pairing, global stiffness updating, and evidence-oriented health assessment |
114
123
  | Monitoring | Bounded rolling-window sessions, restart from local history, and source adapters for CSV, MQTT, and OGC SensorThings |
@@ -188,6 +197,7 @@ The full documentation is at
188
197
  python -m pip install -e ".[test,lint]"
189
198
  python -m pytest --cov
190
199
  python -m ruff check .
200
+ python -m ruff format --check .
191
201
  python -m mypy
192
202
  ```
193
203
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "timoshenko-engine"
7
- version = "2.0.3"
7
+ version = "2.1.0"
8
8
  description = "Composable structural engineering calculations and analysis primitives for Python applications."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -28,6 +28,7 @@ classifiers = [
28
28
  "Programming Language :: Python :: 3.11",
29
29
  "Programming Language :: Python :: 3.12",
30
30
  "Programming Language :: Python :: 3.13",
31
+ "Programming Language :: Python :: 3.14",
31
32
  "Topic :: Scientific/Engineering",
32
33
  "Typing :: Typed",
33
34
  ]
@@ -72,12 +73,17 @@ show_missing = true
72
73
  [tool.ruff]
73
74
  target-version = "py310"
74
75
  src = ["src", "tests"]
76
+ line-length = 100
75
77
 
76
78
  [tool.ruff.lint]
77
- select = ["E4", "E7", "E9", "F"]
79
+ select = ["E4", "E7", "E9", "F", "I", "B"]
80
+
81
+ [tool.ruff.lint.isort]
82
+ force-sort-within-sections = true
78
83
 
79
84
  [tool.mypy]
80
85
  files = ["src/timoshenko"]
81
86
  check_untyped_defs = true
87
+ disallow_untyped_defs = true
82
88
  warn_unused_ignores = true
83
89
  warn_redundant_casts = true
@@ -1,19 +1,34 @@
1
1
  """Timoshenko: composable structural engineering primitives."""
2
2
 
3
- from . import adapters, assets, beams, csv_source, health, mechanics, modal, mqtt, observations, oma, plugins, polygon, pressure, project, report, sections, sensorthings, session, shafts, stability, storage, strength, uncertainty, vibration
4
- from .assets import Asset, Relation
5
- from .adapters import AcknowledgingObservationSource, ObservationSource, SessionRunner
6
- from .csv_source import CSVObservationSource, CSVSourceError
7
- from .plugins import (
8
- ENTRY_POINT_GROUP,
9
- PLUGIN_API_VERSION,
10
- EnginePlugin,
11
- PluginCompatibilityError,
12
- PluginContributions,
13
- PluginError,
14
- PluginLoadError,
15
- PluginRegistry,
3
+ from . import (
4
+ adapters,
5
+ assets,
6
+ beams,
7
+ csv_source,
8
+ health,
9
+ mechanics,
10
+ modal,
11
+ mqtt,
12
+ observations,
13
+ oma,
14
+ plugins,
15
+ polygon,
16
+ pressure,
17
+ project,
18
+ report,
19
+ sections,
20
+ sensorthings,
21
+ session,
22
+ shafts,
23
+ stability,
24
+ storage,
25
+ strength,
26
+ structural,
27
+ uncertainty,
28
+ vibration,
16
29
  )
30
+ from .adapters import AcknowledgingObservationSource, ObservationSource, SessionRunner
31
+ from .assets import Asset, Relation
17
32
  from .beams import (
18
33
  BeamDeflection,
19
34
  cantilever_tip_load,
@@ -21,45 +36,101 @@ from .beams import (
21
36
  simply_supported_midpoint_load,
22
37
  simply_supported_uniform_load,
23
38
  )
39
+ from .csv_source import CSVObservationSource, CSVSourceError
24
40
  from .health import HealthAssessment
25
41
  from .mechanics import (
42
+ average_shear_stress,
26
43
  axial_strain,
27
44
  axial_stress,
28
- average_shear_stress,
29
45
  bending_stress,
30
46
  rectangular_max_shear_stress,
31
47
  thermal_strain,
32
48
  youngs_modulus_from_shear,
33
49
  )
34
50
  from .modal import ModalResult, Mode
35
- from .mqtt import MQTTSourceError, MqttObservationSource
36
- from .sensorthings import SensorThingsObservationSource, SensorThingsPlugin, SensorThingsSourceError
37
51
  from .monitor import MonitoringResult, monitor
38
- from .observations import Observation, ObservationBatch
52
+ from .mqtt import MqttObservationSource, MQTTSourceError
39
53
  from .multichannel import MultiChannelData, load_multichannel_csv
54
+ from .observations import Observation, ObservationBatch
40
55
  from .oma import FDDMode, FDDResult, identify_fdd
56
+ from .plugins import (
57
+ ENTRY_POINT_GROUP,
58
+ PLUGIN_API_VERSION,
59
+ EnginePlugin,
60
+ PluginCompatibilityError,
61
+ PluginContributions,
62
+ PluginError,
63
+ PluginLoadError,
64
+ PluginRegistry,
65
+ )
66
+ from .polygon import (
67
+ PolygonSectionProperties,
68
+ polygon_bending_stress_pa,
69
+ polygon_section,
70
+ )
41
71
  from .pressure import ThinWallCylinderResult, thin_wall_cylinder_stress
42
- from .polygon import PolygonSectionProperties, polygon_section
43
- from .project import LoadedProject, ProjectManifest, ProjectRunResult, load_project, read_manifest, run_project
44
- from .storage import BatchAppendResult, SQLiteStore
45
- from .session import MonitoringSession, SessionIngestResult, SessionReport, SessionRestoreResult
46
- from .sections import SectionProperties
72
+ from .project import (
73
+ LoadedProject,
74
+ ProjectManifest,
75
+ ProjectRunResult,
76
+ load_project,
77
+ read_manifest,
78
+ run_project,
79
+ )
80
+ from .sections import SectionProperties, i_section
47
81
  from .sections import circular_tube as circular_tube_section
48
- from .sections import i_section
49
- from .sections import rectangular_tube as rectangular_tube_section
50
82
  from .sections import rectangle as rectangle_section
83
+ from .sections import rectangular_tube as rectangular_tube_section
51
84
  from .sections import solid_circle as solid_circle_section
52
85
  from .sensors import SensorData, load_sensors
86
+ from .sensorthings import (
87
+ SensorThingsObservationSource,
88
+ SensorThingsPlugin,
89
+ SensorThingsSourceError,
90
+ )
91
+ from .session import (
92
+ MonitoringSession,
93
+ SessionIngestResult,
94
+ SessionReport,
95
+ SessionRestoreResult,
96
+ )
53
97
  from .shafts import CircularTorsionResult, circular_shaft_torsion
54
- from .structure import Structure
55
- from .stability import euler_critical_load
56
- from .stability import slenderness_ratio
98
+ from .stability import euler_critical_load, slenderness_ratio
99
+ from .storage import BatchAppendResult, SQLiteStore
57
100
  from .strength import PlaneStressResult, plane_stress
101
+ from .structural import (
102
+ AxialMember,
103
+ BucklingAnalysisResult,
104
+ FrameAnalysisResult,
105
+ FrameMaterial,
106
+ FrameMember,
107
+ FrameMemberResponse,
108
+ FrameNode,
109
+ FramePartialUniformLoad,
110
+ FramePointLoad,
111
+ FrameSection,
112
+ ModalAnalysisResult,
113
+ StructuralModel,
114
+ analyze_linear_buckling,
115
+ analyze_linear_static,
116
+ analyze_modes,
117
+ analyze_p_delta,
118
+ modal_assurance_criterion,
119
+ recover_member_response,
120
+ )
121
+ from .structure import Structure
122
+ from .uncertainty import UncertaintyError, UncertaintyResult
123
+ from .uncertainty import propagate as propagate_uncertainty
58
124
  from .update import update
59
- from .uncertainty import UncertaintyError, UncertaintyResult, propagate as propagate_uncertainty
60
- from .vibration import RayleighDampingResult, damping_ratio, harmonic_response, natural_frequency_hz, rayleigh_damping_coefficients
125
+ from .vibration import (
126
+ RayleighDampingResult,
127
+ damping_ratio,
128
+ harmonic_response,
129
+ natural_frequency_hz,
130
+ rayleigh_damping_coefficients,
131
+ )
61
132
 
62
- __version__ = "2.0.3"
133
+ __version__ = "2.1.0"
63
134
 
64
135
  __all__ = [
65
136
  "HealthAssessment",
@@ -98,6 +169,18 @@ __all__ = [
98
169
  "PluginRegistry",
99
170
  "SensorData",
100
171
  "Structure",
172
+ "StructuralModel",
173
+ "AxialMember",
174
+ "FrameNode",
175
+ "FrameMaterial",
176
+ "FrameSection",
177
+ "FrameMember",
178
+ "FrameMemberResponse",
179
+ "FramePartialUniformLoad",
180
+ "FramePointLoad",
181
+ "FrameAnalysisResult",
182
+ "ModalAnalysisResult",
183
+ "BucklingAnalysisResult",
101
184
  "SectionProperties",
102
185
  "ThinWallCylinderResult",
103
186
  "RayleighDampingResult",
@@ -143,6 +226,7 @@ __all__ = [
143
226
  "plugins",
144
227
  "polygon",
145
228
  "polygon_section",
229
+ "polygon_bending_stress_pa",
146
230
  "report",
147
231
  "rectangle_section",
148
232
  "rectangular_tube_section",
@@ -165,6 +249,13 @@ __all__ = [
165
249
  "vibration",
166
250
  "assets",
167
251
  "adapters",
252
+ "structural",
253
+ "analyze_linear_static",
254
+ "analyze_modes",
255
+ "analyze_p_delta",
256
+ "analyze_linear_buckling",
257
+ "modal_assurance_criterion",
258
+ "recover_member_response",
168
259
  "storage",
169
260
  "uncertainty",
170
261
  "load_project",
@@ -0,0 +1,34 @@
1
+ """Small helpers for locating frequency-domain peaks."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import math
6
+
7
+ import numpy as np
8
+
9
+
10
+ def interpolate_log_peak_frequency(
11
+ frequencies: np.ndarray,
12
+ spectrum: np.ndarray,
13
+ peak_index: int,
14
+ ) -> float:
15
+ """Refine a spectral-bin peak with a three-point log-magnitude parabola."""
16
+ center_frequency = float(frequencies[peak_index])
17
+ if peak_index <= 0 or peak_index >= len(spectrum) - 1:
18
+ return center_frequency
19
+ left = float(spectrum[peak_index - 1])
20
+ center = float(spectrum[peak_index])
21
+ right = float(spectrum[peak_index + 1])
22
+ if not all(math.isfinite(value) and value > 0.0 for value in (left, center, right)):
23
+ return center_frequency
24
+
25
+ log_left, log_center, log_right = math.log(left), math.log(center), math.log(right)
26
+ curvature = log_left - 2.0 * log_center + log_right
27
+ if not math.isfinite(curvature) or curvature >= 0.0:
28
+ return center_frequency
29
+ offset = 0.5 * (log_left - log_right) / curvature
30
+ if not math.isfinite(offset):
31
+ return center_frequency
32
+ offset = min(0.5, max(-0.5, offset))
33
+ bin_width = float(frequencies[peak_index + 1] - frequencies[peak_index])
34
+ return center_frequency + offset * bin_width
@@ -47,9 +47,15 @@ class SessionRunner:
47
47
  ):
48
48
  if not isinstance(session, MonitoringSession):
49
49
  raise TypeError("session must be a MonitoringSession")
50
- if any(not callable(getattr(source, name, None)) for name in ("open", "read_batch", "close")):
51
- raise TypeError("source must provide callable open(), read_batch(), and close() methods")
52
- if max_batches is not None and (isinstance(max_batches, bool) or int(max_batches) != max_batches or int(max_batches) < 1):
50
+ if any(
51
+ not callable(getattr(source, name, None)) for name in ("open", "read_batch", "close")
52
+ ):
53
+ raise TypeError(
54
+ "source must provide callable open(), read_batch(), and close() methods"
55
+ )
56
+ if max_batches is not None and (
57
+ isinstance(max_batches, bool) or int(max_batches) != max_batches or int(max_batches) < 1
58
+ ):
53
59
  raise ValueError("max_batches must be a positive integer or None")
54
60
  self.source = source
55
61
  self.session = session
@@ -67,13 +73,20 @@ class SessionRunner:
67
73
  self.source.close()
68
74
  except BaseException as close_error:
69
75
  if hasattr(open_error, "add_note"):
70
- open_error.add_note(f"Source cleanup after open failure also failed: {close_error!r}")
76
+ open_error.add_note(
77
+ f"Source cleanup after open failure also failed: {close_error!r}"
78
+ )
71
79
  raise
72
80
  self._active = True
73
81
  self._consuming = False
74
82
  return self
75
83
 
76
- def __exit__(self, exc_type, exc, traceback) -> Literal[False]:
84
+ def __exit__(
85
+ self,
86
+ exc_type: type[BaseException] | None,
87
+ exc: BaseException | None,
88
+ traceback: object,
89
+ ) -> Literal[False]:
77
90
  self._active = False
78
91
  try:
79
92
  self.source.close()
@@ -97,7 +110,9 @@ class SessionRunner:
97
110
  if batch is None:
98
111
  return
99
112
  if not isinstance(batch, ObservationBatch):
100
- raise TypeError("ObservationSource.read_batch() must return ObservationBatch or None")
113
+ raise TypeError(
114
+ "ObservationSource.read_batch() must return ObservationBatch or None"
115
+ )
101
116
  read_count += 1
102
117
  result = self.session.ingest(batch)
103
118
  acknowledge = getattr(self.source, "acknowledge", None)
@@ -25,7 +25,12 @@ class Asset:
25
25
  object.__setattr__(self, "metadata", dict(self.metadata))
26
26
 
27
27
  def to_dict(self) -> dict[str, Any]:
28
- return {"asset_id": self.asset_id, "asset_type": self.asset_type, "name": self.name, "metadata": dict(self.metadata)}
28
+ return {
29
+ "asset_id": self.asset_id,
30
+ "asset_type": self.asset_type,
31
+ "name": self.name,
32
+ "metadata": dict(self.metadata),
33
+ }
29
34
 
30
35
 
31
36
  @dataclass(frozen=True)
@@ -36,7 +41,10 @@ class Relation:
36
41
  metadata: Mapping[str, Any] = field(default_factory=dict)
37
42
 
38
43
  def __post_init__(self) -> None:
39
- source, kind, target = (str(item).strip() for item in (self.source_asset_id, self.relation_type, self.target_asset_id))
44
+ source, kind, target = (
45
+ str(item).strip()
46
+ for item in (self.source_asset_id, self.relation_type, self.target_asset_id)
47
+ )
40
48
  if not source or not kind or not target:
41
49
  raise ValueError("relation source, type, and target must be non-empty")
42
50
  if source == target:
@@ -0,0 +1,142 @@
1
+ """Closed-form small-deflection beam responses for common load cases.
2
+
3
+ Euler-Bernoulli bending deflection is always reported. If both shear modulus
4
+ and cross-sectional area are supplied, a first-order shear-deflection term is
5
+ also returned (constant ``kappa`` shear-correction approximation).
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from dataclasses import dataclass
11
+
12
+ from ._validation import finite as _finite
13
+ from ._validation import positive as _positive
14
+
15
+
16
+ @dataclass(frozen=True)
17
+ class BeamDeflection:
18
+ bending_m: float
19
+ shear_m: float
20
+
21
+ @property
22
+ def total_m(self) -> float:
23
+ return self.bending_m + self.shear_m
24
+
25
+
26
+ def _response(
27
+ bending: float,
28
+ shear_force_factor: float,
29
+ *,
30
+ shear_modulus_pa: float | None,
31
+ area_m2: float | None,
32
+ shear_correction: float,
33
+ ) -> BeamDeflection:
34
+ if (shear_modulus_pa is None) != (area_m2 is None):
35
+ raise ValueError("provide both shear_modulus_pa and area_m2 to include shear deflection")
36
+ shear = 0.0
37
+ if shear_modulus_pa is not None and area_m2 is not None:
38
+ g = _positive("shear_modulus_pa", shear_modulus_pa)
39
+ a = _positive("area_m2", area_m2)
40
+ kappa = _positive("shear_correction", shear_correction)
41
+ shear = shear_force_factor / (kappa * g * a)
42
+ return BeamDeflection(float(bending), float(shear))
43
+
44
+
45
+ def cantilever_tip_load(
46
+ load_n: float,
47
+ span_m: float,
48
+ youngs_modulus_pa: float,
49
+ second_moment_m4: float,
50
+ *,
51
+ shear_modulus_pa: float | None = None,
52
+ area_m2: float | None = None,
53
+ shear_correction: float = 5.0 / 6.0,
54
+ ) -> BeamDeflection:
55
+ """Tip deflection of a cantilever with a point load at its free end."""
56
+ p, length = _finite("load_n", load_n), _positive("span_m", span_m)
57
+ e, inertia = (
58
+ _positive("youngs_modulus_pa", youngs_modulus_pa),
59
+ _positive("second_moment_m4", second_moment_m4),
60
+ )
61
+ return _response(
62
+ p * length**3 / (3 * e * inertia),
63
+ p * length,
64
+ shear_modulus_pa=shear_modulus_pa,
65
+ area_m2=area_m2,
66
+ shear_correction=shear_correction,
67
+ )
68
+
69
+
70
+ def cantilever_uniform_load(
71
+ load_n_per_m: float,
72
+ span_m: float,
73
+ youngs_modulus_pa: float,
74
+ second_moment_m4: float,
75
+ *,
76
+ shear_modulus_pa: float | None = None,
77
+ area_m2: float | None = None,
78
+ shear_correction: float = 5.0 / 6.0,
79
+ ) -> BeamDeflection:
80
+ """Free-end deflection of a cantilever under a full-span uniform load."""
81
+ w, length = _finite("load_n_per_m", load_n_per_m), _positive("span_m", span_m)
82
+ e, inertia = (
83
+ _positive("youngs_modulus_pa", youngs_modulus_pa),
84
+ _positive("second_moment_m4", second_moment_m4),
85
+ )
86
+ return _response(
87
+ w * length**4 / (8 * e * inertia),
88
+ w * length**2 / 2,
89
+ shear_modulus_pa=shear_modulus_pa,
90
+ area_m2=area_m2,
91
+ shear_correction=shear_correction,
92
+ )
93
+
94
+
95
+ def simply_supported_midpoint_load(
96
+ load_n: float,
97
+ span_m: float,
98
+ youngs_modulus_pa: float,
99
+ second_moment_m4: float,
100
+ *,
101
+ shear_modulus_pa: float | None = None,
102
+ area_m2: float | None = None,
103
+ shear_correction: float = 5.0 / 6.0,
104
+ ) -> BeamDeflection:
105
+ """Midspan deflection of a simply supported beam with a center point load."""
106
+ p, length = _finite("load_n", load_n), _positive("span_m", span_m)
107
+ e, inertia = (
108
+ _positive("youngs_modulus_pa", youngs_modulus_pa),
109
+ _positive("second_moment_m4", second_moment_m4),
110
+ )
111
+ return _response(
112
+ p * length**3 / (48 * e * inertia),
113
+ p * length / 4,
114
+ shear_modulus_pa=shear_modulus_pa,
115
+ area_m2=area_m2,
116
+ shear_correction=shear_correction,
117
+ )
118
+
119
+
120
+ def simply_supported_uniform_load(
121
+ load_n_per_m: float,
122
+ span_m: float,
123
+ youngs_modulus_pa: float,
124
+ second_moment_m4: float,
125
+ *,
126
+ shear_modulus_pa: float | None = None,
127
+ area_m2: float | None = None,
128
+ shear_correction: float = 5.0 / 6.0,
129
+ ) -> BeamDeflection:
130
+ """Midspan deflection of a simply supported beam under full-span UDL."""
131
+ w, length = _finite("load_n_per_m", load_n_per_m), _positive("span_m", span_m)
132
+ e, inertia = (
133
+ _positive("youngs_modulus_pa", youngs_modulus_pa),
134
+ _positive("second_moment_m4", second_moment_m4),
135
+ )
136
+ return _response(
137
+ 5 * w * length**4 / (384 * e * inertia),
138
+ w * length**2 / 8,
139
+ shear_modulus_pa=shear_modulus_pa,
140
+ area_m2=area_m2,
141
+ shear_correction=shear_correction,
142
+ )