Skip to content

API Reference

Dataset Clients

Cortical Tools provides preconfigured clients for specific datasets. Each dataset client inherits all functionality from the base DatasetClient class but is preconfigured with dataset-specific parameters.

Microns Dataset

MinniePublicClient

Bases: DatasetClient

Methods:

Attributes:

  • cave (CAVEclientFull) –

    Get the CAVEclient instance for this CortexClient.

  • dataset_transform (Dataset) –

    Get the dataset transform associated with this CortexClient.

  • mesh (MeshClient) –

    Get the MeshClient instance for this CortexClient.

  • space (Dataset) –

    Get the dataset transform for this CortexClient.

  • version (int) –

    Get the materialization version of the CAVEclient.

cave property

Get the CAVEclient instance for this CortexClient.

dataset_transform property

Get the dataset transform associated with this CortexClient.

mesh property

Get the MeshClient instance for this CortexClient.

space property

Get the dataset transform for this CortexClient.

version property writable

Get the materialization version of the CAVEclient.

fix_mat_timestamp(version=None)

Fix the timestamp to a specific materialization version, by default the current version.

Parameters:

  • version (int, default: None ) –

    The materialization version to fix the timestamp to, by default None (uses current version).

get_l2_ids(root_id, bounds=None)

Get level 2 ids for a root id.

Parameters:

  • root_id (int) –

    Root ID for a neuron

Returns:

  • list[int]

    List of level 2 IDs for the specified root ID.

get_l2data(l2_ids, attributes=None, as_dataframe=True, split_columns=True)

Get attribute statistics for L2 IDs.

Parameters:

  • l2_ids (list or ndarray) –

    A list of level 2 ids.

  • attributes (list, default: None ) –

    A list of attributes to retrieve. Defaults to None, which will return all that are available. Available stats are:

    • area_nm2
    • chunk_intersect_count
    • max_dt_nm
    • mean_dt_nm
    • pca
    • pca_val
    • rep_coord_nm
    • size_nm3
  • as_dataframe (bool, default: True ) –

    If True (default), return a DataFrame indexed by l2_id. If False, return a dict with l2 ids as keys.

  • split_columns (bool, default: True ) –

    If True (default) and as_dataframe is True, split columns with multiple values (e.g. pca, rep_coord_nm) into separate columns. Has no effect when as_dataframe is False.

Returns:

  • DataFrame or dict

    Attribute statistics for the requested L2 IDs.

get_skeleton(root_id, synapses=True, restore_graph=False, restore_properties=True, synapse_reference_tables=None, skeleton_version=None, transform=None)

Get the meshwork for a specific root ID.

Parameters:

  • root_id (int) –

    Root ID for a neuron

  • synapses (bool, default: True ) –

    If True, include synapses in the meshwork, by default True

  • restore_graph (bool, default: False ) –

    If True, restore the graph structure, by default False

  • restore_properties (bool, default: True ) –

    If True, restore the properties of the meshwork, by default True

  • synapse_reference_tables (dict, default: None ) –

    Additional synapse reference tables to use, by default None

  • skeleton_version (int, default: None ) –

    Version of the skeleton to use, by default None

  • transform (Literal['rigid', 'streamline'], default: None ) –

    Type of transformation to apply, by default None

Returns:

  • Meshwork

    The meshwork for the specified root ID.

latest_valid_timestamp(root_ids)

Get the latest valid timestamps for a list of root IDs. If the root ID is out of date, it will return the last timestamp at which it was valid and could be used in queries. If the root ID is up to date, it will return the current timestamp at the request time, which is still ensured to be valid.

Parameters:

  • root_ids (list[int]) –

    The list of root IDs to get the latest valid timestamps for.

Returns:

  • NDArray

    The latest valid timestamps for the specified root IDs.

neuroglancer_url(target_url=None, clipboard=False, shorten=False, root_ids=None)

Get the Neuroglancer URL for the current datastack and version.

Parameters:

  • target_url (str, default: None ) –

    The base URL for Neuroglancer, by default None (uses default server address).

  • root_ids (Optional[list[int]], default: None ) –

    List of root IDs to include in the Neuroglancer URL, by default None (includes none).

  • clipboard (bool, default: False ) –

    If True, copy the URL to the clipboard instead of returning it, by default False.

  • shorten (bool, default: False ) –

    If True, shorten the URL using a URL shortener service, by default False.

Returns:

  • str

    The Neuroglancer URL.

now() staticmethod

Get the current time in UTC timezone.

query_synapses(root_ids, pre=False, post=False, reference_tables=None, synapse_table=None, omit_self_synapse=True, resolution=[1, 1, 1], split_positions=True, live=False, timestamp=None, suffixes=None, batch_size=10, ref_batch_size=5000, progress=True)

