TruncExp#
- class braintools.cogtask.TruncExp(mean, min_val=0, max_val=inf, key=None)[source]#
Truncated exponential distribution for sampling time durations.
Useful for generating variable-duration phases with exponential distribution truncated to a specified range.
Examples
>>> # Duration sampled from truncated exponential >>> duration = TruncExp(600*u.ms, 300*u.ms, 1500*u.ms) >>> Delay(duration) # Variable delay
>>> # Use in trial_init >>> def trial_init(ctx): ... t_delay = TruncExp(600*u.ms, 300*u.ms, 1500*u.ms) ... ctx['delay_duration'] = t_delay()