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.

Access factories through model.time_series. A time series defines a scalar function of solver domain time; it is not an analysis time step, recorder interval, or a command that advances the domain clock. Patterns and ground motions reference these definitions to apply them to loading.

Example
from femora import Model

model = Model()
history = model.time_series.path(dt=0.01, values=[0.0, 1.0, 0.0])
pattern = model.pattern.uniform_excitation(dof=1, time_series=history)
model.process.add_step(pattern, "Apply excitation")
assert model.time_series.get(history.tag) is history

Use consistent time/amplitude units and stage file-backed histories where the solver can read them. Creation does not resample a record, check solver time-step stability, or ensure compatible duration. Removal/start-tag changes can invalidate dependency tags; rebuild affected patterns/ground motions.

Create an empty manager with tags starting at 1.

Methods:

Name Description
constant

Create and manage a ConstantTimeSeries.

linear

Create and manage a LinearTimeSeries.

trig

Create and manage a TrigTimeSeries.

ramp

Create and manage a RampTimeSeries.

triangular

Create and manage a TriangularTimeSeries.

rectangular

Create and manage a RectangularTimeSeries.

pulse

Create and manage a PulseTimeSeries.

path

Create and manage a PathTimeSeries.

add

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

get

Return the time series with tag if it exists.

get_all

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

remove

Remove a managed time series and compact the remaining tags.

clear

Remove all time series and clear their assigned tags.

set_tag_start

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

Methods:

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.

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.