Query synapses for one or more root ID.

Parameters:

  • root_ids ((int, list)) –

    Root ID or list of ids for a neuron.

  • pre (bool, default: False ) –

    If True, include pre-synaptic synapses, by default True. All synapses will be concatenated into a single dataframe, with duplicate synapse ids removed.

  • post (bool, default: False ) –

    If True, include post-synaptic synapses, by default True. All synapses will be concatenated into a single dataframe, with duplicate synapse ids removed.

  • reference_tables (list, default: None ) –

    List of reference tables to use, by default None. Reference tables will be merged on "id" column, which could result in null values.

  • synapse_table (str, default: None ) –

    Name of the synapse table to use, by default None (uses default synapse table)

  • resolution

    Desired resolution for positions, by default [1, 1, 1]

  • split_positions (bool, default: True ) –

    If True, split position columns into x, y, z, by default True.

  • live (bool, default: False ) –

    If True, use live_query to query synapses, by default False.

  • timestamp (datetime, default: None ) –

    Timestamp for the query, by default None (uses current time). The same timestamp must be used for all root IDs.

  • omit_self_synapse (bool, default: True ) –

    If True, omit self-synapses, by default True

  • suffixes (dict, default: None ) –

    Suffixes to use for reference table columns, by default None.

  • batch_size (int, default: 10 ) –

    Batch size for number of cells to query at once, by default 10.

  • ref_batch_size (int, default: 5000 ) –

    Batch size for number of synapses to query in reference tables at once, by default 5000.

  • progress (bool, default: True ) –

    If True, show progress bar, by default True.

Returns:

  • DataFrame

    DataFrame containing the synapses for the specified root ID.

set_export_cloudpath(cloudpath)

Set the cloud path for static table exports.

unfix_mat_timestamp()

Unfix the timestamp from the materialization version.

version_timestamp(version=None)

Get the timestamp for a specific materialization version.

Parameters:

  • version (int, default: None ) –

    The materialization version to get the timestamp for, by default None (uses current version).

Returns:

  • datetime

    The timestamp of the specified materialization version.

MicronsProdClient

Bases: DatasetClient

Methods:

Attributes:

  • cave (CAVEclientFull) –

    Get the CAVEclient instance for this CortexClient.

  • dataset_transform (Dataset) –

    Get the dataset transform associated with this CortexClient.

  • mesh (MeshClient) –

    Get the MeshClient instance for this CortexClient.

  • space (Dataset) –

    Get the dataset transform for this CortexClient.

  • version (int) –

    Get the materialization version of the CAVEclient.

cave property

Get the CAVEclient instance for this CortexClient.

dataset_transform property

Get the dataset transform associated with this CortexClient.

mesh property

Get the MeshClient instance for this CortexClient.

space property

Get the dataset transform for this CortexClient.

version property writable

Get the materialization version of the CAVEclient.

fix_mat_timestamp(version=None)

Fix the timestamp to a specific materialization version, by default the current version.

Parameters:

  • version (int, default: None ) –

    The materialization version to fix the timestamp to, by default None (uses current version).

get_l2_ids(root_id, bounds=None)

Get level 2 ids for a root id.

Parameters:

  • root_id (int) –

    Root ID for a neuron

Returns:

  • list[int]

    List of level 2 IDs for the specified root ID.

get_l2data(l2_ids, attributes=None, as_dataframe=True, split_columns=True)

Get attribute statistics for L2 IDs.

Parameters:

  • l2_ids (list or ndarray) –

    A list of level 2 ids.

  • attributes (list, default: None ) –

    A list of attributes to retrieve. Defaults to None, which will return all that are available. Available stats are:

    • area_nm2
    • chunk_intersect_count
    • max_dt_nm
    • mean_dt_nm
    • pca
    • pca_val
    • rep_coord_nm
    • size_nm3
  • as_dataframe (bool, default: True ) –

    If True (default), return a DataFrame indexed by l2_id. If False, return a dict with l2 ids as keys.

  • split_columns (bool, default: True ) –

    If True (default) and as_dataframe is True, split columns with multiple values (e.g. pca, rep_coord_nm) into separate columns. Has no effect when as_dataframe is False.

Returns:

  • DataFrame or dict

    Attribute statistics for the requested L2 IDs.

get_skeleton(root_id, synapses=True, restore_graph=False, restore_properties=True, synapse_reference_tables=None, skeleton_version=None, transform=None)

Get the meshwork for a specific root ID.

