braintools.input.Composite#
- class braintools.input.Composite(input1, input2, operator)#
Composite input created by combining two inputs with an operator.
- Parameters:
Notes
When inputs have different durations, the shorter one is padded with zeros to match the longer duration.
Division by zero returns the numerator value (avoiding NaN).
Examples
>>> # Direct construction (usually use operators instead) >>> ramp = Ramp(0, 1, 100 * u.ms) >>> sine = Sinusoidal(0.5, 10 * u.Hz, 100 * u.ms) >>> added = Composite(ramp, sine, '+') >>> >>> # More commonly created via operators >>> added = ramp + sine >>> multiplied = ramp * sine >>> maximum = ramp | sine # Uses 'max' operator
Methods
__init__(input1, input2, operator)Initialize a composite input.
apply(func)Apply a custom function to the input.
clip([min_val, max_val])Clip the input values to a range.
generate()Generate the composite input.
repeat(n_times)Repeat the input pattern n times.
scale(factor)Scale the input by a factor.
shift(time_shift)Shift the input in time.
smooth(tau)Apply exponential smoothing to the input.
Attributes
dtGet the time step from global environment.
n_stepsGet the number of time steps.
shapeGet the shape of the input array.