Detection#

class osekit.core.detection.Detection(begin: Timestamp, end: Timestamp, frequency_bounds: FrequencyBounds, metadata: DetectionMetaData | None = None, label: str | None = None, detector_info: DetectorInfo | None = None, detection_type: Literal['WEAK', 'POINT', 'BOX'] | None = None, confidence_indicator: ConfidenceIndicator | None = None, signal_quantity: Literal['SINGLE', 'MULTIPLE'] | None = None, signal_parameters: SignalParameters | None = None, verifications: set[Verification] | None = None)#

Class that represents a detection made on APLOSE.

Initialize a Detection object.

Parameters#

begin: Timestamp

Begin timestamp of the detection.

end: Timestamp

End timestamp of the detection.

frequency_bounds: FrequencyBounds

Frequency bounds of the detection.

metadata: DetectionMetaData | None

Metadata on the detection.

label: str | None

Label of the detection.

detector_info: DetectorInfo | None

Information on the annotator or detector.

detection_type: Literal[“WEAK”, “POINT”, “BOX”] | None

Type of the detection. WEAK: Detection made on the whole spectrogram. POINT: Detection made on one pixel of the spectrogram. BOX: Detection made on one box within the spectrogram.

confidence_indicator: ConfidenceIndicator | None

Indicator of the confidence of the annotator.

signal_quantity: Literal[“SINGLE”,”MULTIPLE”] | None

Whether there is only one signal in the detection or more.

signal_parameters: SignalParameters | None

Parameters of the annotated signal. `None if signal_quantity is MULTIPLE.

verifications: set[Verification] | None

Verifications made on this detection.

classmethod from_csv(csv: Path | list[Path]) list[Self]#

Deserialize a list of Detection from (a) detections csv file(s).

Parameters#

csv: Path | list[Path]

Path of the detections csv file. If csv is a list, all detections from the multiple csv files are concatenated together.

Returns#

list[Self]:

List of detections taken from the csv file(s).

classmethod from_dict(row: dict) Self#

Deserialize a Detection object.

to_rectangle(*, fill: bool = False, **kwargs: Any) Rectangle#

Return a matplotlib Rectangle representing the detection.

Parameters#

fill: bool

Set whether to fill the patch. Defaulted to False.

kwargs:

Additional keyword arguments

Returns#

matplotlib.patches.Rectangle

Rectangle representing the detection. The coordinates of the rectangle are in time x frequency.

class osekit.core.detection.FrequencyBounds(min: int, max: int)#

Class representing the frequency bounds of a detection.

Parameters#

min: int

Lower frequency bound.

max: int

Upper frequency bound.

property bandwidth: int#

Bandwidth of the detection.

class osekit.core.detection.DetectorInfo(name: str, expertise: Literal['NOVICE', 'AVERAGE', 'EXPERT'] | None = None)#

Class representing a detector info.

class osekit.core.detection.SignalParameters(is_itensity_too_low: bool | None = None, does_overlap_other_signals: bool | None = None, min_frequency: int | None = None, max_frequency: int | None = None, nb_relative_mins: int | None = None, nb_relative_maxes: int | None = None, nb_steps: int | None = None, trend: Literal['FLAT', 'ASCENDING', 'DESCENDING', 'MODULATED'] | None = None, frequency_jumps: bool | int | None = None, has_harmonics: bool | None = None, has_sidebands: bool | None = None, has_subharmonics: bool | None = None, has_deterministic_chaos: bool | None = None)#

Class representing parameters of detection signal.

class osekit.core.detection.ConfidenceIndicator(label: str, level: int, maximum_level: int)#

Class that represents a detection confidence indicator.

Parameters#

label: str

Name of the level of confidence.

level: int

Level of confidence of the detection.

maximum_level: int

Maximum level of confidence authorized in the project.

classmethod from_relative_level_string(label: str, relative_level_string: str) Self#

Return a ConfidenceIndicator from a string representing its level.

Parameters#

label: str

Name of the level of confidence.

relative_level_string: str

Level of confidence relative to the maximum level available. Should be formatted as n/m, where n is the level of confidence of the detection and m is the maximum level available in the project.

Returns#

ConfidenceIndicator

The confidence indicator parsed from the input string.

class osekit.core.detection.DetectionMetaData(project: str | None, filename: str | None, detection_id: int | None, base_id: int | None, comments: str | None, phase: Literal['ANNOTATION', 'VERIFICATION'] | None)#

Class that represents the metadata of a detection.

Parameters#

project: str | None

Name of the project in which the detection was made.

filename: str | None

Name of the file this detection was made on.

detection_id: int | None

ID of the detection.

base_id: int | None

ID of the base detection. May differ from detection_id if the detection is an update/correction.

comments: str | None

Comments left by the annotator.

phase: Literal[“ANNOTATION”, “VERIFICATION”] | None

Phase during which the detection was created.

class osekit.core.detection.Verification(verificator: str, is_validated: bool)#

Class that represents a verification of a detection.