Parameters:

  • root_id (int) –

    Root ID for a neuron

  • synapses (bool, default: True ) –

    If True, include synapses in the meshwork, by default True

  • restore_graph (bool, default: False ) –

    If True, restore the graph structure, by default False

  • restore_properties (bool, default: True ) –

    If True, restore the properties of the meshwork, by default True

  • synapse_reference_tables (dict, default: None ) –

    Additional synapse reference tables to use, by default None

  • skeleton_version (int, default: None ) –

    Version of the skeleton to use, by default None

  • transform (Literal['rigid', 'streamline'], default: None ) –

    Type of transformation to apply, by default None

Returns:

  • Meshwork

    The meshwork for the specified root ID.

latest_valid_timestamp(root_ids)

Get the latest valid timestamps for a list of root IDs. If the root ID is out of date, it will return the last timestamp at which it was valid and could be used in queries. If the root ID is up to date, it will return the current timestamp at the request time, which is still ensured to be valid.

Parameters:

  • root_ids (list[int]) –

    The list of root IDs to get the latest valid timestamps for.

Returns:

  • NDArray

    The latest valid timestamps for the specified root IDs.

neuroglancer_url(target_url=None, clipboard=False, shorten=False, root_ids=None)

Get the Neuroglancer URL for the current datastack and version.

Parameters:

  • target_url (str, default: None ) –

    The base URL for Neuroglancer, by default None (uses default server address).

  • root_ids (Optional[list[int]], default: None ) –

    List of root IDs to include in the Neuroglancer URL, by default None (includes none).

  • clipboard (bool, default: False ) –

    If True, copy the URL to the clipboard instead of returning it, by default False.

  • shorten (bool, default: False ) –

    If True, shorten the URL using a URL shortener service, by default False.

Returns:

  • str

    The Neuroglancer URL.

now() staticmethod

Get the current time in UTC timezone.

query_synapses(root_ids, pre=False, post=False, reference_tables=None, synapse_table=None, omit_self_synapse=True, resolution=[1, 1, 1], split_positions=True, live=False, timestamp=None, suffixes=None, batch_size=10, ref_batch_size=5000, progress=True)

Query synapses for one or more root ID.

Parameters:

  • root_ids ((int, list)) –

    Root ID or list of ids for a neuron.

  • pre (bool, default: False ) –

    If True, include pre-synaptic synapses, by default True. All synapses will be concatenated into a single dataframe, with duplicate synapse ids removed.

  • post (bool, default: False ) –

    If True, include post-synaptic synapses, by default True. All synapses will be concatenated into a single dataframe, with duplicate synapse ids removed.

  • reference_tables (list, default: None ) –

    List of reference tables to use, by default None. Reference tables will be merged on "id" column, which could result in null values.

  • synapse_table (str, default: None ) –

    Name of the synapse table to use, by default None (uses default synapse table)

  • resolution

    Desired resolution for positions, by default [1, 1, 1]

  • split_positions (bool, default: True ) –

    If True, split position columns into x, y, z, by default True.

  • live (bool, default: False ) –

    If True, use live_query to query synapses, by default False.

  • timestamp (datetime, default: None ) –

    Timestamp for the query, by default None (uses current time). The same timestamp must be used for all root IDs.

  • omit_self_synapse (bool, default: True ) –

    If True, omit self-synapses, by default True

  • suffixes (dict, default: None ) –

    Suffixes to use for reference table columns, by default None.

  • batch_size (int, default: 10 ) –

    Batch size for number of cells to query at once, by default 10.

  • ref_batch_size (int, default: 5000 ) –

    Batch size for number of synapses to query in reference tables at once, by default 5000.

  • progress (bool, default: True ) –

    If True, show progress bar, by default True.

Returns:

  • DataFrame

    DataFrame containing the synapses for the specified root ID.

set_export_cloudpath(cloudpath)

Set the cloud path for static table exports.

unfix_mat_timestamp()

Unfix the timestamp from the materialization version.

version_timestamp(version=None)

Get the timestamp for a specific materialization version.

Parameters:

  • version (int, default: None ) –

    The materialization version to get the timestamp for, by default None (uses current version).

Returns:

  • datetime

    The timestamp of the specified materialization version.

V1DD Dataset

V1ddPublicClient

Bases: DatasetClient

Methods:

Attributes:

  • cave (CAVEclientFull) –

    Get the CAVEclient instance for this CortexClient.

  • dataset_transform (Dataset) –

    Get the dataset transform associated with this CortexClient.

  • mesh (MeshClient) –

    Get the MeshClient instance for this CortexClient.

  • space (Dataset) –

    Get the dataset transform for this CortexClient.

  • version (int) –

    Get the materialization version of the CAVEclient.

cave property

Get the CAVEclient instance for this CortexClient.

dataset_transform property

Get the dataset transform associated with this CortexClient.

mesh property

Get the MeshClient instance for this CortexClient.

