pyampact.alignmentUtils.gh
- pyampact.alignmentUtils.gh(v1, i1, v2, i2, domain, frac=0.5)[source]
Get an element that is frac fraction of the way between v1[i1] and v2[i2], but check bounds on both vectors. frac of 0 returns v1[i1], frac of 1 returns v2[i2], frac of 0.5 (the default) returns halfway between them.
- Parameters:
v1 (np.ndarray) – A 1D numpy array representing the first vector.
i1 (int) – The index in v1 from which to retrieve the value.
v2 (np.ndarray) – A 1D numpy array representing the second vector.
i2 (int) – The index in v2 from which to retrieve the value.
domain (tuple) – A tuple representing the valid bounds for both vectors. This should define the minimum and maximum allowable indices.
frac (float, optional) – A fraction indicating how far between the two specified elements to interpolate. Default is 0.5.
- Returns:
The element that is frac fraction of the way between v1[i1] and v2[i2], clipped to the specified domain bounds.
- Return type:
float