diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f806f86b..17f7d2ef 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -3,4 +3,4 @@ current_version = 3.1.0 commit = True tag = True -[bumpversion:file:annotationframeworkclient/__init__.py] +[bumpversion:file:caveclient/__init__.py] diff --git a/FlyWireSynapseTutorial.ipynb b/FlyWireSynapseTutorial.ipynb index 70aa7a64..91420c94 100644 --- a/FlyWireSynapseTutorial.ipynb +++ b/FlyWireSynapseTutorial.ipynb @@ -7,18 +7,18 @@ "# The FrameworkClient\n", "\n", "The FrameworkClient is a client side library to allow easy interaction with the services within CAVE (connectome annotation versioning engine, also known as Dynamic Annotation Framework), eg. the annotations, stateserver. The github repository is public:\n", - "https://github.com/seung-lab/AnnotationFrameworkClient\n", + "https://github.com/seung-lab/CAVEclient\n", "\n", "The library can be installed directly from the github repository or from the prebuilt versions using pip:\n", "```\n", - "pip install annotationframeworkclient\n", + "pip install caveclient\n", "```\n", "\n", "\n", "## Tutorials\n", "\n", "This tutorial mainly covers the interactions with the materialized annotation tables. More information and better explanations of the other functionalities of the client can be found in the following tutorial. Please be advised that depending on your permission level you may not be able to execute all queries in this tutorial with the preset parameters as it was written with defaults for iarpa's microns project:\n", - "https://github.com/seung-lab/AnnotationFrameworkClient/blob/master/FrameworkClientExamples.ipynb\n", + "https://github.com/seung-lab/CAVEclient/blob/master/FrameworkClientExamples.ipynb\n", "\n", "\n", "## Authentication & Authorization\n", @@ -49,7 +49,7 @@ "source": [ "import numpy as np\n", "import datetime\n", - "from annotationframeworkclient import FrameworkClient" + "from caveclient import FrameworkClient" ] }, { @@ -1056,11 +1056,11 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Before using live materializations, please make sure that your installation of the annotationframeworkclient is `>= 3.1.0`. You can upgrade your installed version with \n", + "Before using live materializations, please make sure that your installation of the caveclient is `>= 3.1.0`. You can upgrade your installed version with \n", "\n", "\n", "```\n", - "pip install annotationframeworkclient --upgrade\n", + "pip install caveclient --upgrade\n", "```\n", "\n", "To make sure the latest version of the library is used in this notebook after an upgrade it is best to reload the notebook kernel. Your current version is:" @@ -1083,8 +1083,8 @@ } ], "source": [ - "import annotationframeworkclient\n", - "annotationframeworkclient.__version__" + "import caveclient\n", + "caveclient.__version__" ] }, { @@ -1479,8 +1479,8 @@ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n", - "\u001b[0;32m~/AnnotationFrameworkClient/annotationframeworkclient/materializationengine.py\u001b[0m in \u001b[0;36mlive_query\u001b[0;34m(self, table, timestamp, filter_in_dict, filter_out_dict, filter_equal_dict, filter_spatial, join_args, select_columns, offset, limit, datastack_name, split_positions, post_filter)\u001b[0m\n\u001b[1;32m 867\u001b[0m \u001b[0;31m# most recent materialization\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 868\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mTimeIt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"map_filters\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 869\u001b[0;31m past_filters, future_map = self.map_filters(\n\u001b[0m\u001b[1;32m 870\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mfilter_in_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilter_out_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilter_equal_dict\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 871\u001b[0m \u001b[0mtimestamp\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/AnnotationFrameworkClient/annotationframeworkclient/materializationengine.py\u001b[0m in \u001b[0;36mmap_filters\u001b[0;34m(self, filters, timestamp, timestamp_past)\u001b[0m\n\u001b[1;32m 685\u001b[0m \u001b[0mtoo_recent_str\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 686\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 687\u001b[0;31m raise ValueError(\n\u001b[0m\u001b[1;32m 688\u001b[0m \u001b[0;34mf\"Timestamp incompatible with IDs: {too_old_str}{too_recent_str}use chunkedgraph client to find valid ID(s)\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 689\u001b[0m )\n", + "\u001b[0;32m~/CAVEclient/caveclient/materializationengine.py\u001b[0m in \u001b[0;36mlive_query\u001b[0;34m(self, table, timestamp, filter_in_dict, filter_out_dict, filter_equal_dict, filter_spatial, join_args, select_columns, offset, limit, datastack_name, split_positions, post_filter)\u001b[0m\n\u001b[1;32m 867\u001b[0m \u001b[0;31m# most recent materialization\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 868\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mTimeIt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"map_filters\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 869\u001b[0;31m past_filters, future_map = self.map_filters(\n\u001b[0m\u001b[1;32m 870\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mfilter_in_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilter_out_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilter_equal_dict\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 871\u001b[0m \u001b[0mtimestamp\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/CAVEclient/caveclient/materializationengine.py\u001b[0m in \u001b[0;36mmap_filters\u001b[0;34m(self, filters, timestamp, timestamp_past)\u001b[0m\n\u001b[1;32m 685\u001b[0m \u001b[0mtoo_recent_str\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 686\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 687\u001b[0;31m raise ValueError(\n\u001b[0m\u001b[1;32m 688\u001b[0m \u001b[0;34mf\"Timestamp incompatible with IDs: {too_old_str}{too_recent_str}use chunkedgraph client to find valid ID(s)\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 689\u001b[0m )\n", "\u001b[0;31mValueError\u001b[0m: Timestamp incompatible with IDs: [720575940627185911] are expired, use chunkedgraph client to find valid ID(s)" ] } @@ -1603,7 +1603,7 @@ "source": [ "### Programmatically - Spatial lookup\n", "\n", - "The client interface allows users to query a root id for a given supervoxel id (see Section 5 in [the related tutorial](https://github.com/seung-lab/AnnotationFrameworkClient/blob/master/FrameworkClientExamples.ipynb). Supervoxel ids can be retrieved from the segmentation using [cloudvolume](https://github.com/seung-lab/cloud-volume/)." + "The client interface allows users to query a root id for a given supervoxel id (see Section 5 in [the related tutorial](https://github.com/seung-lab/CAVEclient/blob/master/FrameworkClientExamples.ipynb). Supervoxel ids can be retrieved from the segmentation using [cloudvolume](https://github.com/seung-lab/cloud-volume/)." ] }, { @@ -1659,7 +1659,7 @@ "\n", "We are building infrastructure into neuroglancer to display this information there while browsing neurons. Until this is ready, the most convenient way to visualize this information in neuroglancer is to programmatically create neuroglancer state and to upload them to the state server. The links can then be distributed. \n", "\n", - "[NeuroglancerAnnotationUI (nglui)](https://github.com/seung-lab/NeuroglancerAnnotationUI) makes programmatic creation of neuroglancer states convenient. The [statebuilder examples](https://github.com/seung-lab/NeuroglancerAnnotationUI/blob/master/examples/statebuilder_examples.ipynb) shows how one can directly from dataframes as the one above to neuroglancer states. The [related tutorial on this client](https://github.com/seung-lab/AnnotationFrameworkClient/blob/master/FrameworkClientExamples.ipynb) shows under \"4. JSON Service\" how this client can be used to upload states to the server and to create neuroglancer links.\n" + "[NeuroglancerAnnotationUI (nglui)](https://github.com/seung-lab/NeuroglancerAnnotationUI) makes programmatic creation of neuroglancer states convenient. The [statebuilder examples](https://github.com/seung-lab/NeuroglancerAnnotationUI/blob/master/examples/statebuilder_examples.ipynb) shows how one can directly from dataframes as the one above to neuroglancer states. The [related tutorial on this client](https://github.com/seung-lab/CAVEclient/blob/master/FrameworkClientExamples.ipynb) shows under \"4. JSON Service\" how this client can be used to upload states to the server and to create neuroglancer links.\n" ] }, { diff --git a/FrameworkClientExamples.ipynb b/FrameworkClientExamples.ipynb index b1f88760..84f1f813 100644 --- a/FrameworkClientExamples.ipynb +++ b/FrameworkClientExamples.ipynb @@ -6,7 +6,7 @@ "source": [ "### 1. One client to rule them all\n", "\n", - "The Dynamic Annotation Framework consists of a number of different services, each with a specific set of tasks that it can perform through REST endpoints. This module is designed to ease programmatic interaction with all of the various endpoints. Going forward, we also will be increasingly using authentication tokens for programmatic access to most if not all of the services. In order to collect a given server, datastack name, and user token together into a coherent package that can be used on multiple endpoints, we will use a FrameworkClient that can build appropriately configured clients for each of the specific services.\n", + "The Connectome Annotation Versioning Engine framework consists of a number of different services, each with a specific set of tasks that it can perform through REST endpoints. This module is designed to ease programmatic interaction with all of the various endpoints. Going forward, we also will be increasingly using authentication tokens for programmatic access to most if not all of the services. In order to collect a given server, datastack name, and user token together into a coherent package that can be used on multiple endpoints, we will use a FrameworkClient that can build appropriately configured clients for each of the specific services.\n", "\n", "The following examples cover each of the client subtypes that are associated with a single service. The ImageryClient, which is a more complex collection of tools, will be covered elsewhere." ] @@ -30,7 +30,7 @@ "metadata": {}, "outputs": [], "source": [ - "from annotationframeworkclient import FrameworkClient\n", + "from caveclient import FrameworkClient\n", "\n", "client = FrameworkClient()\n", "client.auth.get_new_token()" @@ -58,7 +58,7 @@ "metadata": {}, "outputs": [], "source": [ - "from annotationframeworkclient import FrameworkClient\n", + "from caveclient import FrameworkClient\n", "\n", "datastack_name = 'minnie65_phase3_v0'\n", "client = FrameworkClient(datastack_name)" @@ -310,7 +310,7 @@ "metadata": {}, "outputs": [], "source": [ - "from annotationframeworkclient import FrameworkClient\n", + "from caveclient import FrameworkClient\n", "\n", "datastack_name = 'minnie65_phase3_v0'\n", "client = FrameworkClient(datastack_name)" @@ -542,4 +542,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file diff --git a/README.rst b/README.rst index f1af939d..7f20499a 100644 --- a/README.rst +++ b/README.rst @@ -1,11 +1,11 @@ -.. image:: https://readthedocs.org/projects/annotationframeworkclient/badge/?version=latest - :target: https://annotationframeworkclient.readthedocs.io/en/latest/?badge=latest +.. image:: https://readthedocs.org/projects/caveclient/badge/?version=latest + :target: https://caveclient.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status -.. image:: https://github.com/seung-lab/AnnotationFrameworkClient/workflows/Annotation%20Framework%20Client/badge.svg - :target: https://github.com/seung-lab/AnnotationFrameworkClient/actions +.. image:: https://github.com/seung-lab/CAVEclient/workflows/Annotation%20Framework%20Client/badge.svg + :target: https://github.com/seung-lab/CAVEclient/actions :alt: Actions Status -AnnotationFrameworkClient +CAVEclient ########################### This repository supplies client side code to interact with microservices in the Connectome Annotation Versioning Engine (CAVE). diff --git a/annotationframeworkclient/auth.py b/annotationframeworkclient/auth.py index 855a89de..cd17a66c 100644 --- a/annotationframeworkclient/auth.py +++ b/annotationframeworkclient/auth.py @@ -40,7 +40,7 @@ def __init__( server_address=default_global_server_address, ): if token_file is None: - server=urllib.parse.urlparse(server_address).netloc + server = urllib.parse.urlparse(server_address).netloc server_file = server + "-cave-secret.json" server_file_path = os.path.join(default_token_location, server_file) server_file_path = os.path.expanduser(server_file_path) @@ -63,7 +63,7 @@ def __init__( @property def token(self): - """Secret token used to authenticate yourself to the Dynamic Annotation Framework services.""" + """Secret token used to authenticate yourself to the Connectome Annotation Versioning Engine services.""" return self._token @token.setter diff --git a/annotationframeworkclient/materializationengine.py b/annotationframeworkclient/materializationengine.py index c5056d7e..58f15d81 100644 --- a/annotationframeworkclient/materializationengine.py +++ b/annotationframeworkclient/materializationengine.py @@ -3,7 +3,7 @@ from typing import ValuesView from numpy.lib.function_base import iterable -import annotationframeworkclient +import caveclient from .base import ( ClientBaseWithDataset, ClientBaseWithDatastack, diff --git a/docs/api/annotationframeworkclient.rst b/docs/api/annotationframeworkclient.rst index ef789ec5..f15cedfe 100644 --- a/docs/api/annotationframeworkclient.rst +++ b/docs/api/annotationframeworkclient.rst @@ -1,93 +1,93 @@ -annotationframeworkclient package +caveclient package ================================= Submodules ---------- -annotationframeworkclient.annotationengine module +caveclient.annotationengine module ------------------------------------------------- -.. automodule:: annotationframeworkclient.annotationengine +.. automodule:: caveclient.annotationengine :members: :undoc-members: :show-inheritance: -annotationframeworkclient.auth module +caveclient.auth module ------------------------------------- -.. automodule:: annotationframeworkclient.auth +.. automodule:: caveclient.auth :members: :undoc-members: :show-inheritance: -annotationframeworkclient.base module +caveclient.base module ------------------------------------- -.. automodule:: annotationframeworkclient.base +.. automodule:: caveclient.base :members: :undoc-members: :show-inheritance: -annotationframeworkclient.chunkedgraph module +caveclient.chunkedgraph module --------------------------------------------- -.. automodule:: annotationframeworkclient.chunkedgraph +.. automodule:: caveclient.chunkedgraph :members: :undoc-members: :show-inheritance: -annotationframeworkclient.emannotationschemas module +caveclient.emannotationschemas module ---------------------------------------------------- -.. automodule:: annotationframeworkclient.emannotationschemas +.. automodule:: caveclient.emannotationschemas :members: :undoc-members: :show-inheritance: -annotationframeworkclient.endpoints module +caveclient.endpoints module ------------------------------------------ -.. automodule:: annotationframeworkclient.endpoints +.. automodule:: caveclient.endpoints :members: :undoc-members: :show-inheritance: -annotationframeworkclient.format\_utils module +caveclient.format\_utils module ---------------------------------------------- -.. automodule:: annotationframeworkclient.format_utils +.. automodule:: caveclient.format_utils :members: :undoc-members: :show-inheritance: -annotationframeworkclient.frameworkclient module +caveclient.frameworkclient module ------------------------------------------------ -.. automodule:: annotationframeworkclient.frameworkclient +.. automodule:: caveclient.frameworkclient :members: :undoc-members: :show-inheritance: -annotationframeworkclient.infoservice module +caveclient.infoservice module -------------------------------------------- -.. automodule:: annotationframeworkclient.infoservice +.. automodule:: caveclient.infoservice :members: :undoc-members: :show-inheritance: -annotationframeworkclient.jsonservice module +caveclient.jsonservice module -------------------------------------------- -.. automodule:: annotationframeworkclient.jsonservice +.. automodule:: caveclient.jsonservice :members: :undoc-members: :show-inheritance: -annotationframeworkclient.materializationengine module +caveclient.materializationengine module ------------------------------------------------------ -.. automodule:: annotationframeworkclient.materializationengine +.. automodule:: caveclient.materializationengine :members: :undoc-members: :show-inheritance: @@ -96,7 +96,7 @@ annotationframeworkclient.materializationengine module Module contents --------------- -.. automodule:: annotationframeworkclient +.. automodule:: caveclient :members: :undoc-members: :show-inheritance: diff --git a/docs/api/modules.rst b/docs/api/modules.rst index 47f65f7a..c93b58b4 100644 --- a/docs/api/modules.rst +++ b/docs/api/modules.rst @@ -1,7 +1,7 @@ -annotationframeworkclient +caveclient ========================= .. toctree:: :maxdepth: 4 - annotationframeworkclient + caveclient diff --git a/docs/conf.py b/docs/conf.py index 3f1dde2d..3fef3f05 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,16 +13,17 @@ import sphinx_rtd_theme import os import sys -sys.path.insert(0, os.path.abspath('..')) + +sys.path.insert(0, os.path.abspath("..")) # -- Project information ----------------------------------------------------- -project = 'AnnotationFrameworkClient' -copyright = '2020, Casey Schneider-Mizell, Forrest Collman, Sven Dorkenwald' -author = 'Casey Schneider-Mizell, Forrest Collman, Sven Dorkenwald' +project = "CAVEclient" +copyright = "2020, Casey Schneider-Mizell, Forrest Collman, Sven Dorkenwald" +author = "Casey Schneider-Mizell, Forrest Collman, Sven Dorkenwald" # The full version, including alpha/beta/rc tags -release = '1.0' +release = "1.0" # -- General configuration --------------------------------------------------- @@ -30,27 +31,32 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage', - 'sphinx.ext.napoleon', 'sphinx.ext.viewcode', 'sphinx_rtd_theme'] +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.coverage", + "sphinx.ext.napoleon", + "sphinx.ext.viewcode", + "sphinx_rtd_theme", +] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] -master_doc = 'index' +master_doc = "index" # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'sphinx_rtd_theme' +html_theme = "sphinx_rtd_theme" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] diff --git a/docs/guide/annotation.rst b/docs/guide/annotation.rst index 8330aaaa..df022237 100644 --- a/docs/guide/annotation.rst +++ b/docs/guide/annotation.rst @@ -88,4 +88,4 @@ but then its up to you to assure that the IDs don't collide with other IDs. If you leave them blank then the service will assign the IDs for you. There is a similar method for updating -:func:`annotationframeworkclient.annotationengine.AnnotationClientV2.update_annotation_df` +:func:`caveclient.annotationengine.AnnotationClientV2.update_annotation_df` diff --git a/docs/guide/chunkedgraph.rst b/docs/guide/chunkedgraph.rst index d092f69a..8bddfd7e 100644 --- a/docs/guide/chunkedgraph.rst +++ b/docs/guide/chunkedgraph.rst @@ -14,7 +14,7 @@ Usually in Neuroglancer, one never notices supervoxel ids, but they are important for programmatic work. In order to look up the root id for a location in space, one needs to use the supervoxel segmentation to get the associated supervoxel id. The ChunkedGraph client makes this easy -using the :func:`~annotationframeworkclient.chunkedgraph.ChunkedGraphClientV1.get_root_id` method. +using the :func:`~caveclient.chunkedgraph.ChunkedGraphClientV1.get_root_id` method. .. code:: python @@ -40,7 +40,7 @@ different than it is now. If you are doing this across lots of supervoxels (or any nodes) then you can do it more efficently in one request with -:func:`~annotationframeworkclient.chunkedgraph.ChunkedGraphClientV1.get_roots` +:func:`~caveclient.chunkedgraph.ChunkedGraphClientV1.get_roots` .. code:: python @@ -51,7 +51,7 @@ Getting supervoxels for a root id ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A root id is associated with a particular agglomeration of supervoxels, -which can be found with the :func:`~annotationframeworkclient.chunkedgraph.ChunkedGraphClientV1.get_leaves` method. A new root id is +which can be found with the :func:`~caveclient.chunkedgraph.ChunkedGraphClientV1.get_leaves` method. A new root id is generated for every new change in the chunkedgraph, so time stamps do not apply. @@ -69,9 +69,9 @@ option client.chunkedgraph.get_leaves(root_id,stop_layer=2) This will get all the level 2 IDs for this root, which correspond to the lowest chunk of the heirachy. -An analogous option exists for :func:`~annotationframeworkclient.chunkedgraph.ChunkedGraphClientV1.get_roots`. +An analogous option exists for :func:`~caveclient.chunkedgraph.ChunkedGraphClientV1.get_roots`. Other functions ^^^^^^^^^^^^^^^ -There are a variety of other interesting functions to explore in the :class:`~annotationframeworkclient.chunkedgraph.ChunkedGraphClientV1` +There are a variety of other interesting functions to explore in the :class:`~caveclient.chunkedgraph.ChunkedGraphClientV1` diff --git a/docs/guide/framework.rst b/docs/guide/framework.rst index 253e2a34..c5449ddd 100644 --- a/docs/guide/framework.rst +++ b/docs/guide/framework.rst @@ -1,7 +1,7 @@ Framework Client: One client for all services ============================================= -The Dynamic Annotation Framework consists of a number of different +The CAVE Framework consists of a number of different services, each with a specific set of tasks that it can perform through REST endpoints. The FrameworkCleint is designed to ease programmatic interaction @@ -15,7 +15,7 @@ Each of the individual services has their own specific documentation as well. Global and Local Services ~~~~~~~~~~~~~~~~~~~~~~~~~ -There are two categories of data in the Dynamic Annotation Framework: Global and local. +There are two categories of data in CAVE: Global and local. Local services are associated with a single so-called "datastack", which refers to a precise collection of imagery and segmentation data that function together. For example, EM imagery and a specific pychunkedgraph segmentation would be one datastack, while the same EM imagery but an initial static segmentation would be another. Datastacks are refered to by a short name, for instance ``pinky100_public_flat_v185``. @@ -36,7 +36,7 @@ only access global services can be initialized: .. code:: python - from annotationframeworkclient import FrameworkClient + from caveclient import FrameworkClient client = FrameworkClient() diff --git a/docs/guide/intro.rst b/docs/guide/intro.rst index dc196866..f74556a3 100644 --- a/docs/guide/intro.rst +++ b/docs/guide/intro.rst @@ -1,7 +1,7 @@ Getting Started =============== -AnnotationFramework client is a package for simplifying interactions with HTML services associated with the DynamicAnnotationFramework, which includes: +AnnotationFramework client is a package for simplifying interactions with HTML services associated with the CAVE (Connectome Annotation Versioning Engine), which includes: - `pychunkedgraph `_ (For tracking dynamic segmentations) - `NeuroglancerJsonServer `_ (For posting/getting neuroglancer json states) @@ -12,11 +12,11 @@ AnnotationFramework client is a package for simplifying interactions with HTML s Installation ~~~~~~~~~~~~ -The AnnotationFrameworkClient can be installed with pip: +The CAVEclient can be installed with pip: .. code-block:: bash - $ pip install annotationframeworkclient + $ pip install caveclient Assumptions ~~~~~~~~~~~ diff --git a/docs/guide/materialization.rst b/docs/guide/materialization.rst index 71a17a76..cd8122fb 100644 --- a/docs/guide/materialization.rst +++ b/docs/guide/materialization.rst @@ -5,7 +5,7 @@ The Materialization client allows one to interact with the materialized annotation tables, that were posted to the annotation service (see :doc:`annotation`). -To see the entire class visit the API doc :class:`~annotationframeworkclient.materializationengine.MaterializatonClientV2` +To see the entire class visit the API doc :class:`~caveclient.materializationengine.MaterializatonClientV2` The service regularly looks up all annotations and the segids underneath all the boundspatialpoints. You can then query these tables to find out @@ -30,7 +30,7 @@ materialization version available. This may or may not be desirable depending o use case. If your code involves using specific IDs then you should be using a specific version that is tied to a timepoint where those IDs are valid. -To see what versions are available, use the :func:`~annotationframeworkclient.materializationengine.MaterializatonClientV2.get_versions` +To see what versions are available, use the :func:`~caveclient.materializationengine.MaterializatonClientV2.get_versions` .. code:: python @@ -38,9 +38,9 @@ To see what versions are available, use the :func:`~annotationframeworkclient.ma Each version has a timestamp it was run on as well as a date when it will expire. You can query all this metadata for a specific version using -:func:`~annotationframeworkclient.materializationengine.MaterializatonClientV2.get_version_metadata` +:func:`~caveclient.materializationengine.MaterializatonClientV2.get_version_metadata` or all versions using -:func:`~annotationframeworkclient.materializationengine.MaterializatonClientV2.get_versions_metadata` +:func:`~caveclient.materializationengine.MaterializatonClientV2.get_versions_metadata` To change the default version, alter the .version property of the materialization client. @@ -54,13 +54,13 @@ or specify the version when making a particular call. Browsing versions ^^^^^^^^^^^^^^^^^ To see what tables are available in a version you can use -:func:`~annotationframeworkclient.materializationengine.MaterializatonClientV2.get_tables` +:func:`~caveclient.materializationengine.MaterializatonClientV2.get_tables` If you want to read about the description of what that table is, use the annotationengine client -:func:`~annotationframeworkclient.annotationengine.AnnotationClientV2.get_table_metadata` +:func:`~caveclient.annotationengine.AnnotationClientV2.get_table_metadata` If you want to read more about the schema for the annotation table use the schema service -:func:`~annotationframeworkclient.emannotationschemas.SchemaClientLegacy.schema_definition` +:func:`~caveclient.emannotationschemas.SchemaClientLegacy.schema_definition` Note, the materialization service has a human readable webpage that links to the other services that might be more convienent for you to browse, @@ -79,7 +79,7 @@ To see how many annotations are in a particular table use Querying tables ^^^^^^^^^^^^^^^ To query a small table, you can just download the whole thing using -:func:`~annotationframeworkclient.materializationengine.MaterializatonClientV2.query_table` +:func:`~caveclient.materializationengine.MaterializatonClientV2.query_table` which will return a dataframe of the table. Note however, some tables, such as the synapse table might be very large 200-300 million rows @@ -125,7 +125,7 @@ To enable this option use split_columns=True. Below is an example of using both split_columns=True) -You can recombine split-out position columns using :func:`~annotationframeworkclient.materializationengine.concatenate_position_columns` +You can recombine split-out position columns using :func:`~caveclient.materializationengine.concatenate_position_columns` Live Query @@ -135,7 +135,7 @@ timestamp of the materialization. If you query the tables with an ID that is no time of the materialization you will get empty results. To check if root_ids are valid at your materialization's timestamp, you can use -:func:`~annotationframeworkclient.chunkedgraph.ChunkedGraphClientV1.is_latest_roots` +:func:`~caveclient.chunkedgraph.ChunkedGraphClientV1.is_latest_roots` .. code:: python @@ -147,7 +147,7 @@ To check if root_ids are valid at your materialization's timestamp, you can use If you need to lookup what happened to that ID, you can use the chunkedgraph lineage tree, to look into the future or the past, depending on your application you can use -:func:`~annotationframeworkclient.chunkedgraph.ChunkedGraphClientV1.get_lineage_graph` +:func:`~caveclient.chunkedgraph.ChunkedGraphClientV1.get_lineage_graph` Again, the ideal situation is that you have an annotation in the database which refers to your objects of interest, and querying that table by the id column will return the @@ -155,7 +155,7 @@ object in the most recent materialization. However, sometimes you might be browsing and proofreadding the data and get an ID that is more recent that the most recent version available. For convience, you can use -:func:`~annotationframeworkclient.materializationengine.MaterializatonClientV2.live_query` +:func:`~caveclient.materializationengine.MaterializatonClientV2.live_query` to automatically update the results of your query to a time in the future, such as now. For example, to pass now, use ```datetime.datetime.utcnow```. Note all timestamps are in UTC diff --git a/docs/index.rst b/docs/index.rst index 1d18d3fd..5c398eb8 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,4 @@ -Welcome to AnnotationFrameworkClient's documentation! +Welcome to CAVEclient's documentation! ===================================================== .. toctree:: @@ -21,7 +21,7 @@ API :maxdepth: 2 :caption: API: - api/annotationframeworkclient + api/caveclient Indices and tables diff --git a/scripts/release.sh b/scripts/release.sh index ce08cdbc..2e6b0f03 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -3,4 +3,4 @@ bumpversion $1 git push && git push --tags TAG=$(git describe --tags) python setup.py sdist -twine upload dist/annotationframeworkclient-${TAG:1}.tar.gz +twine upload dist/caveclient-${TAG:1}.tar.gz diff --git a/setup.py b/setup.py index 968109e6..d38c1a5a 100644 --- a/setup.py +++ b/setup.py @@ -23,13 +23,13 @@ def find_version(*file_paths): required = f.read().splitlines() setup( - version=find_version("annotationframeworkclient", "__init__.py"), - name="annotationframeworkclient", + version=find_version("caveclient", "__init__.py"), + name="caveclient", description="a service for interacting with the AnnotationFramework", author="Sven Dorkenwald", author_email="svenmd@princeton.edu", - url="https://github.com/seung-lab/AnnotationFrameworkClient", - packages=["annotationframeworkclient"], + url="https://github.com/seung-lab/CAVEclient", + packages=["caveclient"], include_package_data=True, install_requires=required, setup_requires=["pytest-runner"], diff --git a/synapse_example.py b/synapse_example.py index 9e9ed8d1..93f1ab34 100644 --- a/synapse_example.py +++ b/synapse_example.py @@ -3,14 +3,13 @@ import numpy as np import time -from annotationframeworkclient import annotationengine as ae +from caveclient import annotationengine as ae HOME = os.path.expanduser("~") -def load_synapses(path=HOME + "/Downloads/pinky100_final.df", - scaling=(1, 1, 1)): - """ Test scenario using real synapses """ +def load_synapses(path=HOME + "/Downloads/pinky100_final.df", scaling=(1, 1, 1)): + """Test scenario using real synapses""" scaling = np.array(list(scaling)) @@ -22,16 +21,24 @@ def load_synapses(path=HOME + "/Downloads/pinky100_final.df", df = df[mask] - df['pre_pt.position'] = list((np.array(df[['presyn_x', 'presyn_y', 'presyn_z']]) / scaling).astype(np.int)) - df['ctr_pt.position'] = list((np.array(df[['centroid_x', 'centroid_y', 'centroid_z']]) / scaling).astype(np.int)) - df['post_pt.position'] = list((np.array(df[['postsyn_x', 'postsyn_y', 'postsyn_z']]) / scaling).astype(np.int)) + df["pre_pt.position"] = list( + (np.array(df[["presyn_x", "presyn_y", "presyn_z"]]) / scaling).astype(np.int) + ) + df["ctr_pt.position"] = list( + (np.array(df[["centroid_x", "centroid_y", "centroid_z"]]) / scaling).astype( + np.int + ) + ) + df["post_pt.position"] = list( + (np.array(df[["postsyn_x", "postsyn_y", "postsyn_z"]]) / scaling).astype(np.int) + ) - df = df[['pre_pt.position', 'ctr_pt.position', 'post_pt.position', 'size']] + df = df[["pre_pt.position", "ctr_pt.position", "post_pt.position", "size"]] return df -def insert_synapses(syn_df, datastack_name='pinky100', annotation_type="synapse"): +def insert_synapses(syn_df, datastack_name="pinky100", annotation_type="synapse"): ac = ae.AnnotationClient(datastack_name=datastack_name) ac.bulk_import_df(annotation_type, syn_df) @@ -47,4 +54,3 @@ def insert_synapses(syn_df, datastack_name='pinky100', annotation_type="synapse" time_start = time.time() insert_synapses(syn_df) print("Time for inserting: %.2fmin" % ((time.time() - time_start) / 60)) - diff --git a/tests/conftest.py b/tests/conftest.py index 312482ac..74b05a9e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,8 +1,8 @@ import pytest import responses -from annotationframeworkclient import FrameworkClient +from caveclient import FrameworkClient import os -from annotationframeworkclient import endpoints +from caveclient import endpoints TEST_GLOBAL_SERVER = os.environ.get("TEST_SERVER", "https://test.cave.com") diff --git a/tests/test_chunkedgraph.py b/tests/test_chunkedgraph.py index 33227b66..9940097c 100644 --- a/tests/test_chunkedgraph.py +++ b/tests/test_chunkedgraph.py @@ -3,7 +3,7 @@ import pytest import responses import numpy as np -from annotationframeworkclient.endpoints import ( +from caveclient.endpoints import ( chunkedgraph_endpoints_v1, chunkedgraph_endpoints_common, ) diff --git a/tests/test_materialization.py b/tests/test_materialization.py index 3bf56d1b..2dd55ebc 100644 --- a/tests/test_materialization.py +++ b/tests/test_materialization.py @@ -1,8 +1,8 @@ import pytest import requests -from annotationframeworkclient import FrameworkClient, materializationengine +from caveclient import FrameworkClient, materializationengine import os -from annotationframeworkclient.endpoints import ( +from caveclient.endpoints import ( materialization_endpoints_v2, chunkedgraph_endpoints_v1, chunkedgraph_endpoints_common, @@ -242,19 +242,19 @@ def mock_get_root_timestamps(self, root_ids): return np.array([timestamp_dict[root_id] for root_id in root_ids]) mocker.patch( - "annotationframeworkclient.chunkedgraph.ChunkedGraphClientV1.get_roots", + "caveclient.chunkedgraph.ChunkedGraphClientV1.get_roots", my_get_roots, ) mocker.patch( - "annotationframeworkclient.chunkedgraph.ChunkedGraphClientV1.get_past_ids", + "caveclient.chunkedgraph.ChunkedGraphClientV1.get_past_ids", mocked_get_past_ids, ) mocker.patch( - "annotationframeworkclient.chunkedgraph.ChunkedGraphClientV1.is_latest_roots", + "caveclient.chunkedgraph.ChunkedGraphClientV1.is_latest_roots", mock_is_latest_roots, ) mocker.patch( - "annotationframeworkclient.chunkedgraph.ChunkedGraphClientV1.get_root_timestamps", + "caveclient.chunkedgraph.ChunkedGraphClientV1.get_root_timestamps", mock_get_root_timestamps, ) df = pd.read_pickle("tests/test_data/live_query_before.pkl")