space property

Get the dataset transform for this CortexClient.

version property writable

Get the materialization version of the CAVEclient.

fix_mat_timestamp(version=None)

Fix the timestamp to a specific materialization version, by default the current version.

Parameters:

  • version (int, default: None ) –

    The materialization version to fix the timestamp to, by default None (uses current version).

get_l2_ids(root_id, bounds=None)

Get level 2 ids for a root id.

Parameters:

  • root_id (int) –

    Root ID for a neuron

Returns:

  • list[int]

    List of level 2 IDs for the specified root ID.

get_l2data(l2_ids, attributes=None, as_dataframe=True, split_columns=True)

Get attribute statistics for L2 IDs.

Parameters:

  • l2_ids (list or ndarray) –

    A list of level 2 ids.

  • attributes (list, default: None ) –

    A list of attributes to retrieve. Defaults to None, which will return all that are available. Available stats are:

    • area_nm2
    • chunk_intersect_count
    • max_dt_nm
    • mean_dt_nm
    • pca
    • pca_val
    • rep_coord_nm
    • size_nm3
  • as_dataframe (bool, default: True ) –

    If True (default), return a DataFrame indexed by l2_id. If False, return a dict with l2 ids as keys.

  • split_columns (bool, default: True ) –

    If True (default) and as_dataframe is True, split columns with multiple values (e.g. pca, rep_coord_nm) into separate columns. Has no effect when as_dataframe is False.

Returns:

  • DataFrame or dict

    Attribute statistics for the requested L2 IDs.

get_skeleton(root_id, synapses=True, restore_graph=False, restore_properties=True, synapse_reference_tables=None, skeleton_version=None, transform=None)

Get the meshwork for a specific root ID.

Parameters:

  • root_id (int) –

    Root ID for a neuron

  • synapses (bool, default: True ) –

    If True, include synapses in the meshwork, by default True

  • restore_graph (bool, default: False ) –

    If True, restore the graph structure, by default False

  • restore_properties (bool, default: True ) –

    If True, restore the properties of the meshwork, by default True

  • synapse_reference_tables (dict, default: None ) –

    Additional synapse reference tables to use, by default None

  • skeleton_version (int, default: None ) –

    Version of the skeleton to use, by default None

  • transform (Literal['rigid', 'streamline'], default: None ) –

    Type of transformation to apply, by default None

Returns:

  • Meshwork

    The meshwork for the specified root ID.

latest_valid_timestamp(root_ids)

Get the latest valid timestamps for a list of root IDs. If the root ID is out of date, it will return the last timestamp at which it was valid and could be used in queries. If the root ID is up to date, it will return the current timestamp at the request time, which is still ensured to be valid.

Parameters:

  • root_ids (list[int]) –

    The list of root IDs to get the latest valid timestamps for.

Returns:

  • NDArray

    The latest valid timestamps for the specified root IDs.

neuroglancer_url(target_url=None, clipboard=False, shorten=False, root_ids=None)

Get the Neuroglancer URL for the current datastack and version.

Parameters:

  • target_url (str, default: None ) –

    The base URL for Neuroglancer, by default None (uses default server address).

  • root_ids (Optional[list[int]], default: None ) –

    List of root IDs to include in the Neuroglancer URL, by default None (includes none).

  • clipboard (bool, default: False ) –

    If True, copy the URL to the clipboard instead of returning it, by default False.

  • shorten (bool, default: False ) –

    If True, shorten the URL using a URL shortener service, by default False.

Returns:

  • str

    The Neuroglancer URL.

now() staticmethod

Get the current time in UTC timezone.

query_synapses(root_ids, pre=False, post=False, reference_tables=None, synapse_table=None, omit_self_synapse=True, resolution=[1, 1, 1], split_positions=True, live=False, timestamp=None, suffixes=None, batch_size=10, ref_batch_size=5000, progress=True)

Query synapses for one or more root ID.

Parameters:

  • root_ids ((int, list)) –

    Root ID or list of ids for a neuron.

  • pre (bool, default: False ) –

    If True, include pre-synaptic synapses, by default True. All synapses will be concatenated into a single dataframe, with duplicate synapse ids removed.

  • post (bool, default: False ) –

    If True, include post-synaptic synapses, by default True. All synapses will be concatenated into a single dataframe, with duplicate synapse ids removed.

  • reference_tables (list, default: None ) –

    List of reference tables to use, by default None. Reference tables will be merged on "id" column, which could result in null values.

  • synapse_table (str, default: None ) –

    Name of the synapse table to use, by default None (uses default synapse table)

  • resolution

    Desired resolution for positions, by default [1, 1, 1]

  • split_positions (bool, default: True ) –

    If True, split position columns into x, y, z, by default True.

  • live (bool, default: False ) –

    If True, use live_query to query synapses, by default False.

  • timestamp (datetime, default: None ) –

    Timestamp for the query, by default None (uses current time). The same timestamp must be used for all root IDs.

  • omit_self_synapse (bool, default: True ) –

    If True, omit self-synapses, by default True

  • suffixes (dict, default: None ) –

    Suffixes to use for reference table columns, by default None.

  • batch_size (int, default: 10 ) –

    Batch size for number of cells to query at once, by default 10.

  • ref_batch_size (int, default: 5000 ) –

    Batch size for number of synapses to query in reference tables at once, by default 5000.

  • progress (bool, default: True ) –

    If True, show progress bar, by default True.

