add_table()

audformat.testing.add_table(db, table_id, index_type, *, columns=None, num_files=5, num_segments_per_file=5, file_duration='5s', file_root='audio', p_none=None, split_id=None, media_id=None)[source]

Add a table with random values.

By default, adds one column for every scheme in the database. To create a specific set of columns use columns. If a media_id is passed, the file format will be determined from there. Otherwise, WAV is used.

Parameters
  • db (Database) – a database

  • table_id (str) – ID of table that will be created

  • index_type (str) – the index type, see audformat.define.IndexType for available index types

  • columns (Union[str, Sequence[str], Dict[str, Union[str, Tuple[Optional[str], Optional[str]]]], None]) – a list of scheme_ids or a dictionary with column names as keys and tuples of (scheme_id, rater_id) as values. None values are allowed

  • num_files (Union[int, Sequence[int]]) – by default files are named '001', '002', etc. up the number of files. For a different ordering a sequence of integers can be passed

  • num_segments_per_file (int) – number of segments per file (only applies to segmented table)

  • file_duration (Union[str, Timedelta]) – the file duration

  • file_root (str) – file sub directory

  • p_none (Optional[float]) – probability to draw None

  • split_id (Optional[str]) – optional split ID

  • media_id (Optional[str]) – optional media ID

Return type

Table

Returns

table object