dcase_util.containers.DCASEAppParameterContainer
- class dcase_util.containers.DCASEAppParameterContainer(*args, **kwargs)[source]
Parameter container class for DCASE application parameter files, inherited from AppParameterContainer.
Constructor
- Parameters
- datadict
Dictionary to initialize container Default value None
- app_basestr
Absolute path to the project root Default value None
- section_process_orderlist, optional
Parameter section processing order. Given dict is used to override internal default list. Default value ‘parameters.yaml’
- path_structuredict of lists, optional
Defines how paths are created, section hash is used to create unique folder names. Given dict is used to override internal default list.
- method_dependenciesdict of dicts, optional
Given dict is used to override internal default list.
- magic_fielddict, optional
Dict of field names for specific tasks. Given dict is used to override internal default list.
- non_hashable_fieldslist, optional
List of fields skipped when parameter hash for the section is calculated. Given list is used to override internal default list.
- control_sectionslist, optional
List of top level sections used for framework control, for these section no hash is calculated. Given list is used to override internal default list.
- __init__(*args, **kwargs)[source]
Constructor
- Parameters
- datadict
Dictionary to initialize container Default value None
- app_basestr
Absolute path to the project root Default value None
- section_process_orderlist, optional
Parameter section processing order. Given dict is used to override internal default list. Default value ‘parameters.yaml’
- path_structuredict of lists, optional
Defines how paths are created, section hash is used to create unique folder names. Given dict is used to override internal default list.
- method_dependenciesdict of dicts, optional
Given dict is used to override internal default list.
- magic_fielddict, optional
Dict of field names for specific tasks. Given dict is used to override internal default list.
- non_hashable_fieldslist, optional
List of fields skipped when parameter hash for the section is calculated. Given list is used to override internal default list.
- control_sectionslist, optional
List of top level sections used for framework control, for these section no hash is calculated. Given list is used to override internal default list.
Methods
__init__
(*args, **kwargs)Constructor
active_set
()Get active set id
clear
()copy
()delimiter
([exclude_delimiters])Use csv.sniffer to guess delimiter for CSV file
detect_file_format
([filename])Detect file format from extension
empty
()Check if file is empty
exists
()Checks that file exists
filter
([data, excluded_key_prefix])Filter nested dict
fromkeys
(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get
(key[, default])Return the value for key if key is in the dictionary, else default.
get_dump_content
(data)Clean internal content for saving
get_file_information
()Get file information, filename
get_hash
([data])Get unique hash string (md5) for given parameter dict.
get_hash_for_path
([dotted_path])Get unique hash string for the data under given path.
get_leaf_path_list
([target_field, ...])Get path list to all leaf node in the nested dict.
get_path
(path[, default, data])Get value from nested dict with dotted path
get_path_translated
(path[, parameters])Get data with path, path can contain string constants which will be translated.
get_set
(set_id)Get parameter set
is_package
([filename])Determine if the file is compressed package.
items
()keys
()load
([filename, file_format])Load file
log
([level])Log container content
merge
(override[, target])Recursive dict merge
override
(override)Override container content recursively.
pop
(key[, default])If key is not found, default is returned if given, otherwise KeyError is raised
popitem
(/)Remove and return a (key, value) pair as a 2-tuple.
process
([create_paths, create_parameter_hints])Process parameters
process_set
(parameters[, create_paths, ...])Process parameter set
reset
([field_labels, section_labels, ...])save
([filename, file_format])Save file
set_id_exists
(set_id)Set id exists
set_ids
()Get set ids
set_path
(path, new_value[, data])Set value in nested dict with dotted path
set_path_translated
(path, new_value[, ...])Set data with path, path can contain string constants which will be translated.
setdefault
(key[, default])Insert key with a value of default if key is not in the dictionary.
show
([mode, indent, visualize])Print container content
to_html
([indent])Get container information in a HTML formatted string
to_string
([ui, indent])Get container information in a string
update
([E, ]**F)If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
update_parameter_set
(set_id)Update active parameter set
validate_format
()Validate file format
values
()Attributes
bytes
File size in bytes
logger
Logger instance
md5
Checksum for file.
valid_formats
Valid file formats