neu_mark.notebook

Fetches that return DataFrames and write nothing. The interactive entry point.

neu_mark.ops writes what these return, as tables plus a provenance record; both are thin over neu_mark.dvid. Everything here is re-exported at the package top level:

>>> from neu_mark import source, select_bodies, points, body_annotations
>>> src   = source("dvid://dvid.example.org/93fdbc:main/synapses",
...               locked=True)
>>> sel   = select_bodies(src, min_synapses=10)      # DataFrame: body, pre, post, syn
>>> pts, rels = points(src, sel.head(50))           # DataFrames; nothing written
>>> ann   = body_annotations("@bodies", sel.head(50))

A source is a dvid:// URL, an @name config reference (neu_mark.config), an already-opened source dict, or a bare instance name when a config supplies the server and uuid.

Functions

all_body_annotations([location, locked, config])

Every record in the property keyvalue instance, as one row per body.

body_annotations([location, bodies, locked, config])

The per-body property records for bodies, as one row per body.

body_ids(bodies) → list[int]

Body ids from a DataFrame (its body, bodyid or body_id column), a Series,

points(location, bodies, *[, threads, locked, config, ...])

Point annotations for bodies. Returns (points, relationships).

roi_set(rois, *[, config]) → list[str]

An ROI name list from a list, a comma-separated string, or an @name config set.

select_bodies([location, min_synapses, min_pre, ...])

Bodies ranked by synapse count. Returns body, pre, post, syn.

source(location, *[, kind, locked, config]) → dict[str, Any]

Resolve a location to an opened source: concrete uuid, validated instance type.

synapse_counts([location, bodies, locked, config])

Exact PreSyn/PostSyn counts for specific bodies, ignoring any threshold.

Module Contents

neu_mark.notebook.all_body_annotations(location='bodies', *, locked: bool = False, config=None)

Every record in the property keyvalue instance, as one row per body.

A different population from a synapse-selected body list: most glia, for instance, sit below any synapse threshold. About a minute for ~58,000 records (see neu_mark.dvid.fetch_all_body_annotations()).

neu_mark.notebook.body_annotations(location='bodies', bodies=None, *, locked: bool = False, config=None)

The per-body property records for bodies, as one row per body.

neu_mark.notebook.body_ids(bodies) → list[int]

Body ids from a DataFrame (its body, bodyid or body_id column), a Series, an iterable, a body-list file path, or a single id.

neu_mark.notebook.points(location, bodies, *, threads: int = _dvid.DEFAULT_THREADS, locked: bool = False, config=None, connections: bool = False, rois: Sequence[str] | str | None = None, on_roi_overlap: str = 'warn')

Point annotations for bodies. Returns (points, relationships).

With connections=True returns (points, relationships, connections), the last being de-duplicated (tbar, psd) pairs; check how much of it resolved with neu_mark.tables.match_rate().

rois (ROI names, or "@name" for a set in the config) adds a roi column to the points frame only, since a relationship’s two ends may be in different neuropils. neu_mark.tables.body_roi_counts() aggregates it per body.

neu_mark.notebook.roi_set(rois: Sequence[str] | str, *, config=None) → list[str]

An ROI name list from a list, a comma-separated string, or an @name config set.

neu_mark.notebook.select_bodies(location='counts', *, min_synapses: int = 10, min_pre: int = 0, min_post: int = 0, limit: int | None = None, locked: bool = False, config=None)

Bodies ranked by synapse count. Returns body, pre, post, syn.

The query behind neu-mark select-bodies, without writing anything.

neu_mark.notebook.source(location: str | Mapping[str, Any], *, kind: str = 'points', locked: bool = False, config=None) → dict[str, Any]

Resolve a location to an opened source: concrete uuid, validated instance type.

kind is "points" (an annotation instance), "bodies" (keyvalue) or "counts" (a labelsz index, or the annotation instance it indexes). The node is pinned once, so later calls read the same version even if the branch moves.

neu_mark.notebook.synapse_counts(location='counts', bodies=None, *, locked: bool = False, config=None)

Exact PreSyn/PostSyn counts for specific bodies, ignoring any threshold.

select_bodies() finds the bodies above a threshold; this counts a given list.