Several utility functions are used throughout sisl.

Range routines

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[, abc, xyz])

Index coordinate transformation from int/str to an integer

listify

Convert arguments to an iterable-like (any iterable, default to list)

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

batched_indices(ref, y[, axis, atol, ...])

Locate x in ref by examining np.abs(diff_func(ref - y)) <= atol