Python API

class libsonata.EdgePopulation

Collection of edges with attributes and connectivity index

afferent_edges(*args, **kwargs)

Overloaded function.

  1. afferent_edges(target: int) → libsonata.Selection

    Return inbound edges for given node IDs.

  2. afferent_edges(target: List[int]) → libsonata.Selection

    Return 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.

  1. connecting_edges(source: int, target: int) → libsonata.Selection

    Return edges connecting two given nodes.

  2. connecting_edges(source: List[int], target: List[int]) → libsonata.Selection

    Find 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.

  1. efferent_edges(source: int) → libsonata.Selection

    Return outbound edges for given node IDs.

  2. efferent_edges(source: List[int]) → libsonata.Selection

    Return 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

get_attribute(*args, **kwargs)

Overloaded function.

  1. get_attribute(name: str, edge_id: int) → object

    Get attribute value for a given edge. See below for details.

  2. get_attribute(name: str, selection: libsonata.Selection) → object

    Get 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

  3. get_attribute(name: str, selection: libsonata.Selection, default_value: object) → object

    Get 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

get_dynamics_attribute(*args, **kwargs)

Overloaded function.

  1. get_dynamics_attribute(name: str, edge_id: int) → object

    Get dynamics attribute value for a given edge. See below for details.

  2. get_dynamics_attribute(name: str, selection: libsonata.Selection) → object

    Get 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

  3. get_dynamics_attribute(name: str, selection: libsonata.Selection, default_value: object) → object

    Get 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

get_enumeration(*args, **kwargs)

Overloaded function.

  1. get_enumeration(name: str, edge_id: int) → object

    Get enumeration values for a given edge. See below for details.

  2. get_enumeration(name: str, selection: libsonata.Selection) → object

    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

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

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.

  1. get() → libsonata.ElementDataFrame

    Return all reports

  2. get(tstart: float, tstop: float) → libsonata.ElementDataFrame

    Return reports between ‘tstart’ and ‘tstop’

  3. get(node_ids: libsonata.Selection) → libsonata.ElementDataFrame

    Return reports with all those node_ids

  4. get(node_ids: libsonata.Selection, tstart: float, tstop: float) → libsonata.ElementDataFrame

    Return 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

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

get_attribute(*args, **kwargs)

Overloaded function.

  1. get_attribute(name: str, node_id: int) → object

    Get attribute value for a given node. See below for details.

  2. get_attribute(name: str, selection: libsonata.Selection) → object

    Get 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

  3. get_attribute(name: str, selection: libsonata.Selection, default_value: object) → object

    Get 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

get_dynamics_attribute(*args, **kwargs)

Overloaded function.

  1. get_dynamics_attribute(name: str, node_id: int) → object

    Get dynamics attribute value for a given node. See below for details.

  2. get_dynamics_attribute(name: str, selection: libsonata.Selection) → object

    Get 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

  3. get_dynamics_attribute(name: str, selection: libsonata.Selection, default_value: object) → object

    Get 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

get_enumeration(*args, **kwargs)

Overloaded function.

  1. get_enumeration(name: str, node_id: int) → object

    Get enumeration values for a given node. See below for details.

  2. get_enumeration(name: str, selection: libsonata.Selection) → object

    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

match_values(*args, **kwargs)

Overloaded function.

  1. match_values(name: str, value: int) → libsonata.Selection

    Return 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

  2. match_values(name: str, value: str) → libsonata.Selection

    Return 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

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

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

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.

  1. get() → libsonata.SomaDataFrame

    Return all reports

  2. get(tstart: float, tstop: float) → libsonata.SomaDataFrame

    Return reports between ‘tstart’ and ‘tstop’

  3. get(node_ids: libsonata.Selection) → libsonata.SomaDataFrame

    Return reports with all those node_ids

  4. get(node_ids: libsonata.Selection, tstart: float, tstop: float) → libsonata.SomaDataFrame

    Return 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

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.

  1. get() → List[Tuple[int, float]]

    Return all spikes

  2. get(tstart: float, tstop: float) → List[Tuple[int, float]]

    Return spikes between ‘tstart’ and ‘tstop’

  3. get(node_ids: libsonata.Selection) → List[Tuple[int, float]]

    Return spikes with all those node_ids

  4. 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’)

class libsonata.SpikeReader

Used to read spike files

get_populations_names() → List[str]

Return a list of all population names.