Utility routines (sisl.utils
)¶
Several utility functions are used throughout sisl.
Range routines¶
array_arange (start[, end, n, dtype]) |
Creates a single array from a sequence of numpy.arange |
strmap (func, s[, start, end, sep]) |
Parse a string as though it was a slice and map all entries using func . |
strseq (cast, s[, start, end]) |
Accept a string and return the casted tuples of content based on ranges. |
lstranges (lst[, cast, end]) |
Convert a strmap list into expanded ranges |
erange (start, step[, end]) |
Returns the range with both ends includede |
list2str (lst) |
Convert a list of elements into a string of ranges |
fileindex (f[, cast]) |
Parses a filename string into the filename and the indices. |
Miscellaneous routines¶
str_spec (name) |
Split into a tuple of name and specifier, delimited by {...} . |
direction (d) |
Return the index coordinate index corresponding to the Cartesian coordinate system. |
angle (s[, rad, in_rad]) |
Convert the input string to an angle, either radians or degrees. |
iter_shape (shape) |
Generator for iterating a shape by returning consecutive slices |
math_eval (expr) |
Evaluate a mathematical expression using a safe evaluation method |