Returns:

  • DataFrame

    DataFrame containing the synapses for the specified root ID.

set_export_cloudpath(cloudpath)

Set the cloud path for static table exports.

unfix_mat_timestamp()

Unfix the timestamp from the materialization version.

version_timestamp(version=None)

Get the timestamp for a specific materialization version.

Parameters:

  • version (int, default: None ) –

    The materialization version to get the timestamp for, by default None (uses current version).

Returns:

  • datetime

    The timestamp of the specified materialization version.

V1ddClient

Bases: DatasetClient

Methods:

Attributes:

  • cave (CAVEclientFull) –

    Get the CAVEclient instance for this CortexClient.

  • dataset_transform (Dataset) –

    Get the dataset transform associated with this CortexClient.

  • mesh (MeshClient) –

    Get the MeshClient instance for this CortexClient.

  • space (Dataset) –

    Get the dataset transform for this CortexClient.

  • version (int) –

    Get the materialization version of the CAVEclient.

cave property

Get the CAVEclient instance for this CortexClient.

dataset_transform property

Get the dataset transform associated with this CortexClient.

mesh property

Get the MeshClient instance for this CortexClient.

space property

Get the dataset transform for this CortexClient.

version property writable

Get the materialization version of the CAVEclient.

fix_mat_timestamp(version=None)

Fix the timestamp to a specific materialization version, by default the current version.

Parameters:

  • version (int, default: None ) –

    The materialization version to fix the timestamp to, by default None (uses current version).

get_l2_ids(root_id, bounds=None)

Get level 2 ids for a root id.

Parameters:

  • root_id (int) –

    Root ID for a neuron

Returns:

  • list[int]

    List of level 2 IDs for the specified root ID.

get_l2data(l2_ids, attributes=None, as_dataframe=True, split_columns=True)

Get attribute statistics for L2 IDs.

Parameters:

  • l2_ids (list or ndarray) –

    A list of level 2 ids.

  • attributes (list, default: None ) –

    A list of attributes to retrieve. Defaults to None, which will return all that are available. Available stats are:

    • area_nm2
    • chunk_intersect_count
    • max_dt_nm
    • mean_dt_nm
    • pca
    • pca_val
    • rep_coord_nm
    • size_nm3
  • as_dataframe (bool, default: True ) –

    If True (default), return a DataFrame indexed by l2_id. If False, return a dict with l2 ids as keys.

  • split_columns (bool, default: True ) –

    If True (default) and as_dataframe is True, split columns with multiple values (e.g. pca, rep_coord_nm) into separate columns. Has no effect when as_dataframe is False.

Returns:

  • DataFrame or dict

    Attribute statistics for the requested L2 IDs.

get_skeleton(root_id, synapses=True, restore_graph=False, restore_properties=True, synapse_reference_tables=None, skeleton_version=None, transform=None)

Get the meshwork for a specific root ID.

Parameters:

  • root_id (int) –

    Root ID for a neuron

  • synapses (bool, default: True ) –

    If True, include synapses in the meshwork, by default True

  • restore_graph (bool, default: False ) –

    If True, restore the graph structure, by default False

  • restore_properties (bool, default: True ) –

    If True, restore the properties of the meshwork, by default True

  • synapse_reference_tables (dict, default: None ) –

    Additional synapse reference tables to use, by default None

  • skeleton_version (int, default: None ) –

    Version of the skeleton to use, by default None

  • transform (Literal['rigid', 'streamline'], default: None ) –

    Type of transformation to apply, by default None

Returns:

  • Meshwork

    The meshwork for the specified root ID.

latest_valid_timestamp(root_ids)

Get the latest valid timestamps for a list of root IDs. If the root ID is out of date, it will return the last timestamp at which it was valid and could be used in queries. If the root ID is up to date, it will return the current timestamp at the request time, which is still ensured to be valid.

Parameters:

  • root_ids (list[int]) –

    The list of root IDs to get the latest valid timestamps for.

