Stimulus

Schema for stimulation protocols / source terms

class pigreads.schema.stimulus.SignalStep(**data)

Bases: BaseModel

Within a time interval, increase the value of variables by a given amounts.

The start and duration of the signal are given in time units of the simulation. The variables are given as a dictionary with the variable names as keys and the amount to increase the variable by as values:

start: 100 # ms
duration: 10 # ms
variables:
  u: 1
  v: 2

The interval is defined mathematically as \(t \in [\text{start}, \text{start} + \text{duration})\).

Parameters:

data (Any)

__call__(signal, times, varidx)

Modify the signal array.

The signal array is modified in place to increase the values of the variables by the given amounts within the time interval.

Parameters:
Return type:

ndarray[Any, Any]

Returns:

Modified signal array.

duration: float

Duration of the signal.

model_config: ClassVar[ConfigDict]

Configuration for pydantic.BaseModel.

start: float

Starting time of the signal.

variables: dict[str, float]

Variables to modify and the amount to modify them by.

class pigreads.schema.stimulus.Stimulus(**data)

Bases: BaseModel

A stimulus is a combination of a shape and a signal.

The shape is defined by a list of pigreads.schema.setter.Setter objects and defines where the stimulus is applied. The signal is defined by a list of SignalStep objects and defines how the stimulus changes over time.

Parameters:

data (Any)

model_config: ClassVar[ConfigDict]

Configuration for pydantic.BaseModel.

classmethod normalise_shape(shape)

Normalise the setters in the shape.

See pigreads.schema.setter.normalise_list_of_setters() for details.

Parameters:

shape (Any) – Any data to try to interpret.

Return type:

Any

Returns:

Normalised data.

shape: list[SetterFile | SetterSlices | SetterSpherical]

Shape of the stimulus.

signal: list[SignalStep]

Signal of the stimulus.