range
thkit.range
¶
Functions:
-
range_inclusive–Generate evenly spaced points including the endpoint (within tolerance).
-
composite_range–A custom parser to allow define composite ranges. This is needed for defining input parameters in YAML files.
-
composite_index–Allow define composite index ranges.
-
composite_strain_points–Generate composite spacing points from multiple ranges with tolerance-based uniqueness.
-
chunk_list–Yield successive n-sized chunks from
input_list.
range_inclusive(start: float, end: float, step: float, tol: float = 1e-06) -> list[float]
¶
Generate evenly spaced points including the endpoint (within tolerance).
composite_range(list_inputs: list[float | str], tol=1e-06) -> list[float]
¶
A custom parser to allow define composite ranges. This is needed for defining input parameters in YAML files.
Parameters:
-
list_inputs(list[int | float | str]) –Accepts numbers or strings with special form 'start:end[:step]' (inclusive).
-
tol(float, default:1e-06) –Tolerance for including the endpoint.
Examples: ["-3.1:-1", 0.1, 2, "3.1:5.2", "6.0:10.1:0.5"]
composite_index(list_inputs: list[float | str]) -> list[int]
¶
composite_strain_points(list_inputs: list[int | float | str], tol=1e-06) -> list[float]
¶
Generate composite spacing points from multiple ranges with tolerance-based uniqueness.
Notes
np.round(np.array(all_points) / tol).astype(int)is a trick to avoid floating point issues when comparing points with a certain tolerance.