pyampact.alignmentUtils.g
- pyampact.alignmentUtils.g(vec, idx, domain)[source]
Get an element from vec, checking bounds. Domain is the set of points that vec is a subset of.
- Parameters:
vec (np.ndarray) – A 1D numpy array representing the input vector.
idx (int) – The index of the desired element in vec.
domain (np.ndarray) – A 1D numpy array representing the set of valid points, of which vec is a subset.
- Returns:
The element from vec at index idx if it is within bounds; otherwise, the first element of domain if idx is less than 0, or the last element of domain if idx exceeds the bounds of vec.
- Return type:
float