Returns:

  • NDArray

    The latest valid timestamps for the specified root IDs.

neuroglancer_url(target_url=None, clipboard=False, shorten=False, root_ids=None)

Get the Neuroglancer URL for the current datastack and version.

Parameters:

  • target_url (str, default: None ) –

    The base URL for Neuroglancer, by default None (uses default server address).

  • root_ids (Optional[list[int]], default: None ) –

    List of root IDs to include in the Neuroglancer URL, by default None (includes none).

  • clipboard (bool, default: False ) –

    If True, copy the URL to the clipboard instead of returning it, by default False.

  • shorten (bool, default: False ) –

    If True, shorten the URL using a URL shortener service, by default False.

Returns:

  • str

    The Neuroglancer URL.

now() staticmethod

Get the current time in UTC timezone.

query_synapses(root_ids, pre=False, post=False, reference_tables=None, synapse_table=None, omit_self_synapse=True, resolution=[1, 1, 1], split_positions=True, live=False, timestamp=None, suffixes=None, batch_size=10, ref_batch_size=5000, progress=True)

Query synapses for one or more root ID.

Parameters:

  • root_ids ((int, list)) –

    Root ID or list of ids for a neuron.

  • pre (bool, default: False ) –

    If True, include pre-synaptic synapses, by default True. All synapses will be concatenated into a single dataframe, with duplicate synapse ids removed.

  • post (bool, default: False ) –

    If True, include post-synaptic synapses, by default True. All synapses will be concatenated into a single dataframe, with duplicate synapse ids removed.

  • reference_tables (list, default: None ) –

    List of reference tables to use, by default None. Reference tables will be merged on "id" column, which could result in null values.

  • synapse_table (str, default: None ) –

    Name of the synapse table to use, by default None (uses default synapse table)

  • resolution

    Desired resolution for positions, by default [1, 1, 1]

  • split_positions (bool, default: True ) –

    If True, split position columns into x, y, z, by default True.

  • live (bool, default: False ) –

    If True, use live_query to query synapses, by default False.

  • timestamp (datetime, default: None ) –

    Timestamp for the query, by default None (uses current time). The same timestamp must be used for all root IDs.

  • omit_self_synapse (bool, default: True ) –

    If True, omit self-synapses, by default True

  • suffixes (dict, default: None ) –

    Suffixes to use for reference table columns, by default None.

  • batch_size (int, default: 10 ) –

    Batch size for number of cells to query at once, by default 10.

  • ref_batch_size (int, default: 5000 ) –

    Batch size for number of synapses to query in reference tables at once, by default 5000.

  • progress (bool, default: True ) –

    If True, show progress bar, by default True.

Returns:

  • DataFrame

    DataFrame containing the synapses for the specified root ID.

set_export_cloudpath(cloudpath)

Set the cloud path for static table exports.

unfix_mat_timestamp()

Unfix the timestamp from the materialization version.

version_timestamp(version=None)

Get the timestamp for a specific materialization version.

Parameters:

  • version (int, default: None ) –

    The materialization version to get the timestamp for, by default None (uses current version).

Returns:

  • datetime

    The timestamp of the specified materialization version.

Core Classes

DatasetClient

The base class that provides core functionality for all dataset clients.

Methods:

Attributes:

  • cave (CAVEclientFull) –

    Get the CAVEclient instance for this CortexClient.

  • dataset_transform (Dataset) –

    Get the dataset transform associated with this CortexClient.

  • datastack_name (str) –

    Get the name of the datastack associated with this CortexClient.

  • mesh (MeshClient) –

    Get the MeshClient instance for this CortexClient.

  • server_address (str) –

    Get the server address associated with this CortexClient.

  • space (Dataset) –

    Get the dataset transform for this CortexClient.

  • version (int) –

    Get the materialization version of the CAVEclient.

cave property

Get the CAVEclient instance for this CortexClient.

dataset_transform property

Get the dataset transform associated with this CortexClient.

datastack_name property

Get the name of the datastack associated with this CortexClient.

mesh property

Get the MeshClient instance for this CortexClient.

server_address property

Get the server address associated with this CortexClient.

space property

Get the dataset transform for this CortexClient.

version property writable

Get the materialization version of the CAVEclient.

fix_mat_timestamp(version=None)

Fix the timestamp to a specific materialization version, by default the current version.

Parameters:

  • version (int, default: None ) –

    The materialization version to fix the timestamp to, by default None (uses current version).

get_l2_ids(root_id, bounds=None)

Get level 2 ids for a root id.

Parameters:

  • root_id (int) –

    Root ID for a neuron

Returns:

  • list[int]

    List of level 2 IDs for the specified root ID.

get_l2data(l2_ids, attributes=None, as_dataframe=True, split_columns=True)

