pyp.utils package
Contents
pyp.utils package¶
Submodules¶
pyp.utils.core module¶
- cat(iterable, /)[source]¶
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
- flatten(iterable, /)[source]¶
Alternative chain() constructor taking a single iterable argument that evaluates lazily.
- get_relative_path(path: Union[str, pathlib.Path]) → pathlib.Path[source]¶
Returns Path relative to src/ folder.
- movie2regex(pattern, filename='*')[source]¶
Translate the pattern in movie_pattern to RegEx, used to search corresponding frame files
TILTSERIES -> name of the tiltseries SCANORD -> scanning order (i.e. 000, 001, 002, …) ANGLE -> tilt angles (i.e. -0.0, 10, 0.5, …)
- Parameters
pattern (str) – Pattern of filename
filename (str) – Name of the tilt-series
- Returns
RegEx
- Return type
str
pyp.utils.timer module¶
Timer module adapted from Real Python.
- class Timer(name: Union[str, NoneType] = None, text: str = 'Elapsed time: {}', logger: Union[Callable[[str], NoneType], NoneType] = <built-in function print>)[source]¶
Bases:
contextlib.ContextDecorator
- logger()[source]¶
print(value, …, sep=’ ‘, end=’n’, file=sys.stdout, flush=False)
Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline. flush: whether to forcibly flush the stream.