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_targets_json

Write targets to path as a JSON list of records.

read_targets_json

Read a list of Target records previously written by write_targets_json.

write_targets_csv

Write targets to path as a flattened CSV (lossy: bbox/ extra_attributes are JSON-encoded into single cells).

read_targets_csv

Read a CSV previously written by write_targets_csv.

sidescanpy.targets.io.write_targets_json(targets, path)#

Write targets to path as a JSON list of records.

sidescanpy.targets.io.read_targets_json(path)#

Read a list of Target records previously written by write_targets_json.

sidescanpy.targets.io.write_targets_csv(targets, path)#

Write targets to path as a flattened CSV (lossy: bbox/ extra_attributes are JSON-encoded into single cells). A category column 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_column names the column to use as Target.category (default: the category column if present, else none). Empty cells become None.