From 417440e5611521e00b6e817aeb396348796d498d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net>
Date: Fri, 13 Jan 2023 15:50:03 +0100
Subject: [PATCH] doc slight improvement

---
 src/taggingbackends/data/labels.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/taggingbackends/data/labels.py b/src/taggingbackends/data/labels.py
index c54f58e..3da447f 100644
--- a/src/taggingbackends/data/labels.py
+++ b/src/taggingbackends/data/labels.py
@@ -13,6 +13,19 @@ Python interface to JSON *.label* files.
 
 It is a poor parent of Julia struct `Dataset` from `PlanarLarvae.jl`.
 
+`Labels` can be used as a `dict`, with (runid, trackid) pairs as keys.
+To iterate over its content and access timeseries of labels, you can do:
+
+```
+for run_larva in labels:
+    _, larva_id = run_larva
+    timeseries_data = labels[run_larva]
+    ...
+```
+
+A `Labels` object will typically describe a single run, but can technically
+represent several runs.
+
 The following example function opens such a *.label* file and loads the
 associated track data assumed to be available as a *trx.mat* file.
 It iterates over the tracks defined in the *.label* file. The same tracks are
@@ -46,11 +59,6 @@ def retagged_trxmat_confusion_matrix(label_file):
     return cm
 ```
 
-Note that unlike the `TrxMat` class, keys in `Labels` objects are
-(runid, trackid) pairs.
-A `Labels` object will typically describe a single run, but can technically
-represent several runs.
-
 The `labelspec` attribute is assumed to be a list, which is valid for *.label*
 generated by automatic tagging.
 Manual tagging will store label names as `Labels.labelspec['names']`, because
-- 
GitLab