PAOFLOW.transport.parsers.parser_base#
Attributes#
Functions#
|
Parse a string representing a range or list of integer indices into a 0-based numpy array. |
Module Contents#
- PAOFLOW.transport.parsers.parser_base.parse_index_array(index_string, max_value, xval=-1)[source]#
Parse a string representing a range or list of integer indices into a 0-based numpy array.
The string format allows specifying intervals using either comma-separated values or ranges. Each interval may be of the form:
i1: a single indexi1-i2: an inclusive range from i1 to i2Nx: a placeholder that yields N entries of xval
Examples
"1-3,5,2x"would yield: [0, 1, 2, 4, -1, -1] assuming xval = -1 (default).- Parameters:
- Returns:
`indices` – Parsed array of integer indices (0-based), ready for array slicing.
- Return type:
ndarray of int
- Raises:
ValueError – If the input format is invalid or inconsistent with expected size.