Skip to content

TimeSeriesManager

TimeSeriesManager

TimeSeriesManager(mesh_maker: Model)

Local manager for TimeSeries lifecycle and tag assignment.

The manager is intentionally not a singleton. Each instance owns an independent tag space so future model or Model instances can keep their own time-series collections.

Create an empty manager with tags starting at 1.

Attributes

_mesh_maker instance-attribute

_mesh_maker = mesh_maker

_time_series instance-attribute

_time_series: Dict[int, TimeSeries] = {}

_start_tag instance-attribute

_start_tag = 1

_tagging instance-attribute

_tagging = CompactRetagPolicy[TimeSeries]()

__len__ class-attribute instance-attribute

__len__ = lambda self: len(_time_series)

__iter__ class-attribute instance-attribute

__iter__ = lambda self: iter(values())

Methods:

add

add(time_series: TimeSeries) -> TimeSeries

Add an existing time series and assign a tag if needed.

Parameters:

Name Type Description Default
time_series TimeSeries

Unmanaged or already-managed TimeSeries instance.

required

Returns:

Type Description
TimeSeries

The same time_series instance after it is stored by this manager.

Raises:

Type Description
TypeError

If time_series is not a TimeSeries instance.

ValueError

If its preassigned tag conflicts with a different object already managed here.

get

get(tag: int) -> Optional[TimeSeries]

Return the time series with tag if it exists.

Parameters:

Name Type Description Default
tag int

Time-series tag to look up.

required

Returns:

Type Description
Optional[TimeSeries]

The matching TimeSeries instance, or None.

get_all

get_all() -> Dict[int, TimeSeries]

Return a shallow copy of all managed time series keyed by tag.

remove

remove(tag: int) -> None

Remove a managed time series and compact the remaining tags.

Parameters:

Name Type Description Default
tag int

Tag of the time series to remove. Missing tags are ignored.

required

clear

clear() -> None

Remove all time series and clear their assigned tags.

set_tag_start

set_tag_start(start_tag: int) -> None

Set the first tag used by this manager and retag existing objects.

Parameters:

Name Type Description Default
start_tag int

Positive integer for the first assigned tag.

required

Raises:

Type Description
ValueError

If start_tag is less than 1.

constant

constant(factor: float = 1.0) -> ConstantTimeSeries

Create and manage a ConstantTimeSeries.

Parameters:

Name Type Description Default
factor float

Constant scale factor.

1.0

Returns:

Type Description
ConstantTimeSeries

Managed ConstantTimeSeries instance.

linear

linear(factor: float = 1.0) -> LinearTimeSeries

Create and manage a LinearTimeSeries.

Parameters:

Name Type Description Default
factor float

Linear scale factor.

1.0

Returns:

Type Description
LinearTimeSeries

Managed LinearTimeSeries instance.

trig

trig(tStart: float = 0.0, tEnd: float = 1.0, period: float = 1.0, factor: float = 1.0, shift: float = 0.0) -> TrigTimeSeries

Create and manage a TrigTimeSeries.

Parameters:

Name Type Description Default
tStart float

Start time of the trigonometric series.

0.0
tEnd float

End time of the trigonometric series.

1.0
period float

Period of the sinusoidal cycle.

1.0
factor float

Load factor amplitude.

1.0
shift float

Phase shift.

0.0

Returns:

Type Description
TrigTimeSeries

Managed TrigTimeSeries instance.

ramp

ramp(tStart: float = 0.0, tRamp: float = 1.0, smoothness: float = 0.0, offset: float = 0.0, cFactor: float = 1.0) -> RampTimeSeries

Create and manage a RampTimeSeries.

Parameters:

Name Type Description Default
tStart float

Start time of the ramp.

0.0
tRamp float

Duration of the ramp.

1.0
smoothness float

Smoothness value between 0 and 1.

0.0
offset float

Vertical offset.

0.0
cFactor float

Load factor scale.

1.0

Returns:

Type Description
RampTimeSeries

Managed RampTimeSeries instance.

triangular

triangular(tStart: float = 0.0, tEnd: float = 1.0, period: float = 1.0, factor: float = 1.0, shift: float = 0.0) -> TriangularTimeSeries

Create and manage a TriangularTimeSeries.

Parameters:

Name Type Description Default
tStart float

Start time of the triangular wave.

0.0
tEnd float

End time of the triangular wave.

1.0
period float

Wave period.

1.0
factor float

Load factor amplitude.

1.0
shift float

Phase shift.

0.0

Returns:

Type Description
TriangularTimeSeries

Managed TriangularTimeSeries instance.

rectangular

rectangular(tStart: float = 0.0, tEnd: float = 1.0, period: float = 1.0, factor: float = 1.0, shift: float = 0.0) -> RectangularTimeSeries

Create and manage a RectangularTimeSeries.

Parameters:

Name Type Description Default
tStart float

Start time of the rectangular wave.

0.0
tEnd float

End time of the rectangular wave.

1.0
period float

Wave period.

1.0
factor float

Load factor amplitude.

1.0
shift float

Phase shift.

0.0

Returns:

Type Description
RectangularTimeSeries

Managed RectangularTimeSeries instance.

pulse

pulse(tStart: float = 0.0, tEnd: float = 1.0, period: float = 1.0, width: float = 0.5, factor: float = 1.0, shift: float = 0.0) -> PulseTimeSeries

Create and manage a PulseTimeSeries.

Parameters:

Name Type Description Default
tStart float

Start time of the pulse series.

0.0
tEnd float

End time of the pulse series.

1.0
period float

Pulse period.

1.0
width float

Pulse width as a fraction of the period.

0.5
factor float

Load factor amplitude.

1.0
shift float

Phase shift.

0.0

Returns:

Type Description
PulseTimeSeries

Managed PulseTimeSeries instance.

path

path(dt: Optional[float] = None, values: Optional[Union[str, Sequence[float]]] = None, filePath: Optional[str] = None, factor: float = 1.0, useLast: bool = False, prependZero: bool = False, startTime: float = 0.0, time: Optional[Union[str, Sequence[float]]] = None, fileTime: Optional[str] = None) -> PathTimeSeries

Create and manage a PathTimeSeries.

Parameters:

Name Type Description Default
dt Optional[float]

Constant time step. Mutually exclusive with time and fileTime.

None
values Optional[Union[str, Sequence[float]]]

Inline path values as a sequence or comma-separated string. Mutually exclusive with filePath.

None
filePath Optional[str]

File containing path values. Mutually exclusive with values.

None
factor float

Scale factor applied to the path values.

1.0
useLast bool

Whether OpenSees should hold the last value after the path ends.

False
prependZero bool

Whether OpenSees should prepend a zero value.

False
startTime float

Time offset for the path.

0.0
time Optional[Union[str, Sequence[float]]]

Inline time values. Mutually exclusive with dt and fileTime.

None
fileTime Optional[str]

File containing time values. Mutually exclusive with dt and time.

None

Returns:

Type Description
PathTimeSeries

Managed PathTimeSeries instance.

_next_available_tag

_next_available_tag() -> int

Return the next unused tag in this manager's local tag space.

_reassign_tags

_reassign_tags() -> None

Retag all managed time series from _start_tag in tag order.