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:
-
fix_mat_timestamp–Fix the timestamp to a specific materialization version, by default the current version.
-
get_l2_ids–Get level 2 ids for a root id.
-
get_l2data–Get attribute statistics for L2 IDs.
-
get_skeleton–Get the meshwork for a specific root ID.
-
latest_valid_timestamp–Get the latest valid timestamps for a list of root IDs.
-
neuroglancer_url–Get the Neuroglancer URL for the current datastack and version.
-
now–Get the current time in UTC timezone.
-
query_synapses–Query synapses for one or more root ID.
-
set_export_cloudpath–Set the cloud path for static table exports.
-
unfix_mat_timestamp–Unfix the timestamp from the materialization version.
-
version_timestamp–Get the timestamp for a specific materialization version.
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_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_nm2chunk_intersect_countmax_dt_nmmean_dt_nmpcapca_valrep_coord_nmsize_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:
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:
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)
MicronsProdClient
Bases: DatasetClient
Methods:
-
fix_mat_timestamp–Fix the timestamp to a specific materialization version, by default the current version.
-
get_l2_ids–Get level 2 ids for a root id.
-
get_l2data–Get attribute statistics for L2 IDs.
-
get_skeleton–Get the meshwork for a specific root ID.
-
latest_valid_timestamp–Get the latest valid timestamps for a list of root IDs.
-
neuroglancer_url–Get the Neuroglancer URL for the current datastack and version.
-
now–Get the current time in UTC timezone.
-
query_synapses–Query synapses for one or more root ID.
-
set_export_cloudpath–Set the cloud path for static table exports.
-
unfix_mat_timestamp–Unfix the timestamp from the materialization version.
-
version_timestamp–Get the timestamp for a specific materialization version.
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_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_nm2chunk_intersect_countmax_dt_nmmean_dt_nmpcapca_valrep_coord_nmsize_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:
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:
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)
V1DD Dataset
V1ddPublicClient
Bases: DatasetClient
Methods:
-
fix_mat_timestamp–Fix the timestamp to a specific materialization version, by default the current version.
-
get_l2_ids–Get level 2 ids for a root id.
-
get_l2data–Get attribute statistics for L2 IDs.
-
get_skeleton–Get the meshwork for a specific root ID.
-
latest_valid_timestamp–Get the latest valid timestamps for a list of root IDs.
-
neuroglancer_url–Get the Neuroglancer URL for the current datastack and version.
-
now–Get the current time in UTC timezone.
-
query_synapses–Query synapses for one or more root ID.
-
set_export_cloudpath–Set the cloud path for static table exports.
-
unfix_mat_timestamp–Unfix the timestamp from the materialization version.
-
version_timestamp–Get the timestamp for a specific materialization version.
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_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_nm2chunk_intersect_countmax_dt_nmmean_dt_nmpcapca_valrep_coord_nmsize_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:
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:
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)
V1ddClient
Bases: DatasetClient
Methods:
-
fix_mat_timestamp–Fix the timestamp to a specific materialization version, by default the current version.
-
get_l2_ids–Get level 2 ids for a root id.
-
get_l2data–Get attribute statistics for L2 IDs.
-
get_skeleton–Get the meshwork for a specific root ID.
-
latest_valid_timestamp–Get the latest valid timestamps for a list of root IDs.
-
neuroglancer_url–Get the Neuroglancer URL for the current datastack and version.
-
now–Get the current time in UTC timezone.
-
query_synapses–Query synapses for one or more root ID.
-
set_export_cloudpath–Set the cloud path for static table exports.
-
unfix_mat_timestamp–Unfix the timestamp from the materialization version.
-
version_timestamp–Get the timestamp for a specific materialization version.
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_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_nm2chunk_intersect_countmax_dt_nmmean_dt_nmpcapca_valrep_coord_nmsize_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:
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:
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)
Core Classes
DatasetClient
The base class that provides core functionality for all dataset clients.
Methods:
-
fix_mat_timestamp–Fix the timestamp to a specific materialization version, by default the current version.
-
get_l2_ids–Get level 2 ids for a root id.
-
get_l2data–Get attribute statistics for L2 IDs.
-
get_skeleton–Get the meshwork for a specific root ID.
-
latest_valid_timestamp–Get the latest valid timestamps for a list of root IDs.
-
neuroglancer_url–Get the Neuroglancer URL for the current datastack and version.
-
now–Get the current time in UTC timezone.
-
query_synapses–Query synapses for one or more root ID.
-
set_export_cloudpath–Set the cloud path for static table exports.
-
unfix_mat_timestamp–Unfix the timestamp from the materialization version.
-
version_timestamp–Get the timestamp for a specific materialization version.
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_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_nm2chunk_intersect_countmax_dt_nmmean_dt_nmpcapca_valrep_coord_nmsize_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:
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:
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)
MeshClient
Provides mesh-related operations and utilities.
Methods:
-
compute_vertex_to_l2_mapping–Compute an approximate mapping for each mesh vertex to the associated layer 2 id.
-
get_mesh–Get single mesh from root id
-
get_meshes–Get multiple meshes from root ids.
Attributes:
-
mesh_l2_mappings(dict) –Get the dictionary of root id to mesh vertex to layer 2 id mappings.
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_meshes(root_ids, *, progress=True, **kwargs)
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:
-
available_data_df–Get a DataFrame of all available data.
-
available_versions–Get the available versions for a specific table.
-
get_table–Download a specific table as a DataFrame.
-
reset_available_files–Reset the available files cache.
Attributes:
-
available_files–List available files at the cloudpath.
-
available_tables–Get the available tables.
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:
-
get_dataframe–Get the DataFrame for a specific version.
Attributes:
-
datapath(str) –Get the full file path.
-
headerpath(str) –Get the header file path.
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.