AnnotationSet

class of dascore.core.annotations source

AnnotationSet(
    data = None,
    dims = None,
    vertices = None,
    attrs = None,
    creation_info = None,
    acquisition_key = None,
    history = None,
    columns = None,
)

An immutable, dataframe-backed set of annotations over patch dimensions.

Parameters

Parameter Description
data A dataframe, or anything a dataframe can be built from, holding one
row per annotation.
dims The patch dimensions the annotations are stated in. Required unless
attrs states them.
vertices A tidy frame of one row per vertex, with id, seq and one
column per dimension. Required by every path and polygon row.
attrs The set’s attributes; dims and the keywords below override it.
creation_info What produced the annotations, and when.
acquisition_key Inventory identity of the data the annotations were made on. The
producer supplies it; AnnotationSet.from_patch will take it off
a patch once the spool integration lands.
history Processing performed on that data, in PatchAttrs.history’s shape.
columns Documentation for columns, keyed by name.

Examples

import pandas as pd
import dascore as dc
frame = pd.DataFrame(
    {"group": ["event"], "distance_start": [10.0], "distance_end": [80.0]}
)
picks = dc.AnnotationSet(frame, dims=("time", "distance"))
len(picks), picks[0].group
picks[0].region.bounds["distance"]
(10.0, 80.0)

Methods

Name Description
to_dataframe Return the annotations as a dataframe.
to_vertices Return the vertices of every path and polygon as a tidy dataframe.