bluepysnap.circuit_ids

Circuit ids.

Classes

CircuitEdgeId(population, id)

Create new instance of CircuitEdgeId(population, id)

CircuitEdgeIds(index[, sort_index])

High performances CircuitEdgeID container.

CircuitIds(index[, sort_index])

High performances CircuitID container.

CircuitNodeId(population, id)

Create new instance of CircuitNodeId(population, id)

CircuitNodeIds(index[, sort_index])

High performances CircuitNodeID container.

class bluepysnap.circuit_ids.CircuitEdgeId(population, id)

Create new instance of CircuitEdgeId(population, id)

property id

Alias for field number 1

property population

Alias for field number 0

class bluepysnap.circuit_ids.CircuitEdgeIds(index, sort_index=True)

High performances CircuitEdgeID container.

Return an instance of CircuitEdgeIds.

Parameters
  • index (pandas.MultiIndex) – a multi index from pandas with the population names as first level and node IDs as the second level.

  • sort_index (bool) – if true sort the index per population and then node IDs.

append(other, inplace=False)

Append a CircuitEdgeIds to the current one.

Parameters
  • other (CircuitEdgeIds) – the other CircuitEdgeIds to append to the current one.

  • inplace (bool) – if set to True. Do the transformation inplace.

copy()

Copy a CircuitEdgeIds.

filter_population(population, inplace=False)

Filter the IDs corresponding to a population.

Parameters
  • population (str) – the population you want to extract.

  • inplace (bool) – if set to True. Do the transformation inplace.

Returns

a filtered CircuitEdgeIds containing only IDs for the given population.

Return type

CircuitEdgeIds

get_ids(unique=False)

Returns all the ID values from the circuit node IDs.

get_populations(unique=False)

Returns all population values from the circuit node IDs.

limit(limit_size, inplace=False)

Limit the size of a CircuitEdgeIds.

Notes

this function takes the first limit_size values of a circuit node ids.

Parameters
  • limit_size (int) – the size of the sample. If the size of the sample is greater than the size of the CircuitEdgeIds then all ids are kept.

  • inplace (bool) – if set to True. Do the transformation inplace.

sample(sample_size, inplace=False)

Sample a CircuitEdgeIds.

Notes

this function takes randomly sample_size values of a circuit node ids.

Parameters
  • sample_size (int) – the size of the sample. If the size of the sample is greater than the size of the CircuitEdgeIds then all ids are taken and shuffled.

  • inplace (bool) – if set to True. Do the transformation inplace.

sort(inplace=False)

Sort the CircuitEdgeIds by population and then by ids.

Parameters

inplace (bool) – if set to True. Do the transformation inplace.

Notes

sorting a CircuitEdgeIds will gives better perf for the population extraction and the data extraction from a sorted dataframe.

to_csv(filepath)

Save CircuitEdgeIds to csv format.

tolist()

Convert the CircuitEdgeIds to a list of tuples.

unique(inplace=False)

Returns only unique CircuitEdgeIds.

Notes

this function does not sort the ids

class bluepysnap.circuit_ids.CircuitIds(index, sort_index=True)

High performances CircuitID container.

This abstract class aims at defining the global ids for the circuit. It is the base class of CircuitNodeIds and CircuitEdgeIds. The pandas.MultiIndex class is used as backend and can be accessed using CircuitIds.index. A global circuit node id is the combination of a population and an ID inside this population.

Return an instance of CircuitIds.

Parameters
  • index (pandas.MultiIndex) – a multi index from pandas with the population names as first level and node IDs as the second level.

  • sort_index (bool) – if true sort the index per population and then node IDs.

append(other, inplace=False)

Append a CircuitIds to the current one.

Parameters
  • other (CircuitIds) – the other CircuitIds to append to the current one.

  • inplace (bool) – if set to True. Do the transformation inplace.

copy()

Copy a CircuitIds.

filter_population(population, inplace=False)

Filter the IDs corresponding to a population.

Parameters
  • population (str) – the population you want to extract.

  • inplace (bool) – if set to True. Do the transformation inplace.

Returns

a filtered CircuitIds containing only IDs for the given population.

Return type

CircuitIds

classmethod from_arrays(populations, population_ids, sort_index=True)

Create a set of ids using two arrays population(s) and id(s).

Parameters
  • populations (list/numpy.array) – a sequence of populations. If the population is a string then all the ids will be connected to this population.

  • population_ids (list/numpy.array) – a sequence of node IDs or a single node ID.

  • sort_index (bool) – will sort the index if set to True. Otherwise the ordering from the user inputs is kept. Sorting the index can result in better performances.

Returns

a set of global node IDs created via the populations and the node IDs

provided.

Return type

CircuitIds

classmethod from_csv(filepath)

Load CircuitIds from csv.

classmethod from_dict(ids_dictionary)

Create a set of ids using a dictionary as input.

