Accept an existing set, dataframe-compatible data, a table, a set directory, a collection directory, or a data directory carrying .annotations.
Parameters
Parameter
Description
source
An AnnotationSet, a dataframe of one row per annotation, or a path to a CSV table, a set directory, a directory of set directories, or a directory of data carrying either under .annotations.
dims
The patch dimensions the annotations are stated in. Required unless the source states them itself – in its attributes, or in a # dims: distance, time line above its table. A source which states them takes them again only if the two agree.
**kwargs
Passed to AnnotationSet. A source already holding what one states – a set, or a directory holding its own attributes, features or bases – refuses it rather than dropping it.
Examples
import pandas as pdimport dascore as dcframe = pd.DataFrame({"phase": ["P"], "distance": [10.0]})picks = dc.annotations(frame, dims=("distance",))len(picks)dc.annotations(picks) is picksimport tempfilefrom pathlib import Pathwith tempfile.TemporaryDirectory() as folder: root = Path(folder) /"sets" _ = picks.io.save(root /"hand") _ = picks.io.save(root /"phasenet") together = dc.annotations(root)len(together), sorted(together.annotations["set"])with tempfile.TemporaryDirectory() as folder: data = Path(folder) _ = picks.io.save(data /".annotations") carried = dc.annotations(data)carried == picks