Data#
acoupi.data
#
Data objects for acoupi System.
Classes#
BoundingBox
#
Bases: BaseModel
BoundingBox to locate a sound event in time and frequency.
All time values are in seconds and all frequency values are in Hz.
Attributes#
coordinates: Tuple[float, float, float, float]
instance-attribute
#
type: str = 'BoundingBox'
class-attribute
instance-attribute
#
Functions#
from_coordinates(start_time, low_freq, end_time, high_freq)
classmethod
#
Create a BoundingBox from coordinates.
validate_coordinates(value)
#
Validate that the coordinates are within range.
Deployment
#
Bases: BaseModel
A Deployment captures information about the device deployment.
This includes the latitude, longitude, and deployment start.
Attributes#
ended_on: Optional[datetime.datetime] = None
class-attribute
instance-attribute
#
The datetime when the deployment ended.
id: UUID = Field(default_factory=uuid4)
class-attribute
instance-attribute
#
The unique ID of the deployment.
latitude: Optional[float] = None
class-attribute
instance-attribute
#
The latitude of the site where the device is deployed.
longitude: Optional[float] = None
class-attribute
instance-attribute
#
The longitude of the site where the device is deployed.
name: str
instance-attribute
#
User provided name of the deployment.
started_on: datetime.datetime = Field(default_factory=datetime.datetime.now)
class-attribute
instance-attribute
#
The datetime when the device was deployed.
Functions#
validate_latitude(value)
#
Validate that the latitude are within range.
validate_longitude(value)
#
Validate that the longitude are within range.
Detection
#
Bases: BaseModel
A Detection is a single prediction from a model.
Attributes#
detection_score: float = 1
class-attribute
instance-attribute
#
The score of the detection.
id: UUID = Field(default_factory=uuid4)
class-attribute
instance-attribute
#
The unique ID of the detection
location: Optional[BoundingBox] = None
class-attribute
instance-attribute
#
The location of the detection in the recording.
tags: List[PredictedTag] = Field(default_factory=list)
class-attribute
instance-attribute
#
The tags predicted by the model for the detection.
Functions#
sort_tags(value)
#
Sort tags.
validate_score(value)
#
Validate that the score is between 0 and 1.
Message
#
Bases: BaseModel
The message to be sent to the remote server.
Attributes#
content: str
instance-attribute
#
The message to be sent. Usually a JSON string.
created_on: datetime.datetime = Field(default_factory=datetime.datetime.now)
class-attribute
instance-attribute
#
The datetime when the message was created.
id: UUID = Field(default_factory=uuid4)
class-attribute
instance-attribute
#
The unique ID of the message.
ModelOutput
#
Bases: BaseModel
The output of a model.
Attributes#
created_on: datetime.datetime = Field(default_factory=datetime.datetime.now)
class-attribute
instance-attribute
#
The datetime when the model output was created.
detections: List[Detection] = Field(default_factory=list)
class-attribute
instance-attribute
#
List of predicted sound events in the recording.
id: UUID = Field(default_factory=uuid4)
class-attribute
instance-attribute
#
The unique ID of the model output.
name_model: str
instance-attribute
#
The name of the model that produced the output.
recording: Recording
instance-attribute
#
The recording that was used as input to the model.
tags: List[PredictedTag] = Field(default_factory=list)
class-attribute
instance-attribute
#
The tags predicted by the model at the recording level.
Functions#
sort_detections(value)
#
Sort detections by ID.
sort_tags(value)
#
Sort tags.
PredictedTag
#
Bases: BaseModel
A PredictedTag is a label predicted by a model.
It consists of a key, a value and a score.
Recording
#
Bases: BaseModel
A Recording is a single audio file recorded from the microphone.
Attributes#
audio_channels: Optional[int] = Field(default=1, repr=False)
class-attribute
instance-attribute
#
The number of audio_channels in the recording.
chunksize: Optional[int] = Field(default=4096, repr=False)
class-attribute
instance-attribute
#
The chunksize of the audio file in bytes. Defaults to 4096.
created_on: datetime.datetime = Field(default_factory=datetime.datetime.now, repr=False)
class-attribute
instance-attribute
#
The datetime when the recording was made
deployment: Deployment = Field(repr=False)
class-attribute
instance-attribute
#
The deployment that the recording belongs to
duration: float = Field(repr=False)
class-attribute
instance-attribute
#
The duration of the recording in seconds
id: UUID = Field(default_factory=uuid4, repr=True)
class-attribute
instance-attribute
#
The unique ID of the recording
path: Optional[Path] = Field(None, repr=True)
class-attribute
instance-attribute
#
The path to the audio file in the local filesystem
samplerate: int = Field(repr=False)
class-attribute
instance-attribute
#
The samplerate of the recording in Hz
Functions#
validate_audio_channels(value)
#
Validate that the number of audio_channels is greater than 1.
validate_duration(value)
#
Validate that the duration is greater than 0.
validate_samplerate(value)
#
Validate that the samplerate is greater than 0.
Response
#
Bases: BaseModel
The response from sending a message.
Attributes#
content: Optional[str] = None
class-attribute
instance-attribute
#
The content of the response.
message: Message
instance-attribute
#
The message that was sent.
received_on: datetime.datetime = Field(default_factory=datetime.datetime.now)
class-attribute
instance-attribute
#
The datetime the message was received.
status: ResponseStatus
instance-attribute
#
The status of the message.
ResponseStatus
#
Bases: IntEnum
The status of a message.
Attributes#
ERROR = 2
class-attribute
instance-attribute
#
The message was sent, but there was an error.
FAILED = 1
class-attribute
instance-attribute
#
The message failed to send.
SUCCESS = 0
class-attribute
instance-attribute
#
The message was received successfully.
TIMEOUT = 3
class-attribute
instance-attribute
#
The message timed out.