braintools.input.Clipped#
- class braintools.input.Clipped(input_obj, min_val=None, max_val=None)#
Clipped version of an input.
Clips input values to stay within specified bounds, useful for modeling saturation or rectification.
- Parameters:
Examples
>>> ramp = Ramp(-2, 2, 200 * u.ms) >>> >>> # Clip to [0, 1] range >>> saturated = Clipped(ramp, 0, 1) >>> >>> # Only lower bound (rectification) >>> rectified = Clipped(ramp, min_val=0) >>> >>> # Only upper bound (saturation) >>> capped = Clipped(ramp, max_val=1.5) >>> >>> # Usually created via clip() method >>> saturated = ramp.clip(0, 1)
Methods
__init__(input_obj[, min_val, max_val])Initialize clipped 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 clipped 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.