fafbseg.flywire.update_ids#

fafbseg.flywire.update_ids(id, stop_layer=2, supervoxels=None, timestamp=None, progress=True, *, dataset=None, **kwargs)[source]#

Retrieve the most recent version of given FlyWire (root) ID(s).

This function works by:
  1. Check if ID is outdated (see fafbseg.flywire.is_latest_root())

  2. If supervoxel provided, use it to update ID. Else try 3.

  3. See if we can map outdated IDs to a single up-to-date root (works if neuron has only seen merges). Else try 4.

  4. For uncertain IDs, fetch L2 IDs for the old root ID and the new candidates. Pick the candidate containing most of the original L2 IDs.

Parameters:
  • id (int | list-like | DataFrame | NeuronCriteria) – Single ID or list of FlyWire (root) IDs. If DataFrame must contain either a root_id or root column and optionally a supervoxel_id or supervoxel column.

  • stop_layer (int) – In case of root IDs that have been split, we need to determine the most likely successor. By default we do that using L2 IDs but you can speed this up by increasing the stop layer.

  • supervoxels (int | list-like, optional) – If provided will use these supervoxels to update id instead of sampling using the L2 IDs.

  • timestamp (int | str | datetime) – Find root ID(s) at given date (and time). Int must be unix timestamp. String must be ISO 8601 - e.g. ‘2021-11-15’. Asking for a specific time will slow things down considerably.

  • progress (bool) – If True, shows progress bar.

  • dataset ("public" | "production" | "sandbox", optional) – Against which FlyWire dataset to query. If None will fall back to the default dataset (see set_default_dataset()).

Returns:

Mapping of old -> new root IDs with confidence:

old_id   new_id   confidence   changed

0 1

Return type:

pandas.DataFrame

See also

is_latest_root()

If all you want is to know whether a (root) ID is up-to-date.

supervoxels_to_roots()

Maps supervoxels to roots. If you have supervoxel IDs for your neurons this function will be significantly faster for updating/mapping root IDs.

Examples

>>> from fafbseg import flywire
>>> flywire.update_ids(720575940621039145)
               old_id              new_id  confidence  changed
0  720575940621039145  720575940631693610         1.0     True