Skip to content

Commit

Permalink
Minor fixes for ipynb notebook tests (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
joni-herttuainen committed Jun 24, 2022
1 parent 134e6ad commit 1d05e4e
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 55 deletions.
4 changes: 2 additions & 2 deletions bluepysnap/_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ def frame_trace(filtered_report, plot_type="mean", ax=None): # pragma: no cover
slicer = []
# create a slicer that will slice only on the last level of the columns
# that is, node_id for the soma report, element_id for the compartment report
for i, _ in enumerate(levels):
max_ = levels[i][:max_per_pop][-1]
for i, level in enumerate(levels):
max_ = level[:max_per_pop][-1]
slicer.append(slice(None) if i != len(levels) - 1 else slice(None, max_))
data = filtered_report.report.loc[:, tuple(slicer)].T
# create [[(pop1, id1), (pop1, id2),...], [(pop2, id1), (pop2, id2),...]]
Expand Down
2 changes: 1 addition & 1 deletion bluepysnap/edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ def ids(self, group=None, limit=None, sample=None, raise_missing_property=True):
result = [cid.id for cid in result if cid.population == self.name]
except AttributeError as e:
raise BluepySnapError(
"All values from a list must be of type int or " "CircuitEdgeId."
"All values from a list must be of type int or CircuitEdgeId."
) from e
if sample is not None:
if len(result) > 0:
Expand Down
2 changes: 1 addition & 1 deletion bluepysnap/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def ids(self, group=None, limit=None, sample=None, raise_missing_property=True):
result = [cid.id for cid in result if cid.population == self.name]
except AttributeError as e:
raise BluepySnapError(
"All values from a list must be of type int or " "CircuitNodeId."
"All values from a list must be of type int or CircuitNodeId."
) from e
self._check_ids(result)
preserve_order = isinstance(group, Sequence)
Expand Down
57 changes: 30 additions & 27 deletions doc/source/notebooks/01_circuits.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,24 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# This step might take some minutes (large file size)\n",
"\n",
"from urllib.request import urlretrieve\n",
"from pathlib import Path\n",
"from zipfile import ZipFile\n",
"\n",
"url = \"https://zenodo.org/record/6259750/files/thalamus_microcircuit.zip?download=1\"\n",
"extract_dir=\".\"\n",
"\n",
"zip_path, _ = urlretrieve(url)\n",
"with ZipFile(zip_path, \"r\") as f:\n",
" f.extractall(extract_dir)"
"circuit_path = Path('./sonata')\n",
"if not circuit_path.exists():\n",
" zip_path, _ = urlretrieve(url)\n",
" with ZipFile(zip_path, \"r\") as f:\n",
" f.extractall(extract_dir)"
]
},
{
Expand All @@ -46,7 +49,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -63,7 +66,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -85,34 +88,34 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'version': 2,\n",
" 'node_sets_file': '/home/elisabetta/BBP/snap/doc/source/notebooks/sonata/networks/nodes/node_sets.json',\n",
" 'networks': {'nodes': [{'nodes_file': '/home/elisabetta/BBP/snap/doc/source/notebooks/sonata/networks/nodes/thalamus_neurons/nodes.h5',\n",
" 'node_sets_file': '/gpfs/bbp.cscs.ch/home/herttuai/snap/doc/source/notebooks/sonata/networks/nodes/node_sets.json',\n",
" 'networks': {'nodes': [{'nodes_file': '/gpfs/bbp.cscs.ch/home/herttuai/snap/doc/source/notebooks/sonata/networks/nodes/thalamus_neurons/nodes.h5',\n",
" 'populations': {'thalamus_neurons': {'type': 'biophysical',\n",
" 'biophysical_neuron_models_dir': '/gpfs/bbp.cscs.ch/project/proj82/home/iavarone/modelmanagement/20191105/memodels/hoc',\n",
" 'alternate_morphologies': {'neurolucida-asc': '/gpfs/bbp.cscs.ch/project/proj82/home/iavarone/morphology_release/20191031/ascii',\n",
" 'h5v1': '/gpfs/bbp.cscs.ch/project/proj82/home/iavarone/morphology_release/20191031/h5'}}}},\n",
" {'nodes_file': '/home/elisabetta/BBP/snap/doc/source/notebooks/sonata/networks/nodes/CorticoThalamic_projections/nodes.h5',\n",
" {'nodes_file': '/gpfs/bbp.cscs.ch/home/herttuai/snap/doc/source/notebooks/sonata/networks/nodes/CorticoThalamic_projections/nodes.h5',\n",
" 'populations': {'CorticoThalamic_projections': {'type': 'virtual'}}},\n",
" {'nodes_file': '/home/elisabetta/BBP/snap/doc/source/notebooks/sonata/networks/nodes/MedialLemniscus_projections/nodes.h5',\n",
" {'nodes_file': '/gpfs/bbp.cscs.ch/home/herttuai/snap/doc/source/notebooks/sonata/networks/nodes/MedialLemniscus_projections/nodes.h5',\n",
" 'populations': {'MedialLemniscus_projections': {'type': 'virtual'}}}],\n",
" 'edges': [{'edges_file': '/home/elisabetta/BBP/snap/doc/source/notebooks/sonata/networks/edges/thalamus_neurons__thalamus_neurons__chemical/edges.h5',\n",
" 'edges': [{'edges_file': '/gpfs/bbp.cscs.ch/home/herttuai/snap/doc/source/notebooks/sonata/networks/edges/thalamus_neurons__thalamus_neurons__chemical/edges.h5',\n",
" 'populations': {'thalamus_neurons__thalamus_neurons__chemical': {'type': 'chemical'}}},\n",
" {'edges_file': '/home/elisabetta/BBP/snap/doc/source/notebooks/sonata/networks/edges/thalamus_neurons__thalamus_neurons__electrical_synapse/edges.h5',\n",
" {'edges_file': '/gpfs/bbp.cscs.ch/home/herttuai/snap/doc/source/notebooks/sonata/networks/edges/thalamus_neurons__thalamus_neurons__electrical_synapse/edges.h5',\n",
" 'populations': {'thalamus_neurons__thalamus_neurons__electrical_synapse': {'type': 'electrical'}}},\n",
" {'edges_file': '/home/elisabetta/BBP/snap/doc/source/notebooks/sonata/networks/edges/MedialLemniscus_projections__thalamus_neurons__chemical/edges.h5',\n",
" {'edges_file': '/gpfs/bbp.cscs.ch/home/herttuai/snap/doc/source/notebooks/sonata/networks/edges/MedialLemniscus_projections__thalamus_neurons__chemical/edges.h5',\n",
" 'populations': {'MedialLemniscus_projections__thalamus_neurons__chemical': {'type': 'chemical'}}},\n",
" {'edges_file': '/home/elisabetta/BBP/snap/doc/source/notebooks/sonata/networks/edges/CorticoThalamic_projections__thalamus_neurons__chemical/edges.h5',\n",
" {'edges_file': '/gpfs/bbp.cscs.ch/home/herttuai/snap/doc/source/notebooks/sonata/networks/edges/CorticoThalamic_projections__thalamus_neurons__chemical/edges.h5',\n",
" 'populations': {'CorticoThalamic_projections__thalamus_neurons__chemical': {'type': 'chemical'}}}]}}"
]
},
"execution_count": 11,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -123,16 +126,16 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<bluepysnap.nodes.Nodes at 0x7f0f10385280>"
"<bluepysnap.nodes.Nodes at 0x2aaae172acd0>"
]
},
"execution_count": 12,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -143,16 +146,16 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<bluepysnap.edges.Edges at 0x7f0f10385250>"
"<bluepysnap.edges.Edges at 0x2aaae172a510>"
]
},
"execution_count": 13,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -163,16 +166,16 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<bluepysnap.node_sets.NodeSets at 0x7f0eddce1070>"
"<bluepysnap.node_sets.NodeSets at 0x2aaae1737250>"
]
},
"execution_count": 14,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -207,9 +210,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
34 changes: 16 additions & 18 deletions doc/source/notebooks/03_node_properties.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -384,16 +384,16 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<bluepysnap.node_sets.NodeSets at 0x7f7b89144c40>"
"<bluepysnap.node_sets.NodeSets at 0x2aaab7ab3df0>"
]
},
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -411,7 +411,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -459,7 +459,7 @@
" 'CT_afferents': {'population': 'CorticoThalamic_projections'}}"
]
},
"execution_count": 9,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -477,7 +477,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -494,10 +494,8 @@
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"scrolled": false
},
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -545,7 +543,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -582,7 +580,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand All @@ -591,7 +589,7 @@
"{'Rt_RC', 'VPL_IN', 'VPL_TC'}"
]
},
"execution_count": 13,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -609,7 +607,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand All @@ -622,7 +620,7 @@
" ['VPL_IN', 'bAC_IN']], dtype=object)"
]
},
"execution_count": 14,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -641,7 +639,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 14,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -726,7 +724,7 @@
"28607 mc2;Rt INH 173.007538 552.684753 837.944153"
]
},
"execution_count": 15,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
8 changes: 4 additions & 4 deletions doc/source/notebooks/04_edge_properties.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand All @@ -118,7 +118,7 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 3,
"metadata": {
"scrolled": true
},
Expand All @@ -140,7 +140,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -172,7 +172,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ known_local_folder = [

[tool.pylint.messages_control]
disable = [
'bad-continuation',
'fixme',
'invalid-name',
'len-as-condition',
'no-else-return',
'import-outside-toplevel',
'bad-mcs-classmethod-argument',
'unnecessary-lambda-assignment',
]

[tool.pylint.format]
Expand All @@ -43,7 +43,7 @@ max-locals = 15
max-returns = 6

# Maximum number of branch for function / method body
max-branchs = 12
max-branches = 12

# Maximum number of statements in function / method body
max-statements = 50
Expand Down

0 comments on commit 1d05e4e

Please sign in to comment.