AnnotationSet

class of dascore.core.annotations
inherits from: NodeRepr, RichRepr, NamespaceOwner
source

AnnotationSet(
    annotations = None,
    features = None,
    bases = None,
    dims = None,
    attrs = None,
    creation_info = None,
    acquisition_key = None,
    data_id = None,
    annotation_columns = None,
    feature_columns = None,
)

An immutable set of annotations, the features they compose, and bases.

Parameters

Parameter Description
annotations A dataframe, or anything one can be built from, of one row per
located thing. Per dimension a row states <dim>, a half-open
<dim>_min/<dim>_max range, or nothing (spanning it). A
feature_id names the feature a row belongs to; blank, the row is
its own feature. seq, part and ring order the members of
a path or polygon.
features A dataframe of one row per feature: a required id, an optional
geometry (blank for a group, path, or polygon), an
optional basis key, and any other columns. Features hold no
coordinates; a feature_id naming no row here creates a group.
bases A mapping of key to curve, as a model or its document, e.g.
{"m1": {"object_type": "Moveout", ...}}. Only a path names one.
dims Patch dimensions the annotations are stated in. Required unless
attrs supplies them.
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 annotated data.
data_id Identity of the annotated data.
annotation_columns Documentation for annotations columns, keyed by name.
feature_columns Documentation for features columns, keyed by name.

Examples

import pandas as pd
import dascore as dc
picks = pd.DataFrame(
    {
        "time": [1.0, 2.5],
        "phase": ["P", "S"],
        "feature_id": ["event_1", "event_1"],
    }
)
annotations = dc.AnnotationSet(picks, dims=("distance", "time"))
len(annotations)  # one feature, created from the feature_id
feature = annotations["event_1"]
feature.kind, len(feature.geometry.regions)
('group', 2)

Methods

Name Description
add Return a set with these tables appended.
add_feature Return a set with one more feature.
add_path Return a set with one more path; see add_feature.
add_polygon Return a set with one more single-part polygon.
bounds Return each feature’s derived bounds, one row per feature.
geometry Build the geometry of one feature.
merge Return this set combined with others.
overlapping Return the features whose bounds overlap the given ones.
remove Return a set without one feature or one annotation.
select Return the set filtered on its columns.
update Return a set with columns of one feature or one annotation changed.