pymgipsim.InputGeneration.signal


Classes

Events

Stores a series of (duration, magnitude, start time) triplets that uniquely define events which can either be measurement or input.

Signal

Extends the Events class with sampled signal.

class Events(magnitude: ~numpy.ndarray = <factory>, start_time: ~numpy.ndarray = <factory>, duration: ~numpy.ndarray = <factory>)[source]

Bases: object

Stores a series of (duration, magnitude, start time) triplets that uniquely define events which can either be measurement or input.

Events from a scenario file are cast into Events dataclass and vice-versa.

Note

For measurements, duration field is empty array as it is uninterpretable.

magnitude

Defines the magnitudes of the events.

Type:

Iterable

start_time

Defines the start times of the events in Unix timestamps [min].

Type:

Iterable

duration

Defines the duration of the events [min].

Type:

Iterable

as_dict()[source]

Function to make the translation between the JSON scenario file and class smooth.

class Signal(time: ndarray = array([], dtype=float64), magnitude: Iterable = array([], shape=(1, 0), dtype=float64), start_time: Iterable = array([], shape=(1, 0), dtype=float64), duration: Iterable = array([], shape=(1, 0), dtype=float64), sampling_time: float = 1)[source]

Bases: Events

Extends the Events class with sampled signal.

Sampled square wave is generated based on the events information to use directly in solving the differential equations.

sampled_signal

2D numpy array, 1st dim: subjects, 2nd dim: timestep in the simulation horizon.

Type:

np.ndarray

as_dict()

Function to make the translation between the JSON scenario file and class smooth.