sidescanpy.targets.io#
JSON/CSV IO for lists of Target records.
JSON is the source-of-truth format (round-trips every field losslessly).
CSV is a secondary, flatten-to-rows view for manual/spreadsheet review —
extra_attributes is JSON-encoded into a single CSV column rather than
expanded, since its shape is format-specific and not fixed across rows.
2026 rshomberg@uri.edu
Contents
Write |
|
Read a list of |
|
Write |
|
Read a CSV previously written by |
- sidescanpy.targets.io.write_targets_json(targets, path)#
Write
targetstopathas a JSON list of records.
- sidescanpy.targets.io.read_targets_json(path)#
Read a list of
Targetrecords previously written bywrite_targets_json.
- sidescanpy.targets.io.write_targets_csv(targets, path)#
Write
targetstopathas a flattened CSV (lossy:bbox/extra_attributesare JSON-encoded into single cells). Acategorycolumn is written only if at least one target has one.
- sidescanpy.targets.io.read_targets_csv(path, *, category_column=None)#
Read a CSV previously written by
write_targets_csv.category_columnnames the column to use asTarget.category(default: thecategorycolumn if present, else none). Empty cells becomeNone.