Dependencies

class audb.Dependencies[source]

Dependencies of a database.

audb.Dependencies gathers all database media, table, and attachment files and metadata about them in a single object. The metadata contains information about the single files like duration, but also what version of the file is required.

The dependencies of a database can be requested with audb.dependencies().

Examples

>>> deps = Dependencies()
>>> deps()
Empty DataFrame
Columns: [archive, bit_depth, channels, checksum, duration, format, removed, sampling_rate, type, version]
Index: []
>>> # Request dependencies for emodb 1.4.1
>>> deps = audb.dependencies("emodb", version="1.4.1")
>>> # List all files or archives
>>> deps.files[:3]
['db.emotion.csv', 'db.files.csv', 'wav/03a01Fa.wav']
>>> deps.archives[:2]
['005d2b91-5317-0c80-d602-6d55f0323f8c', '014f82d8-3491-fd00-7397-c3b2ac3b2875']
>>> # Access properties for a given file
>>> deps.archive("wav/03a01Fa.wav")
'c1f5cc6f-6d00-348a-ba3b-4adaa2436aad'
>>> deps.duration("wav/03a01Fa.wav")
1.89825
>>> deps.removed("wav/03a01Fa.wav")
False
>>> # Check if a file is part of the dependencies
>>> "wav/03a01Fa.wav" in deps
True

__call__()

Dependencies.__call__()[source]

Return dependencies as a table.

Return type

DataFrame

Returns

table with dependencies

__contains__()

Dependencies.__contains__(file)[source]

Check if file is part of dependencies.

Parameters

file (str) – relative file path

Return type

bool

Returns

True if a dependency to the file exists

__eq__()

Dependencies.__eq__(other)[source]

Check if two dependency tables are equal.

Parameters

other (Dependencies) – dependency table to compare against

Return type

bool

Returns

True if both dependency tables have the same entries

__getitem__()

Dependencies.__getitem__(file)[source]

File information.

Parameters

file (str) – relative file path

Return type

List

Returns

list with meta information

__len__()

Dependencies.__len__()[source]

Number of all media, table, attachment files.

Return type

int

archive()

Dependencies.archive(file)[source]

Name of archive the file belongs to.

Parameters

file (str) – relative file path

Return type

str

Returns

archive name

archives

Dependencies.archives

All media, table, attachment archives.

Returns

list of archives

attachment_ids

Dependencies.attachment_ids

Attachment IDs.

Returns

list of attachment IDs

attachments

Dependencies.attachments

Attachment paths (can be a file or a folder).

Returns

list of attachments

bit_depth()

Dependencies.bit_depth(file)[source]

Bit depth of media file.

Parameters

file (str) – relative file path

Return type

int

Returns

bit depth

channels()

Dependencies.channels(file)[source]

Number of channels of media file.

Parameters

file (str) – relative file path

Return type

int

Returns

number of channels

checksum()

Dependencies.checksum(file)[source]

Checksum of file.

Parameters

file (str) – relative file path

Return type

str

Returns

checksum of file

duration()

Dependencies.duration(file)[source]

Duration of file.

Parameters

file (str) – relative file path

Return type

float

Returns

duration in seconds

files

Dependencies.files

All media, table, attachments.

Returns

list of files

format()

Dependencies.format(file)[source]

Format of file.

Parameters

file (str) – relative file path

Return type

str

Returns

file format (always lower case)

load()

Dependencies.load(path)[source]

Read dependencies from file.

Clears existing dependencies.

Parameters

path (str) – path to file. File extension can be csv pkl, or parquet

Raises

media

Dependencies.media

Media files.

Returns

list of media

removed()

Dependencies.removed(file)[source]

Check if file is marked as removed.

Parameters

file (str) – relative file path

Return type

bool

Returns

True if file was removed

removed_media

Dependencies.removed_media

Removed media files.

Returns

list of media

sampling_rate()

Dependencies.sampling_rate(file)[source]

Sampling rate of media file.

Parameters

file (str) – relative file path

Return type

int

Returns

sampling rate in Hz

save()

Dependencies.save(path)[source]

Write dependencies to file.

Parameters

path (str) – path to file. File extension can be csv, pkl, or parquet

table_ids

Dependencies.table_ids

Table IDs.

Like audb.Dependencies.tables(), but only returns the table ID, i.e. db.<id>.csv.

Returns

list of table IDs

tables

Dependencies.tables

Tables files.

Returns

list of tables

type()

Dependencies.type(file)[source]

Type of file.

Parameters

file (str) – relative file path

Return type

int

Returns

type

version()

Dependencies.version(file)[source]

Version of file.

Parameters

file (str) – relative file path

Return type

str

Returns

version string