Add multiple Constructors to TrapezoidalGradient
Trapezoidal gradients can be initialized from diffent combinations of inputs, assuming that the rest of parameters are defined by the system limits. As sytem limits are passed as positional argument since !4 (merged) it is feasable in all cases to deduct the missing parameters. It might be cleaner to implement classmethods for construction in the following cases:
- area -> shortest gradient
- duration, area -> shortest ramp & amplitude = Area/(duration-ramptime)
- flat_duration, area -> shortest ramp & amplitude = Area/(flat+ramptime)
- duration, amplitude -> shortest ramp
- flat_duration, amplitude -> shortest ramp
- flat_duration, flat_area -> shortest ramp & amplitude = flat_area / flat_duration
- duration, flat_area -> shortest ramp & flat_duration = duration - 2 * ramp & amplitude = flat_area / flat_duration
All cases are reducible to the combination (flat_duration, ramp, amplitude), which means that the generic initialization should have the signature:
def __init__(self, system_specs: SystemSpec, orientatin: np.ndarray, flat_duration: Quantity, rise_time: Quantity, amplitude: Quantity, delay: Quantity)
The currently used (legacy) kwargs max_grad
& max_slew
should be deleted.
This would leave option of defining the trapezoidal as they want by directly calling __init__
(which is validated in SequenceBaseBlock.init), while independently providing commonly used initializations.