sonicdb.database package

Submodules

sonicdb.database.base module

sonicdb.database.channel module

class sonicdb.database.channel.Channel(**kwargs)[source]

Bases: Base

Represents a channel of a sensor in the database.

id

Unique identifier for the channel.

Type:

int

number

Channel number of the sensor.

Type:

int

type_class

Type of sensor.

Type:

str

gain

Gain of the sensor.

Type:

float

sensor_id

Foreign key referencing the associated sensor.

Type:

int

sensor

Relationship to the Sensor object.

Type:

Sensor

files

List of File objects associated with the channel.

Type:

list[File]

samples

List of Sample objects associated with the channel.

Type:

list[Sample]

events

List of EventChannel objects associated with the channel.

Type:

list[EventChannel]

dict()[source]

Convert the channel’s attributes to a dictionary.

Returns:

Dictionary of channel attributes.

Return type:

dict[str, int]

Parameters:

self (Channel)

events

List of events associated with the channel.

Type:

list[EventChannel]

files

List of files associated with the channel.

Type:

list[File]

gain

Gain value of the sensor.

Type:

float

get_end()[source]

Get the latest datetime from the channel’s files.

Returns:

The latest recording datetime.

Return type:

datetime

Parameters:

self (Channel)

get_start()[source]

Get the earliest datetime from the channel’s files.

Returns:

The earliest recording datetime.

Return type:

datetime

Parameters:

self (Channel)

id

Unique identifier for the channel.

Type:

int

number

Channel number of the sensor.

Type:

int

samples

List of samples associated with the channel.

Type:

list[Sample]

sensor

Associated sensor object.

Type:

Sensor

sensor_id

Foreign key linking to the sensor’s ID.

Type:

int

type_class

Type or classification of the sensor.

Type:

str

sonicdb.database.event module

class sonicdb.database.event.Event(**kwargs)[source]

Bases: Base

Represents an event in the database.

id

Unique identifier for the event.

Type:

int

name

Name of the event.

Type:

str

start

Start time of the event.

Type:

datetime

end

End time of the event.

Type:

datetime

description

Description of the event.

Type:

str

subject_id

Foreign key linking to the associated subject.

Type:

int

subject

Relationship to the Subject object.

Type:

Subject

samples

List of Sample objects associated with the event.

Type:

list[Sample]

channels

List of EventChannel objects associated with the event.

Type:

list[EventChannel]

channels

List of channels associated with the event.

Type:

list[EventChannel]

description

Description of the event.

Type:

str

end

End time of the event.

Type:

datetime

id

Unique identifier for the event.

Type:

int

name

Name of the event.

Type:

str

samples

List of samples associated with the event.

Type:

list[Sample]

start

Start time of the event.

Type:

datetime

subject

Associated subject object.

Type:

Subject

subject_id

Foreign key linking to the subject’s ID.

Type:

int

class sonicdb.database.event.EventChannel(**kwargs)[source]

Bases: Base

Represents the association between an event and a channel.

event_id

Foreign key linking to the event’s ID.

Type:

int

event

Relationship to the Event object.

Type:

Event

channel_id

Foreign key linking to the channel’s ID.

Type:

int

channel

Relationship to the Channel object.

Type:

Channel

channel

Associated channel object.

Type:

Channel

channel_id

Foreign key linking to the channel’s ID.

Type:

int

event

Associated event object.

Type:

Event

event_id

Foreign key linking to the event’s ID.

Type:

int

sonicdb.database.sample module

class sonicdb.database.sample.Sample(**kwargs)[source]

Bases: Base

Represents a sample in the database.

id

Unique identifier for the sample.

Type:

int

event_id

Foreign key linking to the associated event.

Type:

int

event

Relationship to the Event object.

Type:

Event

sensor_id

Foreign key linking to the associated sensor.

Type:

int

sensor

Relationship to the Sensor object.

Type:

Sensor

channel_id

Foreign key linking to the associated channel.

Type:

int

channel

Relationship to the Channel object.

Type:

Channel

subject_id

Foreign key linking to the associated subject.

Type:

int

subject

Relationship to the Subject object.

Type:

Subject

datetime

Datetime of the sample data.

Type:

datetime

file_id

Foreign key linking to the associated file.

Type:

int

file

Relationship to the File object where the sample audio comes from.

Type:

File

channel

Associated channel object.

Type:

Channel

channel_id

Foreign key linking to the channel’s ID.

Type:

int

datetime

Datetime of the sample data.

Type:

datetime

event

Associated event object.

Type:

Event

event_id

Foreign key linking to the event’s ID.

Type:

int

file

Associated file object where the sample audio comes from.

Type:

File

file_id

Foreign key linking to the file’s ID.

Type:

int

get_audio()[source]

Retrieves the audio data associated with the sample.

Returns:

The audio data of the sample.

Return type:

audio.Audio

id

Unique identifier for the sample.

Type:

int

sensor

Associated sensor object.

Type:

Sensor

sensor_id

Foreign key linking to the sensor’s ID.

Type:

int

subject

Associated subject object.

Type:

Subject

subject_id

Foreign key linking to the subject’s ID.

Type:

int

sonicdb.database.sensor module

class sonicdb.database.sensor.Sensor(**kwargs)[source]

Bases: Base

Represents a sensor in the database.

id

Unique identifier for the sensor.

Type:

int

name

Name of the sensor.

Type:

str

subname

Subname of the sensor.

Type:

str

manufacturer

Manufacturer of the sensor.

Type:

str

type_class

Type class of the sensor.

Type:

str

number_of_channels

Number of channels the sensor supports.

Type:

int

channels

List of channels associated with the sensor.

Type:

list

samples

List of samples generated by the sensor audio files.

Type:

list

files

List of files recorded by the sensor.

Type:

list

channels

List of channels associated with the sensor.

Type:

list

files

List of files recorded by the sensor.

Type:

list

id

Unique identifier for the sensor.

Type:

int

manufacturer

Manufacturer of the sensor.

Type:

str

name

Name of the sensor.

Type:

str

number_of_channels

Number of channels the sensor supports.

Type:

int

samples

List of samples generated by the sensor audio files.

Type:

list

subname

Subname of the sensor.

Type:

str

type_class

Type class of the sensor.

Type:

str

sonicdb.database.subject module

class sonicdb.database.subject.Subject(**kwargs)[source]

Bases: Base

Represents a subject in the database.

id

Unique identifier for the subject.

Type:

int

name

Name of the subject.

Type:

str

samples

List of Sample objects featuring the subject.

Type:

list

events

List of Event objects featuring the subject.

Type:

list

events

List of Event objects featuring the subject.

Type:

list

id

Unique identifier for the subject.

Type:

int

name

Name of the subject.

Type:

str

samples

List of Sample objects featuring the subject.

Type:

list

Module contents