Parameters

ids_dictionary (dict) – a dictionary with the population as keys and node IDs as values.

Notes

with the support of python 2 we cannot guaranty the ordering so we force the sorting of ids.

Returns

a set of global node IDs created via the provided dictionary.

Return type

CircuitIds

Examples

>>> CircuitIds.from_dict({"pop1": [0,2,4], "pop2": [1,2,5]})
classmethod from_tuples(circuit_id_list, sort_index=True)

Create a set of ids using a list of CircuitId or tuples as input.

Parameters
  • circuit_id_list (list) – a list of CircuitId or list of tuples.

  • sort_index (bool) – will sort the index if set to True. Otherwise the ordering from the user inputs is kept. Sorting the index can result in better performances.

Returns

a set of global node IDs created via the provided dictionary.

Return type

CircuitIds

Examples

>>> CircuitIds.from_tuples([("pop1", 0), ("pop1", 2), ("pop2", 0)])
>>> CircuitIds.from_tuples([CircuitId("pop1", 0), CircuitId("pop1", 2),
>>>                             CircuitId("pop2", 0)])
get_ids(unique=False)

Returns all the ID values from the circuit node IDs.

get_populations(unique=False)

Returns all population values from the circuit node IDs.

limit(limit_size, inplace=False)

Limit the size of a CircuitIds.

Notes

this function takes the first limit_size values of a circuit node ids.

Parameters
  • limit_size (int) – the size of the sample. If the size of the sample is greater than the size of the CircuitIds then all ids are kept.

  • inplace (bool) – if set to True. Do the transformation inplace.

sample(sample_size, inplace=False)

Sample a CircuitIds.

Notes

this function takes randomly sample_size values of a circuit node ids.

Parameters
  • sample_size (int) – the size of the sample. If the size of the sample is greater than the size of the CircuitIds then all ids are taken and shuffled.

  • inplace (bool) – if set to True. Do the transformation inplace.

sort(inplace=False)

Sort the CircuitIds by population and then by ids.

Parameters

inplace (bool) – if set to True. Do the transformation inplace.

Notes

sorting a CircuitIds will gives better perf for the population extraction and the data extraction from a sorted dataframe.

to_csv(filepath)

Save CircuitIds to csv format.

tolist()

Convert the CircuitIds to a list of tuples.

unique(inplace=False)

Returns only unique CircuitIds.

Notes

this function does not sort the ids

class bluepysnap.circuit_ids.CircuitNodeId(population, id)

Create new instance of CircuitNodeId(population, id)

property id

Alias for field number 1

property population

Alias for field number 0

class bluepysnap.circuit_ids.CircuitNodeIds(index, sort_index=True)

High performances CircuitNodeID container.

Return an instance of CircuitNodeIds.

Parameters
  • index (pandas.MultiIndex) – a multi index from pandas with the population names as first level and node IDs as the second level.

  • sort_index (bool) – if true sort the index per population and then node IDs.

append(other, inplace=False)

Append a CircuitNodeIds to the current one.

Parameters
  • other (CircuitNodeIds) – the other CircuitNodeIds to append to the current one.

  • inplace (bool) – if set to True. Do the transformation inplace.

copy()

Copy a CircuitNodeIds.

filter_population(population, inplace=False)

Filter the IDs corresponding to a population.

Parameters
  • population (str) – the population you want to extract.

  • inplace (bool) – if set to True. Do the transformation inplace.

Returns

a filtered CircuitNodeIds containing only IDs for the given population.

Return type

CircuitNodeIds

get_ids(unique=False)

Returns all the ID values from the circuit node IDs.

get_populations(unique=False)

Returns all population values from the circuit node IDs.

limit(limit_size, inplace=False)

Limit the size of a CircuitNodeIds.

Notes

this function takes the first limit_size values of a circuit node ids.

Parameters
  • limit_size (int) – the size of the sample. If the size of the sample is greater than the size of the CircuitNodeIds then all ids are kept.

  • inplace (bool) – if set to True. Do the transformation inplace.

sample(sample_size, inplace=False)

Sample a CircuitNodeIds.

Notes

this function takes randomly sample_size values of a circuit node ids.

Parameters
  • sample_size (int) – the size of the sample. If the size of the sample is greater than the size of the CircuitNodeIds then all ids are taken and shuffled.

  • inplace (bool) – if set to True. Do the transformation inplace.

sort(inplace=False)

Sort the CircuitNodeIds by population and then by ids.

Parameters

inplace (bool) – if set to True. Do the transformation inplace.

Notes

sorting a CircuitNodeIds will gives better perf for the population extraction and the data extraction from a sorted dataframe.

to_csv(filepath)

Save CircuitNodeIds to csv format.

tolist()

Convert the CircuitNodeIds to a list of tuples.

unique(inplace=False)

Returns only unique CircuitNodeIds.

Notes

this function does not sort the ids