Get attribute statistics for L2 IDs.

Parameters:

  • l2_ids (list or ndarray) –

    A list of level 2 ids.

  • attributes (list, default: None ) –

    A list of attributes to retrieve. Defaults to None, which will return all that are available. Available stats are:

    • area_nm2
    • chunk_intersect_count
    • max_dt_nm
    • mean_dt_nm
    • pca
    • pca_val
    • rep_coord_nm
    • size_nm3
  • as_dataframe (bool, default: True ) –

    If True (default), return a DataFrame indexed by l2_id. If False, return a dict with l2 ids as keys.

  • split_columns (bool, default: True ) –

    If True (default) and as_dataframe is True, split columns with multiple values (e.g. pca, rep_coord_nm) into separate columns. Has no effect when as_dataframe is False.

Returns:

  • DataFrame or dict

    Attribute statistics for the requested L2 IDs.

get_skeleton(root_id, synapses=True, restore_graph=False, restore_properties=True, synapse_reference_tables=None, skeleton_version=None, transform=None)

Get the meshwork for a specific root ID.

Parameters:

  • root_id (int) –

    Root ID for a neuron

  • synapses (bool, default: True ) –

    If True, include synapses in the meshwork, by default True

  • restore_graph (bool, default: False ) –

    If True, restore the graph structure, by default False

  • restore_properties (bool, default: True ) –

    If True, restore the properties of the meshwork, by default True

  • synapse_reference_tables (dict, default: None ) –

    Additional synapse reference tables to use, by default None

  • skeleton_version (int, default: None ) –

    Version of the skeleton to use, by default None

  • transform (Literal['rigid', 'streamline'], default: None ) –

    Type of transformation to apply, by default None

Returns:

  • Meshwork

    The meshwork for the specified root ID.

latest_valid_timestamp(root_ids)

Get the latest valid timestamps for a list of root IDs. If the root ID is out of date, it will return the last timestamp at which it was valid and could be used in queries. If the root ID is up to date, it will return the current timestamp at the request time, which is still ensured to be valid.

Parameters:

  • root_ids (list[int]) –

    The list of root IDs to get the latest valid timestamps for.

Returns:

  • NDArray

    The latest valid timestamps for the specified root IDs.

neuroglancer_url(target_url=None, clipboard=False, shorten=False, root_ids=None)

Get the Neuroglancer URL for the current datastack and version.

Parameters:

  • target_url (str, default: None ) –

    The base URL for Neuroglancer, by default None (uses default server address).

  • root_ids (Optional[list[int]], default: None ) –

    List of root IDs to include in the Neuroglancer URL, by default None (includes none).

  • clipboard (bool, default: False ) –

    If True, copy the URL to the clipboard instead of returning it, by default False.

  • shorten (bool, default: False ) –

    If True, shorten the URL using a URL shortener service, by default False.

Returns:

  • str

    The Neuroglancer URL.

now() staticmethod

Get the current time in UTC timezone.

query_synapses(root_ids, pre=False, post=False, reference_tables=None, synapse_table=None, omit_self_synapse=True, resolution=[1, 1, 1], split_positions=True, live=False, timestamp=None, suffixes=None, batch_size=10, ref_batch_size=5000, progress=True)

Query synapses for one or more root ID.

Parameters:

  • root_ids ((int, list)) –

    Root ID or list of ids for a neuron.

  • pre (bool, default: False ) –

    If True, include pre-synaptic synapses, by default True. All synapses will be concatenated into a single dataframe, with duplicate synapse ids removed.

  • post (bool, default: False ) –

    If True, include post-synaptic synapses, by default True. All synapses will be concatenated into a single dataframe, with duplicate synapse ids removed.

  • reference_tables (list, default: None ) –

    List of reference tables to use, by default None. Reference tables will be merged on "id" column, which could result in null values.

  • synapse_table (str, default: None ) –

    Name of the synapse table to use, by default None (uses default synapse table)

  • resolution

    Desired resolution for positions, by default [1, 1, 1]

  • split_positions (bool, default: True ) –

    If True, split position columns into x, y, z, by default True.

  • live (bool, default: False ) –

    If True, use live_query to query synapses, by default False.

  • timestamp (datetime, default: None ) –

    Timestamp for the query, by default None (uses current time). The same timestamp must be used for all root IDs.

  • omit_self_synapse (bool, default: True ) –

    If True, omit self-synapses, by default True

  • suffixes (dict, default: None ) –

    Suffixes to use for reference table columns, by default None.

  • batch_size (int, default: 10 ) –

    Batch size for number of cells to query at once, by default 10.

  • ref_batch_size (int, default: 5000 ) –

    Batch size for number of synapses to query in reference tables at once, by default 5000.

  • progress (bool, default: True ) –

    If True, show progress bar, by default True.

