pymgipsim.InputGeneration.signal

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

__create_signal(start_times: ndarray, durations: ndarray, amounts: ndarray, sampling_time: float) ndarray

Static method to create a signal based on provided input parameters.

Parameters: - time: np.ndarray

Time array for the signal.

  • start_times: np.ndarray

    Array of start times for each event.

  • durations: np.ndarray

    Array of durations for each event.

  • amounts: np.ndarray

    Array of amounts for each event.

  • sampling_time: float

    Sampling time for the signal.

Returns: - np.ndarray

3D array representing the generated scenario signal.

as_dict()

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