GroundMotionManager
GroundMotionManager
Manager for a local collection of ground motions.
The manager is responsible for ground-motion lifecycle and numbering:
adding instances, assigning tags, looking up objects, deleting objects, and
retagging after removals or tag-start changes. It is intentionally not a
singleton. Each GroundMotionManager instance owns an independent tag
space, which allows future model or Model instances to keep local
ground-motion collections.
Concrete ground-motion classes validate and render themselves, while this
manager controls ownership. Prefer factory methods such as plain(...)
and interpolated(...) for normal use; use add(...) when an instance
has already been constructed manually.
Example
from femora.core.model import Model
model = Model()
accel = model.time_series.path(dt=0.01, filePath="support.acc")
disp = model.time_series.path(dt=0.01, filePath="support.disp")
gm = model.ground_motion.plain(accel=accel, disp=disp)
print(gm.tag) # 1
print(gm.to_tcl()) # groundMotion 1 Plain -accel ... -disp ...
Create an empty ground-motion manager with tags starting at 1.
Attributes
Methods:
add
Add a ground motion instance and assign its local tag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ground_motion
|
GroundMotion
|
Unmanaged |
required |
Returns:
| Type | Description |
|---|---|
GroundMotion
|
The same ground-motion instance, now tagged and managed. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If |
plain
plain(accel: Optional[TimeSeries] = None, vel: Optional[TimeSeries] = None, disp: Optional[TimeSeries] = None, integrator: Optional[str] = None, integrator_args: Optional[List[Union[int, float, str]]] = None, factor: float = 1.0) -> PlainGroundMotion
Create, tag, and store a PlainGroundMotion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
accel
|
Optional[TimeSeries]
|
Acceleration time series. Optional if |
None
|
vel
|
Optional[TimeSeries]
|
Velocity time series. Optional if |
None
|
disp
|
Optional[TimeSeries]
|
Displacement time series. Optional if |
None
|
integrator
|
Optional[str]
|
Optional OpenSees integration method, such as
|
None
|
integrator_args
|
Optional[List[Union[int, float, str]]]
|
Optional arguments appended after |
None
|
factor
|
float
|
Constant scale factor for the ground motion. |
1.0
|
Returns:
| Type | Description |
|---|---|
PlainGroundMotion
|
The managed |
interpolated
Create, tag, and store an InterpolatedGroundMotion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ground_motions
|
List[GroundMotion]
|
Ground motions to combine. Each item must be a
|
required |
factors
|
List[float]
|
Interpolation factors. Must have the same length as
|
required |
Returns:
| Type | Description |
|---|---|
InterpolatedGroundMotion
|
The managed |
get
Return a managed ground motion by tag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag
|
int
|
Ground-motion tag in this manager's local tag space. |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no ground motion exists with |
get_all
Return a copy of all managed ground motions keyed by tag.
remove
Remove a ground motion and retag remaining instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag
|
int
|
Ground-motion tag to remove. Missing tags are ignored. |
required |
set_tag_start
Set the first tag and retag existing ground motions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_tag
|
int
|
First tag to use for this manager. Must be positive. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
_next_available_tag
Return the next unused tag in this manager's local tag space.
_reassign_tags
Retag all managed ground motions from _start_tag in tag order.