Utils
Utility functions and classes.
General functions
dcase_util.utils. *
|
Get information about audio file without opening it. |
|
Get media file duration using ffprobe. |
|
Merge media files using ffmpeg. |
|
Get all classes inherited from given class |
|
Output number of bytes according to locale and with IEC binary prefixes |
|
|
|
Check if given value is integer |
|
Check if given value is float |
Check if code is run in Jupyter (Jupyter notebook, Jupyter console, or ipython qtconsole). |
SuppressStdoutAndStderr
dcase_util.utils.SuppressStdoutAndStderr
Context manager to suppress STDOUT and STDERR |
VectorRecipeParser
dcase_util.utils.VectorRecipeParser
|
Files
dcase_util.utils. *
|
Argument file checker |
|
Check that all file in the list exists |
|
Converts path to POSIX format |
Path
dcase_util.utils.Path
|
Utility class for paths |
|
Converts path to POSIX format |
|
Converts posix formatted path to nt |
|
Get file list |
|
Checks that path exists |
|
File count under given path including sub directories. |
|
Total byte count of all files under given path. |
|
Total data size of all files under given path returned in human readable form. |
|
Create given path. |
|
Create given paths. |
ApplicationPaths
dcase_util.utils.ApplicationPaths
|
Utility class for application paths, paths are automatically generated based on parameters through parameter hash. |
|
Generate application paths and include parameter hashes to the paths |
|
Generate directory name. |
Save parameters to each application sub-directory. |
|
|
Generate all combinations of based on path parts |
FileFormat
dcase_util.utils.FileFormat
|
Detect file format. |
|
Detect file format based on filename. |
|
Detect file format based on content by using python-magic. |
|
Validate file format label against labels known by this class |
Hash
|
Get unique hash string (md5) for given parameter dict |
|
Get unique hash string (md5) for given file |
Logging
Decorator class to allow only one execution |
DisableLogger
dcase_util.utils.DisableLogger
Math
dcase_util.utils.SimpleMathStringEvaluator
SimpleMathStringEvaluator
Simple math string evaluator |
|
|
Evaluate math in the string |
Timer
dcase_util.utils.Timer
|
Timer class |
Start timer |
|
Stop timer |
|
Return elapsed time in seconds since timer was started |
|
|
Get elapsed time in a string format |
Validators
FieldValidator
dcase_util.utils.FieldValidator
|
Test field |
|
Test for empty field |
|
Test for number field |
|
Test for audio file field |
|
Test for list field, valid delimiters [ : ; #] |
|
Test for alpha field with length 1 |
Examples
dcase_util.utils.Example
Some example data for easy testing and tutoring.
|
Example files for tutorials |
|
|
|
|
|
|
|
|
|