Python API¶
-
class
libsonata.
EdgePopulation
¶ Collection of edges with attributes and connectivity index
-
afferent_edges
(*args, **kwargs)¶ Overloaded function.
afferent_edges
(target: int) → libsonata.SelectionReturn inbound edges for given node IDs.
afferent_edges
(target: List[int]) → libsonata.SelectionReturn inbound edges for given node IDs.
-
property
attribute_names
¶ All attribute names (CSV columns + required attributes + union of attributes in groups)
-
connecting_edges
(*args, **kwargs)¶ Overloaded function.
connecting_edges
(source: int, target: int) → libsonata.SelectionReturn edges connecting two given nodes.
connecting_edges
(source: List[int], target: List[int]) → libsonata.SelectionFind all edges connecting two given node sets
-
property
dynamics_attribute_names
¶ All dynamics attribute names (JSON keys + union of attributes in groups)
-
efferent_edges
(*args, **kwargs)¶ Overloaded function.
efferent_edges
(source: int) → libsonata.SelectionReturn outbound edges for given node IDs.
efferent_edges
(source: List[int]) → libsonata.SelectionReturn outbound edges for given node IDs.
-
property
enumeration_names
¶ All attribute names that are explicit enumerations
See also: https://github.com/AllenInstitute/sonata/blob/master/docs/SO NATA_DEVELOPER_GUIDE.md#nodes—enum-datatypes
-
enumeration_values
(name: str) → List[str]¶ Get all allowed attribute enumeration values
- Parameter
name
: is a string to allow attributes not defined in spec
- Raises:
if there is no such attribute for the population
- Parameter
-
get_attribute
(*args, **kwargs)¶ Overloaded function.
get_attribute
(name: str, edge_id: int) → objectGet attribute value for a given edge. See below for details.
get_attribute
(name: str, selection: libsonata.Selection) → objectGet attribute values for given edge Selection
If string values are requested and the attribute is a explicit enumeration, values will be resolved to strings.
See also: https://github.com/AllenInstitute/sonata/blob/master/docs/SO NATA_DEVELOPER_GUIDE.md#nodes—enum-datatypes
- Parameter
name
: is a string to allow attributes not defined in spec
- Parameter
selection
: is a selection to retrieve the attribute values from
- Raises:
if there is no such attribute for the population
- Raises:
if the attribute is not defined for _any_ element from the selection
- Parameter
get_attribute
(name: str, selection: libsonata.Selection, default_value: object) → objectGet attribute values for given edge Selection
If string values are requested and the attribute is a explicit enumeration, values will be resolved to strings.
See also: https://github.com/AllenInstitute/sonata/blob/master/docs/SO NATA_DEVELOPER_GUIDE.md#nodes—enum-datatypes
- Parameter
name
: is a string to allow attributes not defined in spec
- Parameter
selection
: is a selection to retrieve the attribute values from
- Parameter
default
: is a value to use for edges without the given attribute
- Raises:
if there is no such attribute for the population
- Parameter
-
get_dynamics_attribute
(*args, **kwargs)¶ Overloaded function.
get_dynamics_attribute
(name: str, edge_id: int) → objectGet dynamics attribute value for a given edge. See below for details.
get_dynamics_attribute
(name: str, selection: libsonata.Selection) → objectGet dynamics attribute values for given edge Selection
- Parameter
name
: is a string to allow attributes not defined in spec
- Parameter
selection
: is a selection to retrieve the dynamics attribute values from
- Raises:
if there is no such attribute for the population
- Raises:
if the attribute is not defined for _any_ edge from the edge selection
- Parameter
get_dynamics_attribute
(name: str, selection: libsonata.Selection, default_value: object) → objectGet dynamics attribute values for given edge Selection
- Parameter
name
: is a string to allow attributes not defined in spec
- Parameter
selection
: is a selection to retrieve the dynamics attribute values from
- Parameter
default
: is a value to use for edges without the given attribute
- Raises:
if there is no such attribute for the population
- Parameter
-
get_enumeration
(*args, **kwargs)¶ Overloaded function.
get_enumeration
(name: str, edge_id: int) → objectGet enumeration values for a given edge. See below for details.
get_enumeration
(name: str, selection: libsonata.Selection) → objectGet all allowed attribute enumeration values
- Parameter
name
: is a string to allow attributes not defined in spec
- Raises:
if there is no such attribute for the population
- Parameter
-
property
name
¶ Name of the population used for identifying it in circuit composition
-
select_all
() → libsonata.Selection¶ Selection covering all elements
-
property
size
¶ Total number of elements
-
property
source
¶ Name of source population extracted from ‘source_node_id’ dataset
-
source_node
(edge_id: int) → int¶ Source node ID for a given edge
-
source_nodes
(selection: libsonata.Selection) → array¶ Return source node IDs for a given edge selection
-
property
target
¶ Name of target population extracted from ‘target_node_id’ dataset
-
target_node
(edge_id: int) → int¶ Target node ID for given edge
-
target_nodes
(selection: libsonata.Selection) → array¶ Return target node IDs for a given edge selection
-
static
write_indices
(h5_filepath: str, population: str, source_node_count: int, target_node_count: int, overwrite: bool = False) → None¶ Write bidirectional node->edge indices to EdgePopulation HDF5.
-
-
class
libsonata.
EdgeStorage
¶ Collection of EdgePopulations stored in a H5 file and optional CSV.
-
open_population
(name: str) → libsonata.EdgePopulation¶ Open a specific EdgePopulation by name
- Parameter
name
: the name of the population to open
- Raises:
if no population with such a name exists
- Parameter
-
property
population_names
¶ Set of all EdgePopulation names
-
-
class
libsonata.
ElementDataFrame
¶ Something easily convertible to pandas dataframe
-
class
libsonata.
ElementReportPopulation
¶ A population inside a ReportReader
-
property
data_units
¶ Return the unit of data.
-
get
(*args, **kwargs)¶ Overloaded function.
get
() → libsonata.ElementDataFrameReturn all reports
get
(tstart: float, tstop: float) → libsonata.ElementDataFrameReturn reports between ‘tstart’ and ‘tstop’
get
(node_ids: libsonata.Selection) → libsonata.ElementDataFrameReturn reports with all those node_ids
get
(node_ids: libsonata.Selection, tstart: float, tstop: float) → libsonata.ElementDataFrameReturn reports with all those node_ids between ‘tstart’ and ‘tstop’
-
property
sorted
¶ Return true if the data is sorted.
-
property
time_units
¶ Return the unit of time
-
property
times
¶ Return (tstart, tstop, tstep) of the population
-
property
-
class
libsonata.
ElementReportReader
¶ Used to read somas files
-
get_populations_names
() → List[str]¶ Get list of all populations
-
-
class
libsonata.
NodePopulation
¶ Collection of nodes with attributes
-
property
attribute_names
¶ All attribute names (CSV columns + required attributes + union of attributes in groups)
-
property
dynamics_attribute_names
¶ All dynamics attribute names (JSON keys + union of attributes in groups)
-
property
enumeration_names
¶ All attribute names that are explicit enumerations
See also: https://github.com/AllenInstitute/sonata/blob/master/docs/SO NATA_DEVELOPER_GUIDE.md#nodes—enum-datatypes
-
enumeration_values
(name: str) → List[str]¶ Get all allowed attribute enumeration values
- Parameter
name
: is a string to allow attributes not defined in spec
- Raises:
if there is no such attribute for the population
- Parameter
-
get_attribute
(*args, **kwargs)¶ Overloaded function.
get_attribute
(name: str, node_id: int) → objectGet attribute value for a given node. See below for details.
get_attribute
(name: str, selection: libsonata.Selection) → objectGet attribute values for given node Selection
If string values are requested and the attribute is a explicit enumeration, values will be resolved to strings.
See also: https://github.com/AllenInstitute/sonata/blob/master/docs/SO NATA_DEVELOPER_GUIDE.md#nodes—enum-datatypes
- Parameter
name
: is a string to allow attributes not defined in spec
- Parameter
selection
: is a selection to retrieve the attribute values from
- Raises:
if there is no such attribute for the population
- Raises:
if the attribute is not defined for _any_ element from the selection
- Parameter
get_attribute
(name: str, selection: libsonata.Selection, default_value: object) → objectGet attribute values for given node Selection
If string values are requested and the attribute is a explicit enumeration, values will be resolved to strings.
See also: https://github.com/AllenInstitute/sonata/blob/master/docs/SO NATA_DEVELOPER_GUIDE.md#nodes—enum-datatypes
- Parameter
name
: is a string to allow attributes not defined in spec
- Parameter
selection
: is a selection to retrieve the attribute values from
- Parameter
default
: is a value to use for nodes without the given attribute
- Raises:
if there is no such attribute for the population
- Parameter
-
get_dynamics_attribute
(*args, **kwargs)¶ Overloaded function.
get_dynamics_attribute
(name: str, node_id: int) → objectGet dynamics attribute value for a given node. See below for details.
get_dynamics_attribute
(name: str, selection: libsonata.Selection) → objectGet dynamics attribute values for given node Selection
- Parameter
name
: is a string to allow attributes not defined in spec
- Parameter
selection
: is a selection to retrieve the dynamics attribute values from
- Raises:
if there is no such attribute for the population
- Raises:
if the attribute is not defined for _any_ edge from the edge selection
- Parameter
get_dynamics_attribute
(name: str, selection: libsonata.Selection, default_value: object) → objectGet dynamics attribute values for given node Selection
- Parameter
name
: is a string to allow attributes not defined in spec
- Parameter
selection
: is a selection to retrieve the dynamics attribute values from
- Parameter
default
: is a value to use for nodes without the given attribute
- Raises:
if there is no such attribute for the population
- Parameter
-
get_enumeration
(*args, **kwargs)¶ Overloaded function.
get_enumeration
(name: str, node_id: int) → objectGet enumeration values for a given node. See below for details.
get_enumeration
(name: str, selection: libsonata.Selection) → objectGet all allowed attribute enumeration values
- Parameter
name
: is a string to allow attributes not defined in spec
- Raises:
if there is no such attribute for the population
- Parameter
-
match_values
(*args, **kwargs)¶ Overloaded function.
match_values
(name: str, value: int) → libsonata.SelectionReturn selection of where attribute values match value
As per node_set predicates,
value
must be one of type:number H5T_IEEE_*LE, H5T_STD_*LE
string H5T_C_S1
bool H5T_STD_I8LE
null invalid
- Raises:
if the attribute dtype is not comparable
Note: This does not match dynamics_params datasets
match_values
(name: str, value: str) → libsonata.SelectionReturn selection of where attribute values match value
As per node_set predicates,
value
must be one of type:number H5T_IEEE_*LE, H5T_STD_*LE
string H5T_C_S1
bool H5T_STD_I8LE
null invalid
- Raises:
if the attribute dtype is not comparable
Note: This does not match dynamics_params datasets
-
property
name
¶ Name of the population used for identifying it in circuit composition
-
select_all
() → libsonata.Selection¶ Selection covering all elements
-
property
size
¶ Total number of elements
-
property
-
class
libsonata.
NodeStorage
¶ Collection of NodePopulations stored in a H5 file and optional CSV.
-
open_population
(name: str) → libsonata.NodePopulation¶ Open a specific NodePopulation by name
- Parameter
name
: the name of the population to open
- Raises:
if no population with such a name exists
- Parameter
-
property
population_names
¶ Set of all NodePopulation names
-
-
class
libsonata.
Selection
¶ ID sequence in the form convenient for querying attributes
-
property
flat_size
¶ Total number of elements constituting Selection
-
flatten
() → array¶ Array of IDs constituting Selection
-
property
ranges
¶ Get a list of ranges constituting Selection
-
property
-
class
libsonata.
SomaDataFrame
¶ Something easily convertible to pandas dataframe
-
class
libsonata.
SomaReportPopulation
¶ A population inside a ReportReader
-
property
data_units
¶ Return the unit of data.
-
get
(*args, **kwargs)¶ Overloaded function.
get
() → libsonata.SomaDataFrameReturn all reports
get
(tstart: float, tstop: float) → libsonata.SomaDataFrameReturn reports between ‘tstart’ and ‘tstop’
get
(node_ids: libsonata.Selection) → libsonata.SomaDataFrameReturn reports with all those node_ids
get
(node_ids: libsonata.Selection, tstart: float, tstop: float) → libsonata.SomaDataFrameReturn reports with all those node_ids between ‘tstart’ and ‘tstop’
-
property
sorted
¶ Return true if the data is sorted.
-
property
time_units
¶ Return the unit of time
-
property
times
¶ Return (tstart, tstop, tstep) of the population
-
property
-
class
libsonata.
SomaReportReader
¶ Used to read somas files
-
get_populations_names
() → List[str]¶ Get list of all populations
-
-
exception
libsonata.
SonataError
¶
-
class
libsonata.
SpikePopulation
¶ A population inside a SpikeReader
-
get
(*args, **kwargs)¶ Overloaded function.
get
() → List[Tuple[int, float]]Return all spikes
get
(tstart: float, tstop: float) → List[Tuple[int, float]]Return spikes between ‘tstart’ and ‘tstop’
get
(node_ids: libsonata.Selection) → List[Tuple[int, float]]Return spikes with all those node_ids
get
(node_ids: libsonata.Selection, tstart: float, tstop: float) → List[Tuple[int, float]]Return spikes with all those node_ids between ‘tstart’ and ‘tstop’
-
property
sorting
¶ Return the way data are sorted (‘none’, ‘by_id’, ‘by_time’)
-