Returns:

  • DataFrame

    DataFrame containing the synapses for the specified root ID.

set_export_cloudpath(cloudpath)

Set the cloud path for static table exports.

unfix_mat_timestamp()

Unfix the timestamp from the materialization version.

version_timestamp(version=None)

Get the timestamp for a specific materialization version.

Parameters:

  • version (int, default: None ) –

    The materialization version to get the timestamp for, by default None (uses current version).

Returns:

  • datetime

    The timestamp of the specified materialization version.

MeshClient

Provides mesh-related operations and utilities.

Methods:

Attributes:

mesh_l2_mappings property

Get the dictionary of root id to mesh vertex to layer 2 id mappings.

compute_vertex_to_l2_mapping(root_id, vertices=None, faces=None, lvl2_ids=None, lvl2_pts=None, max_distance=500, ratio_better=0.5, hop_limit=None, cloudvolume_fallback=False, n_jobs=-1, return_assigner=False, mesh_kwargs=None)

Compute an approximate mapping for each mesh vertex to the associated layer 2 id. Note that this is close but somewhat heuristic due to the nature of how meshes are produced. Assignment is based first on the representative points of layer 2 ids, and then falls back to heuristic methods for floating mesh components. If a vertex cannot be assigned a layer 2 id, it will be assigned a default value of 0.

Parameters:

  • root_id (int) –

    Root ID for a neuron

  • vertices (Optional[NDArray], default: None ) –

    Vertex positions, if you have a mesh already downloaded. Will be downloaded otherwise.

  • faces (Optional[NDArray], default: None ) –

    Face indices, if you have a mesh already downloaded. Will be downloaded otherwise.

  • lvl2_ids (Optional[NDArray], default: None ) –

    Layer 2 IDs, if already loaded. Will be downloaded otherwise.

  • lvl2_pts (Optional[NDArray], default: None ) –

    Layer 2 points, if already loaded. Will be downloaded otherwise.

  • max_distance (float, default: 500 ) –

    Maximum distance for mesh compartment assignment based on proximity, in nanometers (or mesh units).

  • ratio_better (float, default: 0.5 ) –

    Ratio for how much better a proximity-based assignment must be than the second-best assignment to be used.

  • hop_limit (Optional[int], default: None ) –

    Hop limit for assignment of unassigned nodes via closest graph traversal.

  • cloudvolume_fallback (bool, default: False ) –

    Use CloudVolume to try to download data. Much slower.

  • n_jobs (int, default: -1 ) –

    Number of jobs for parallel processing. Defaults to -1 (all available cores).

  • return_assigner (bool, default: False ) –

    If True, returns the vertex assigner object as well. Defaults to False.

  • mesh_kwargs (Optional[dict], default: None ) –

    Additional keyword arguments to pass to the mesh download function.

Returns:

  • l2_mapping ( NDArray ) –

    Array of layer 2 IDs for each vertex.

  • vertex_assigner ( VertexAssigner ) –

    Object containing information about the vertex assignment process, including mesh vertices and faces.

get_mesh(root_id, *, progress=False, **kwargs)

Get single mesh from root id

Parameters:

  • root_id (int) –

    Root ID for a neuron

  • progress (bool, default: False ) –

    If True, use progress bar, by default True

  • kwargs

    Additional keyword arguments to pass to cloudvolume.mesh.get.

Returns:

  • Mesh

    Mesh

get_meshes(root_ids, *, progress=True, **kwargs)

Get multiple meshes from root ids.

Parameters:

  • root_ids (list) –

    List of root ids

  • progress (bool, default: True ) –

    If True, use progress bar, by default True

  • kwargs

    Additional keyword arguments to pass to cloudvolume.mesh.get.

Returns:

  • dict

    Dictionary of meshes keyed by root id.

File Export Classes

TableExportClient

Main client for working with static table exports.

Client for accessing CAVE table exports at a specific cloud path. Talk to your dataset admin for the cloud path and to discuss what tables are made available with this route.

Parameters:

  • cloudpath (str) –

    The cloud path to the table exports.

Methods:

Attributes:

available_files property

List available files at the cloudpath.

available_tables property

Get the available tables.

available_data_df()

Get a DataFrame of all available data.

available_versions(table_name)

Get the available versions for a specific table.

get_table(table_name, version)

Download a specific table as a DataFrame.

reset_available_files()

Reset the available files cache.

CloudFileViewExport

Individual export file representation.

Methods:

Attributes:

datapath property

Get the full file path.

headerpath property

Get the header file path.

get_dataframe(version, verbose=True)

Get the DataFrame for a specific version.