Import required packages


In [1]:
%matplotlib inline
import matplotlib.pyplot as g

from neuronunit.neuron.models import *
from neuronunit.tests import *
import neuronunit.neuroelectro
from quantities import nA, pA, s, ms, mV, ohm

Define tests to run


In [2]:
# Define which cell's properties to get
# 'nlx_anat_100201' is from Olfactory bulb mitral cell, 
# obtained from http://neuroelectro.org/neuron/129/ (Details)
neuron = {'nlex_id': 'nlx_anat_100201'} 

# Define the tests to perform on the cell
testTypes = [ \
    InputResistanceTest, \
    RestingPotentialTest, \
    InjectedCurrentAPWidthTest, \
    InjectedCurrentAPThresholdTest, \
    InjectedCurrentAPAmplitudeTest, \
    TimeConstantTest, \
]

observations = {}

Retrieve Un-Pooled Property Summary Stats from NeuroElectro.org


In [3]:
observations["UnPooled"] = {}

# Fetch NeuroElectro property values for each test
for t in xrange(len(testTypes)):
    testType = testTypes[t]
    
    # Get the observations: property means and sds
    obs = testType.neuroelectro_summary_observation(neuron)
    
    observations["UnPooled"][testType.name] = obs
    
print("UnPooled Summary Stats")
pp(observations["UnPooled"])


Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nes/?nlex=nlx_anat_100201&e__name=Input+Resistance
Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nes/?nlex=nlx_anat_100201&e__name=Resting+membrane+potential
Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nes/?nlex=nlx_anat_100201&e__name=Spike+Half-Width
Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nes/?nlex=nlx_anat_100201&e__name=Spike+Threshold
Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nes/?nlex=nlx_anat_100201&e__name=Spike+Amplitude
Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nes/?nlex=nlx_anat_100201&e__name=Membrane+Time+Constant
UnPooled Summary Stats
{'Injected current AP amplitude test': {'mean': array(68.4) * mV,
                                        'n': {u'id': 129,
                                              u'name': u'Olfactory bulb (main) mitral cell',
                                              u'neuron_db_id': 267,
                                              u'nlex_id': u'nlx_anat_100201'},
                                        'std': array(4.9179941710688) * mV},
 'Injected current AP threshold test': {'mean': array(-38.9) * mV,
                                        'n': {u'id': 129,
                                              u'name': u'Olfactory bulb (main) mitral cell',
                                              u'neuron_db_id': 267,
                                              u'nlex_id': u'nlx_anat_100201'},
                                        'std': array(7.4971105545181) * mV},
 'Injected current AP width test': {'mean': array(1.61) * ms,
                                    'n': {u'id': 129,
                                          u'name': u'Olfactory bulb (main) mitral cell',
                                          u'neuron_db_id': 267,
                                          u'nlex_id': u'nlx_anat_100201'},
                                    'std': array(0.319687347262916) * ms},
 'Input resistance test': {'mean': array(130083333.333333) * ohm,
                           'n': {u'id': 129,
                                 u'name': u'Olfactory bulb (main) mitral cell',
                                 u'neuron_db_id': 267,
                                 u'nlex_id': u'nlx_anat_100201'},
                           'std': array(76575476.5647012) * ohm},
 'Resting potential test': {'mean': array(-58.140625) * mV,
                            'n': {u'id': 129,
                                  u'name': u'Olfactory bulb (main) mitral cell',
                                  u'neuron_db_id': 267,
                                  u'nlex_id': u'nlx_anat_100201'},
                            'std': array(4.9934087414686) * mV},
 'Time constant test': {'mean': array(24.4833333333333) * ms,
                        'n': {u'id': 129,
                              u'name': u'Olfactory bulb (main) mitral cell',
                              u'neuron_db_id': 267,
                              u'nlex_id': u'nlx_anat_100201'},
                        'std': array(9.07329720786342) * ms}}

Retrieve Pooled Property Summary Stats


In [4]:
observations["Pooled"] = {}

# Fetch NeuroElectro property values for each test
for t in xrange(len(testTypes)):
    testType = testTypes[t]
    
    # Get the observations: property means and sds
    obs = testType.neuroelectro_pooled_observation(neuron,quiet=False)
    
    observations["Pooled"][testType.name] = obs
    
print("Pooled Summary Stats")
pp(observations["Pooled"])


Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nedm/?nlex=nlx_anat_100201&limit=999&e__name=Input+Resistance&
Raw Values
{'std': None, 'sem': 11.6, 'n': 43, 'mean': 32.9}
{'std': None, 'sem': 10.0, 'n': 19, 'mean': 128.0}
{'std': None, 'sem': 16.0, 'n': 22, 'mean': 115.0}
{'std': None, 'sem': 10.0, 'n': 10, 'mean': 124.0}
{'std': None, 'sem': 4.0, 'n': 3, 'mean': 107.0}
{'std': None, 'sem': 36.1, 'n': 5, 'mean': 208.7}
{'std': None, 'sem': 16.6, 'n': 8, 'mean': 118.0}
{'std': None, 'sem': 4.0, 'n': 30, 'mean': 68.0}
{'std': None, 'sem': 5.6, 'n': 29, 'mean': 59.0}
{'std': None, 'sem': 33.0, 'n': 45, 'mean': 236.0}
{'std': None, 'sem': 7.8, 'n': 13, 'mean': 103.0}
{'std': None, 'sem': 13.0, 'n': 57, 'mean': 214.0}
{'std': None, 'sem': 20.3, 'n': 7, 'mean': 47.4}
{'std': None, 'sem': 110.0, 'n': 20, 'mean': 240.0}
{'std': None, 'sem': 23.0, 'n': 35, 'mean': 299.0}
{'std': 7.0, 'sem': None, 'n': 5, 'mean': 19.0}
{'std': None, 'sem': 53.4, 'n': 48, 'mean': 128.2}
{'std': 40.5, 'sem': None, 'n': 35, 'mean': 94.3}
---------------------------------------------------
Filled in Values (computed or median where missing)
{'n': 43, 'sem': 11.6, 'sd': 76.0662868819032, 'source': u'/api/1/source/25442/', 'mean': 32.9}
{'n': 19, 'sem': 10.0, 'sd': 43.58898943540674, 'source': u'/api/1/source/25444/', 'mean': 128.0}
{'n': 22, 'sem': 16.0, 'sd': 75.04665215717488, 'source': u'/api/1/source/25445/', 'mean': 115.0}
{'n': 10, 'sem': 10.0, 'sd': 31.622776601683796, 'source': u'/api/1/source/25447/', 'mean': 124.0}
{'n': 3, 'sem': 4.0, 'sd': 6.928203230275509, 'source': u'/api/1/source/25449/', 'mean': 107.0}
{'n': 5, 'sem': 36.1, 'sd': 80.72205398774241, 'source': u'/api/1/source/25451/', 'mean': 208.7}
{'n': 8, 'sem': 16.6, 'sd': 46.95189027078676, 'source': u'/api/1/source/25453/', 'mean': 118.0}
{'n': 30, 'sem': 4.0, 'sd': 21.908902300206645, 'source': u'/api/1/source/25454/', 'mean': 68.0}
{'n': 29, 'sem': 5.6, 'sd': 30.156922919953217, 'source': u'/api/1/source/25455/', 'mean': 59.0}
{'n': 45, 'sem': 33.0, 'sd': 221.3707297724792, 'source': u'/api/1/source/25456/', 'mean': 236.0}
{'n': 13, 'sem': 7.8, 'sd': 28.123299948619113, 'source': u'/api/1/source/25457/', 'mean': 103.0}
{'n': 57, 'sem': 13.0, 'sd': 98.14784765851975, 'source': u'/api/1/source/25458/', 'mean': 214.0}
{'n': 7, 'sem': 20.3, 'sd': 53.708751614611195, 'source': u'/api/1/source/25459/', 'mean': 47.4}
{'n': 20, 'sem': 110.0, 'sd': 491.93495504995377, 'source': u'/api/1/source/25477/', 'mean': 240.0}
{'n': 35, 'sem': 23.0, 'sd': 136.06983501129116, 'source': u'/api/1/source/25478/', 'mean': 299.0}
{'n': 5, 'sem': 3.1304951684997055, 'sd': 7.0, 'source': u'/api/1/source/25497/', 'mean': 19.0}
{'n': 48, 'sem': 53.4, 'sd': 369.96605249671217, 'source': u'/api/1/source/47396/', 'mean': 128.2}
{'n': 35, 'sem': 6.845749463300984, 'sd': 40.5, 'source': u'/api/1/source/48042/', 'mean': 94.3}
Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nedm/?nlex=nlx_anat_100201&limit=999&e__name=Resting+membrane+potential&
Raw Values
{'std': 4.9, 'sem': None, 'n': 3, 'mean': -51.3}
{'std': None, 'sem': 8.6, 'n': 43, 'mean': -65.4}
{'std': None, 'sem': 1.7, 'n': 14, 'mean': -62.7}
{'std': None, 'sem': 1.2, 'n': 22, 'mean': -56.0}
{'std': None, 'sem': 1.2, 'n': 25, 'mean': -53.8}
{'std': None, 'sem': 0.7, 'n': 10, 'mean': -61.5}
{'std': None, 'sem': 2.6, 'n': 7, 'mean': -63.6}
{'std': None, 'sem': 4.9, 'n': 6, 'mean': -64.3}
{'std': None, 'sem': 4.9, 'n': None, 'mean': -51.3}
{'std': None, 'sem': 3.2, 'n': 29, 'mean': -57.0}
{'std': None, 'sem': 0.6, 'n': 45, 'mean': -63.5}
{'std': None, 'sem': 1.1, 'n': 57, 'mean': -49.0}
{'std': None, 'sem': 4.9, 'n': 5, 'mean': -55.0}
{'std': None, 'sem': 2.7, 'n': 20, 'mean': -61.65}
{'std': None, 'sem': 0.2, 'n': 9, 'mean': -53.4}
{'std': None, 'sem': 5.5, 'n': 48, 'mean': -58.2}
{'std': 4.0, 'sem': None, 'n': 35, 'mean': -53.9}
---------------------------------------------------
Filled in Values (computed or median where missing)
{'n': 3, 'sem': 2.829016319029167, 'sd': 4.9, 'source': u'/api/1/source/1483/', 'mean': -51.3}
{'n': 43, 'sem': 8.6, 'sd': 56.3939713089972, 'source': u'/api/1/source/25442/', 'mean': -65.4}
{'n': 14, 'sem': 1.7, 'sd': 6.3608175575157, 'source': u'/api/1/source/25444/', 'mean': -62.7}
{'n': 22, 'sem': 1.2, 'sd': 5.628498911788116, 'source': u'/api/1/source/25445/', 'mean': -56.0}
{'n': 25, 'sem': 1.2, 'sd': 6.0, 'source': u'/api/1/source/25446/', 'mean': -53.8}
{'n': 10, 'sem': 0.7, 'sd': 2.2135943621178655, 'source': u'/api/1/source/25447/', 'mean': -61.5}
{'n': 7, 'sem': 2.6, 'sd': 6.878953408767936, 'source': u'/api/1/source/25448/', 'mean': -63.6}
{'n': 6, 'sem': 4.9, 'sd': 12.002499739637573, 'source': u'/api/1/source/25450/', 'mean': -64.3}
{'n': 21, 'sem': 4.9, 'sd': 22.454620905283615, 'source': u'/api/1/source/25452/', 'mean': -51.3}
{'n': 29, 'sem': 3.2, 'sd': 17.232527382830412, 'source': u'/api/1/source/25455/', 'mean': -57.0}
{'n': 45, 'sem': 0.6, 'sd': 4.024922359499621, 'source': u'/api/1/source/25456/', 'mean': -63.5}
{'n': 57, 'sem': 1.1, 'sd': 8.304817878797826, 'source': u'/api/1/source/25458/', 'mean': -49.0}
{'n': 5, 'sem': 4.9, 'sd': 10.95673308974897, 'source': u'/api/1/source/25459/', 'mean': -55.0}
{'n': 20, 'sem': 2.7, 'sd': 12.074767078498866, 'source': u'/api/1/source/25477/', 'mean': -61.65}
{'n': 9, 'sem': 0.2, 'sd': 0.6000000000000001, 'source': u'/api/1/source/25479/', 'mean': -53.4}
{'n': 48, 'sem': 5.5, 'sd': 38.1051177665153, 'source': u'/api/1/source/47396/', 'mean': -58.2}
{'n': 35, 'sem': 0.6761234037828132, 'sd': 4.0, 'source': u'/api/1/source/48042/', 'mean': -53.9}
Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nedm/?nlex=nlx_anat_100201&limit=999&e__name=Spike+Half-Width&
Raw Values
{'std': None, 'sem': 0.1, 'n': 19, 'mean': 1.98}
{'std': None, 'sem': 0.06, 'n': 45, 'mean': 1.65}
{'std': None, 'sem': 0.2, 'n': 48, 'mean': 1.2}
---------------------------------------------------
Filled in Values (computed or median where missing)
{'n': 19, 'sem': 0.1, 'sd': 0.43588989435406744, 'source': u'/api/1/source/25444/', 'mean': 1.98}
{'n': 45, 'sem': 0.06, 'sd': 0.40249223594996214, 'source': u'/api/1/source/25456/', 'mean': 1.65}
{'n': 48, 'sem': 0.2, 'sd': 1.3856406460551018, 'source': u'/api/1/source/47396/', 'mean': 1.2}
Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nedm/?nlex=nlx_anat_100201&limit=999&e__name=Spike+Threshold&
Raw Values
{'std': None, 'sem': 0.6, 'n': 3, 'mean': -49.5}
{'std': None, 'sem': 2.3, 'n': 5, 'mean': -33.4}
{'std': None, 'sem': 8.7, 'n': 48, 'mean': -33.8}
---------------------------------------------------
Filled in Values (computed or median where missing)
{'n': 3, 'sem': 0.6, 'sd': 1.0392304845413263, 'source': u'/api/1/source/25447/', 'mean': -49.5}
{'n': 5, 'sem': 2.3, 'sd': 5.142956348249516, 'source': u'/api/1/source/25451/', 'mean': -33.4}
{'n': 48, 'sem': 8.7, 'sd': 60.27536810339692, 'source': u'/api/1/source/47396/', 'mean': -33.8}
Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nedm/?nlex=nlx_anat_100201&limit=999&e__name=Spike+Amplitude&
Raw Values
{'std': None, 'sem': 4.0, 'n': 7, 'mean': 67.0}
{'std': None, 'sem': 1.0, 'n': 45, 'mean': 75.0}
{'std': None, 'sem': 10.4, 'n': 48, 'mean': 63.2}
---------------------------------------------------
Filled in Values (computed or median where missing)
{'n': 7, 'sem': 4.0, 'sd': 10.583005244258363, 'source': u'/api/1/source/25443/', 'mean': 67.0}
{'n': 45, 'sem': 1.0, 'sd': 6.708203932499369, 'source': u'/api/1/source/25456/', 'mean': 75.0}
{'n': 48, 'sem': 10.4, 'sd': 72.05331359486529, 'source': u'/api/1/source/47396/', 'mean': 63.2}
Getting data values from neuroelectro.org
http://www.neuroelectro.org/api/1/nedm/?nlex=nlx_anat_100201&limit=999&e__name=Membrane+Time+Constant&
Raw Values
{'std': None, 'sem': 3.0, 'n': 19, 'mean': 19.0}
{'std': None, 'sem': 4.0, 'n': 7, 'mean': 22.0}
{'std': None, 'sem': 2.7, 'n': 35, 'mean': 42.5}
{'std': 4.5, 'sem': None, 'n': 5, 'mean': 14.0}
{'std': None, 'sem': 16.5, 'n': 48, 'mean': 28.1}
{'std': 9.4, 'sem': None, 'n': 35, 'mean': 21.3}
---------------------------------------------------
Filled in Values (computed or median where missing)
{'n': 19, 'sem': 3.0, 'sd': 13.076696830622023, 'source': u'/api/1/source/25444/', 'mean': 19.0}
{'n': 7, 'sem': 4.0, 'sd': 10.583005244258363, 'source': u'/api/1/source/25445/', 'mean': 22.0}
{'n': 35, 'sem': 2.7, 'sd': 15.973415414368965, 'source': u'/api/1/source/25478/', 'mean': 42.5}
{'n': 5, 'sem': 2.0124611797498106, 'sd': 4.5, 'source': u'/api/1/source/25497/', 'mean': 14.0}
{'n': 48, 'sem': 16.5, 'sd': 114.31535329954589, 'source': u'/api/1/source/47396/', 'mean': 28.1}
{'n': 35, 'sem': 1.5888899988896112, 'sd': 9.4, 'source': u'/api/1/source/48042/', 'mean': 21.3}
Pooled Summary Stats
{'Injected current AP amplitude test': {'data': [{'mean': 67.0,
                                                  'n': 7,
                                                  'sd': 10.583005244258363,
                                                  'sem': 4.0,
                                                  'source': u'/api/1/source/25443/'},
                                                 {'mean': 75.0,
                                                  'n': 45,
                                                  'sd': 6.708203932499369,
                                                  'sem': 1.0,
                                                  'source': u'/api/1/source/25456/'},
                                                 {'mean': 63.2,
                                                  'n': 48,
                                                  'sd': 72.05331359486529,
                                                  'sem': 10.4,
                                                  'source': u'/api/1/source/47396/'}],
                                        'mean': array(68.77600000000001) * mV,
                                        'n': 100,
                                        'std': array(50.427140458738684) * mV},
 'Injected current AP threshold test': {'data': [{'mean': -49.5,
                                                  'n': 3,
                                                  'sd': 1.0392304845413263,
                                                  'sem': 0.6,
                                                  'source': u'/api/1/source/25447/'},
                                                 {'mean': -33.4,
                                                  'n': 5,
                                                  'sd': 5.142956348249516,
                                                  'sem': 2.3,
                                                  'source': u'/api/1/source/25451/'},
                                                 {'mean': -33.8,
                                                  'n': 48,
                                                  'sd': 60.27536810339692,
                                                  'sem': 8.7,
                                                  'source': u'/api/1/source/47396/'}],
                                        'mean': array(-34.60535714285714) * mV,
                                        'n': 56,
                                        'std': array(56.77904875355424) * mV},
 'Injected current AP width test': {'data': [{'mean': 1.98,
                                              'n': 19,
                                              'sd': 0.43588989435406744,
                                              'sem': 0.1,
                                              'source': u'/api/1/source/25444/'},
                                             {'mean': 1.65,
                                              'n': 45,
                                              'sd': 0.40249223594996214,
                                              'sem': 0.06,
                                              'source': u'/api/1/source/25456/'},
                                             {'mean': 1.2,
                                              'n': 48,
                                              'sd': 1.3856406460551018,
                                              'sem': 0.2,
                                              'source': u'/api/1/source/47396/'}],
                                    'mean': array(1.513125) * ms,
                                    'n': 112,
                                    'std': array(0.9615927154771481) * ms},
 'Input resistance test': {'data': [{'mean': 32.9,
                                     'n': 43,
                                     'sd': 76.0662868819032,
                                     'sem': 11.6,
                                     'source': u'/api/1/source/25442/'},
                                    {'mean': 128.0,
                                     'n': 19,
                                     'sd': 43.58898943540674,
                                     'sem': 10.0,
                                     'source': u'/api/1/source/25444/'},
                                    {'mean': 115.0,
                                     'n': 22,
                                     'sd': 75.04665215717488,
                                     'sem': 16.0,
                                     'source': u'/api/1/source/25445/'},
                                    {'mean': 124.0,
                                     'n': 10,
                                     'sd': 31.622776601683796,
                                     'sem': 10.0,
                                     'source': u'/api/1/source/25447/'},
                                    {'mean': 107.0,
                                     'n': 3,
                                     'sd': 6.928203230275509,
                                     'sem': 4.0,
                                     'source': u'/api/1/source/25449/'},
                                    {'mean': 208.7,
                                     'n': 5,
                                     'sd': 80.72205398774241,
                                     'sem': 36.1,
                                     'source': u'/api/1/source/25451/'},
                                    {'mean': 118.0,
                                     'n': 8,
                                     'sd': 46.95189027078676,
                                     'sem': 16.6,
                                     'source': u'/api/1/source/25453/'},
                                    {'mean': 68.0,
                                     'n': 30,
                                     'sd': 21.908902300206645,
                                     'sem': 4.0,
                                     'source': u'/api/1/source/25454/'},
                                    {'mean': 59.0,
                                     'n': 29,
                                     'sd': 30.156922919953217,
                                     'sem': 5.6,
                                     'source': u'/api/1/source/25455/'},
                                    {'mean': 236.0,
                                     'n': 45,
                                     'sd': 221.3707297724792,
                                     'sem': 33.0,
                                     'source': u'/api/1/source/25456/'},
                                    {'mean': 103.0,
                                     'n': 13,
                                     'sd': 28.123299948619113,
                                     'sem': 7.8,
                                     'source': u'/api/1/source/25457/'},
                                    {'mean': 214.0,
                                     'n': 57,
                                     'sd': 98.14784765851975,
                                     'sem': 13.0,
                                     'source': u'/api/1/source/25458/'},
                                    {'mean': 47.4,
                                     'n': 7,
                                     'sd': 53.708751614611195,
                                     'sem': 20.3,
                                     'source': u'/api/1/source/25459/'},
                                    {'mean': 240.0,
                                     'n': 20,
                                     'sd': 491.93495504995377,
                                     'sem': 110.0,
                                     'source': u'/api/1/source/25477/'},
                                    {'mean': 299.0,
                                     'n': 35,
                                     'sd': 136.06983501129116,
                                     'sem': 23.0,
                                     'source': u'/api/1/source/25478/'},
                                    {'mean': 19.0,
                                     'n': 5,
                                     'sd': 7.0,
                                     'sem': 3.1304951684997055,
                                     'source': u'/api/1/source/25497/'},
                                    {'mean': 128.2,
                                     'n': 48,
                                     'sd': 369.96605249671217,
                                     'sem': 53.4,
                                     'source': u'/api/1/source/47396/'},
                                    {'mean': 94.3,
                                     'n': 35,
                                     'sd': 40.5,
                                     'sem': 6.845749463300984,
                                     'source': u'/api/1/source/48042/'}],
                           'mean': array(145113133.640553) * ohm,
                           'n': 434,
                           'std': array(189410293.86777508) * ohm},
 'Resting potential test': {'data': [{'mean': -51.3,
                                      'n': 3,
                                      'sd': 4.9,
                                      'sem': 2.829016319029167,
                                      'source': u'/api/1/source/1483/'},
                                     {'mean': -65.4,
                                      'n': 43,
                                      'sd': 56.3939713089972,
                                      'sem': 8.6,
                                      'source': u'/api/1/source/25442/'},
                                     {'mean': -62.7,
                                      'n': 14,
                                      'sd': 6.3608175575157,
                                      'sem': 1.7,
                                      'source': u'/api/1/source/25444/'},
                                     {'mean': -56.0,
                                      'n': 22,
                                      'sd': 5.628498911788116,
                                      'sem': 1.2,
                                      'source': u'/api/1/source/25445/'},
                                     {'mean': -53.8,
                                      'n': 25,
                                      'sd': 6.0,
                                      'sem': 1.2,
                                      'source': u'/api/1/source/25446/'},
                                     {'mean': -61.5,
                                      'n': 10,
                                      'sd': 2.2135943621178655,
                                      'sem': 0.7,
                                      'source': u'/api/1/source/25447/'},
                                     {'mean': -63.6,
                                      'n': 7,
                                      'sd': 6.878953408767936,
                                      'sem': 2.6,
                                      'source': u'/api/1/source/25448/'},
                                     {'mean': -64.3,
                                      'n': 6,
                                      'sd': 12.002499739637573,
                                      'sem': 4.9,
                                      'source': u'/api/1/source/25450/'},
                                     {'mean': -51.3,
                                      'n': 21,
                                      'sd': 22.454620905283615,
                                      'sem': 4.9,
                                      'source': u'/api/1/source/25452/'},
                                     {'mean': -57.0,
                                      'n': 29,
                                      'sd': 17.232527382830412,
                                      'sem': 3.2,
                                      'source': u'/api/1/source/25455/'},
                                     {'mean': -63.5,
                                      'n': 45,
                                      'sd': 4.024922359499621,
                                      'sem': 0.6,
                                      'source': u'/api/1/source/25456/'},
                                     {'mean': -49.0,
                                      'n': 57,
                                      'sd': 8.304817878797826,
                                      'sem': 1.1,
                                      'source': u'/api/1/source/25458/'},
                                     {'mean': -55.0,
                                      'n': 5,
                                      'sd': 10.95673308974897,
                                      'sem': 4.9,
                                      'source': u'/api/1/source/25459/'},
                                     {'mean': -61.65,
                                      'n': 20,
                                      'sd': 12.074767078498866,
                                      'sem': 2.7,
                                      'source': u'/api/1/source/25477/'},
                                     {'mean': -53.4,
                                      'n': 9,
                                      'sd': 0.6000000000000001,
                                      'sem': 0.2,
                                      'source': u'/api/1/source/25479/'},
                                     {'mean': -58.2,
                                      'n': 48,
                                      'sd': 38.1051177665153,
                                      'sem': 5.5,
                                      'source': u'/api/1/source/47396/'},
                                     {'mean': -53.9,
                                      'n': 35,
                                      'sd': 4.0,
                                      'sem': 0.6761234037828132,
                                      'source': u'/api/1/source/48042/'}],
                            'mean': array(-57.43458646616542) * mV,
                            'n': 399,
                            'std': array(24.630188347036064) * mV},
 'Time constant test': {'data': [{'mean': 19.0,
                                  'n': 19,
                                  'sd': 13.076696830622023,
                                  'sem': 3.0,
                                  'source': u'/api/1/source/25444/'},
                                 {'mean': 22.0,
                                  'n': 7,
                                  'sd': 10.583005244258363,
                                  'sem': 4.0,
                                  'source': u'/api/1/source/25445/'},
                                 {'mean': 42.5,
                                  'n': 35,
                                  'sd': 15.973415414368965,
                                  'sem': 2.7,
                                  'source': u'/api/1/source/25478/'},
                                 {'mean': 14.0,
                                  'n': 5,
                                  'sd': 4.5,
                                  'sem': 2.0124611797498106,
                                  'source': u'/api/1/source/25497/'},
                                 {'mean': 28.1,
                                  'n': 48,
                                  'sd': 114.31535329954589,
                                  'sem': 16.5,
                                  'source': u'/api/1/source/47396/'},
                                 {'mean': 21.3,
                                  'n': 35,
                                  'sd': 9.4,
                                  'sem': 1.5888899988896112,
                                  'source': u'/api/1/source/48042/'}],
                        'mean': array(27.96510067114094) * ms,
                        'n': 149,
                        'std': array(66.35918051905733) * ms}}

Store User Defined Property Stats


In [5]:
result = {}

# These should be the values after NeuroElectro returns N's and type of Err

result[InputResistanceTest.name] =            { 'mean': 87.398 * 1000000 * ohm, 'std': 41.42 * 1000000 * ohm, 'n': 386 }
result[RestingPotentialTest.name] =           { 'mean': -54.91 * mV, 'std': 3.5969 * mV, 'n': 295 }
result[InjectedCurrentAPWidthTest.name] =     { 'mean': 1.737 * ms, 'std': 0.145588 * ms, 'n': 64 }
result[InjectedCurrentAPThresholdTest.name] = { 'mean': -48.47 * mV, 'std': 3.932 * mV, 'n': 8 }
result[InjectedCurrentAPAmplitudeTest.name] = { 'mean': 74.529 * mV, 'std': 1.88 * mV, 'n': 52 }
result[TimeConstantTest.name] =               { 'mean': 27.78595 * ms, 'std': 11.75 * ms, 'n': 66 }

observations["UserDefined"] = result
    
print("UserDefined Summary Stats")
pp(observations["UserDefined"])


UserDefined Summary Stats
{'Injected current AP amplitude test': {'mean': array(74.529) * mV,
                                        'n': 52,
                                        'std': array(1.88) * mV},
 'Injected current AP threshold test': {'mean': array(-48.47) * mV,
                                        'n': 8,
                                        'std': array(3.932) * mV},
 'Injected current AP width test': {'mean': array(1.737) * ms,
                                    'n': 64,
                                    'std': array(0.145588) * ms},
 'Input resistance test': {'mean': array(87398000.0) * ohm,
                           'n': 386,
                           'std': array(41420000.0) * ohm},
 'Resting potential test': {'mean': array(-54.91) * mV,
                            'n': 295,
                            'std': array(3.5969) * mV},
 'Time constant test': {'mean': array(27.78595) * ms,
                        'n': 66,
                        'std': array(11.75) * ms}}

Show All Observations


In [6]:
pp(observations)


{'Pooled': {'Injected current AP amplitude test': {'data': [{'mean': 67.0,
                                                             'n': 7,
                                                             'sd': 10.583005244258363,
                                                             'sem': 4.0,
                                                             'source': u'/api/1/source/25443/'},
                                                            {'mean': 75.0,
                                                             'n': 45,
                                                             'sd': 6.708203932499369,
                                                             'sem': 1.0,
                                                             'source': u'/api/1/source/25456/'},
                                                            {'mean': 63.2,
                                                             'n': 48,
                                                             'sd': 72.05331359486529,
                                                             'sem': 10.4,
                                                             'source': u'/api/1/source/47396/'}],
                                                   'mean': array(68.77600000000001) * mV,
                                                   'n': 100,
                                                   'std': array(50.427140458738684) * mV},
            'Injected current AP threshold test': {'data': [{'mean': -49.5,
                                                             'n': 3,
                                                             'sd': 1.0392304845413263,
                                                             'sem': 0.6,
                                                             'source': u'/api/1/source/25447/'},
                                                            {'mean': -33.4,
                                                             'n': 5,
                                                             'sd': 5.142956348249516,
                                                             'sem': 2.3,
                                                             'source': u'/api/1/source/25451/'},
                                                            {'mean': -33.8,
                                                             'n': 48,
                                                             'sd': 60.27536810339692,
                                                             'sem': 8.7,
                                                             'source': u'/api/1/source/47396/'}],
                                                   'mean': array(-34.60535714285714) * mV,
                                                   'n': 56,
                                                   'std': array(56.77904875355424) * mV},
            'Injected current AP width test': {'data': [{'mean': 1.98,
                                                         'n': 19,
                                                         'sd': 0.43588989435406744,
                                                         'sem': 0.1,
                                                         'source': u'/api/1/source/25444/'},
                                                        {'mean': 1.65,
                                                         'n': 45,
                                                         'sd': 0.40249223594996214,
                                                         'sem': 0.06,
                                                         'source': u'/api/1/source/25456/'},
                                                        {'mean': 1.2,
                                                         'n': 48,
                                                         'sd': 1.3856406460551018,
                                                         'sem': 0.2,
                                                         'source': u'/api/1/source/47396/'}],
                                               'mean': array(1.513125) * ms,
                                               'n': 112,
                                               'std': array(0.9615927154771481) * ms},
            'Input resistance test': {'data': [{'mean': 32.9,
                                                'n': 43,
                                                'sd': 76.0662868819032,
                                                'sem': 11.6,
                                                'source': u'/api/1/source/25442/'},
                                               {'mean': 128.0,
                                                'n': 19,
                                                'sd': 43.58898943540674,
                                                'sem': 10.0,
                                                'source': u'/api/1/source/25444/'},
                                               {'mean': 115.0,
                                                'n': 22,
                                                'sd': 75.04665215717488,
                                                'sem': 16.0,
                                                'source': u'/api/1/source/25445/'},
                                               {'mean': 124.0,
                                                'n': 10,
                                                'sd': 31.622776601683796,
                                                'sem': 10.0,
                                                'source': u'/api/1/source/25447/'},
                                               {'mean': 107.0,
                                                'n': 3,
                                                'sd': 6.928203230275509,
                                                'sem': 4.0,
                                                'source': u'/api/1/source/25449/'},
                                               {'mean': 208.7,
                                                'n': 5,
                                                'sd': 80.72205398774241,
                                                'sem': 36.1,
                                                'source': u'/api/1/source/25451/'},
                                               {'mean': 118.0,
                                                'n': 8,
                                                'sd': 46.95189027078676,
                                                'sem': 16.6,
                                                'source': u'/api/1/source/25453/'},
                                               {'mean': 68.0,
                                                'n': 30,
                                                'sd': 21.908902300206645,
                                                'sem': 4.0,
                                                'source': u'/api/1/source/25454/'},
                                               {'mean': 59.0,
                                                'n': 29,
                                                'sd': 30.156922919953217,
                                                'sem': 5.6,
                                                'source': u'/api/1/source/25455/'},
                                               {'mean': 236.0,
                                                'n': 45,
                                                'sd': 221.3707297724792,
                                                'sem': 33.0,
                                                'source': u'/api/1/source/25456/'},
                                               {'mean': 103.0,
                                                'n': 13,
                                                'sd': 28.123299948619113,
                                                'sem': 7.8,
                                                'source': u'/api/1/source/25457/'},
                                               {'mean': 214.0,
                                                'n': 57,
                                                'sd': 98.14784765851975,
                                                'sem': 13.0,
                                                'source': u'/api/1/source/25458/'},
                                               {'mean': 47.4,
                                                'n': 7,
                                                'sd': 53.708751614611195,
                                                'sem': 20.3,
                                                'source': u'/api/1/source/25459/'},
                                               {'mean': 240.0,
                                                'n': 20,
                                                'sd': 491.93495504995377,
                                                'sem': 110.0,
                                                'source': u'/api/1/source/25477/'},
                                               {'mean': 299.0,
                                                'n': 35,
                                                'sd': 136.06983501129116,
                                                'sem': 23.0,
                                                'source': u'/api/1/source/25478/'},
                                               {'mean': 19.0,
                                                'n': 5,
                                                'sd': 7.0,
                                                'sem': 3.1304951684997055,
                                                'source': u'/api/1/source/25497/'},
                                               {'mean': 128.2,
                                                'n': 48,
                                                'sd': 369.96605249671217,
                                                'sem': 53.4,
                                                'source': u'/api/1/source/47396/'},
                                               {'mean': 94.3,
                                                'n': 35,
                                                'sd': 40.5,
                                                'sem': 6.845749463300984,
                                                'source': u'/api/1/source/48042/'}],
                                      'mean': array(145113133.640553) * ohm,
                                      'n': 434,
                                      'std': array(189410293.86777508) * ohm},
            'Resting potential test': {'data': [{'mean': -51.3,
                                                 'n': 3,
                                                 'sd': 4.9,
                                                 'sem': 2.829016319029167,
                                                 'source': u'/api/1/source/1483/'},
                                                {'mean': -65.4,
                                                 'n': 43,
                                                 'sd': 56.3939713089972,
                                                 'sem': 8.6,
                                                 'source': u'/api/1/source/25442/'},
                                                {'mean': -62.7,
                                                 'n': 14,
                                                 'sd': 6.3608175575157,
                                                 'sem': 1.7,
                                                 'source': u'/api/1/source/25444/'},
                                                {'mean': -56.0,
                                                 'n': 22,
                                                 'sd': 5.628498911788116,
                                                 'sem': 1.2,
                                                 'source': u'/api/1/source/25445/'},
                                                {'mean': -53.8,
                                                 'n': 25,
                                                 'sd': 6.0,
                                                 'sem': 1.2,
                                                 'source': u'/api/1/source/25446/'},
                                                {'mean': -61.5,
                                                 'n': 10,
                                                 'sd': 2.2135943621178655,
                                                 'sem': 0.7,
                                                 'source': u'/api/1/source/25447/'},
                                                {'mean': -63.6,
                                                 'n': 7,
                                                 'sd': 6.878953408767936,
                                                 'sem': 2.6,
                                                 'source': u'/api/1/source/25448/'},
                                                {'mean': -64.3,
                                                 'n': 6,
                                                 'sd': 12.002499739637573,
                                                 'sem': 4.9,
                                                 'source': u'/api/1/source/25450/'},
                                                {'mean': -51.3,
                                                 'n': 21,
                                                 'sd': 22.454620905283615,
                                                 'sem': 4.9,
                                                 'source': u'/api/1/source/25452/'},
                                                {'mean': -57.0,
                                                 'n': 29,
                                                 'sd': 17.232527382830412,
                                                 'sem': 3.2,
                                                 'source': u'/api/1/source/25455/'},
                                                {'mean': -63.5,
                                                 'n': 45,
                                                 'sd': 4.024922359499621,
                                                 'sem': 0.6,
                                                 'source': u'/api/1/source/25456/'},
                                                {'mean': -49.0,
                                                 'n': 57,
                                                 'sd': 8.304817878797826,
                                                 'sem': 1.1,
                                                 'source': u'/api/1/source/25458/'},
                                                {'mean': -55.0,
                                                 'n': 5,
                                                 'sd': 10.95673308974897,
                                                 'sem': 4.9,
                                                 'source': u'/api/1/source/25459/'},
                                                {'mean': -61.65,
                                                 'n': 20,
                                                 'sd': 12.074767078498866,
                                                 'sem': 2.7,
                                                 'source': u'/api/1/source/25477/'},
                                                {'mean': -53.4,
                                                 'n': 9,
                                                 'sd': 0.6000000000000001,
                                                 'sem': 0.2,
                                                 'source': u'/api/1/source/25479/'},
                                                {'mean': -58.2,
                                                 'n': 48,
                                                 'sd': 38.1051177665153,
                                                 'sem': 5.5,
                                                 'source': u'/api/1/source/47396/'},
                                                {'mean': -53.9,
                                                 'n': 35,
                                                 'sd': 4.0,
                                                 'sem': 0.6761234037828132,
                                                 'source': u'/api/1/source/48042/'}],
                                       'mean': array(-57.43458646616542) * mV,
                                       'n': 399,
                                       'std': array(24.630188347036064) * mV},
            'Time constant test': {'data': [{'mean': 19.0,
                                             'n': 19,
                                             'sd': 13.076696830622023,
                                             'sem': 3.0,
                                             'source': u'/api/1/source/25444/'},
                                            {'mean': 22.0,
                                             'n': 7,
                                             'sd': 10.583005244258363,
                                             'sem': 4.0,
                                             'source': u'/api/1/source/25445/'},
                                            {'mean': 42.5,
                                             'n': 35,
                                             'sd': 15.973415414368965,
                                             'sem': 2.7,
                                             'source': u'/api/1/source/25478/'},
                                            {'mean': 14.0,
                                             'n': 5,
                                             'sd': 4.5,
                                             'sem': 2.0124611797498106,
                                             'source': u'/api/1/source/25497/'},
                                            {'mean': 28.1,
                                             'n': 48,
                                             'sd': 114.31535329954589,
                                             'sem': 16.5,
                                             'source': u'/api/1/source/47396/'},
                                            {'mean': 21.3,
                                             'n': 35,
                                             'sd': 9.4,
                                             'sem': 1.5888899988896112,
                                             'source': u'/api/1/source/48042/'}],
                                   'mean': array(27.96510067114094) * ms,
                                   'n': 149,
                                   'std': array(66.35918051905733) * ms}},
 'UnPooled': {'Injected current AP amplitude test': {'mean': array(68.4) * mV,
                                                     'n': {u'id': 129,
                                                           u'name': u'Olfactory bulb (main) mitral cell',
                                                           u'neuron_db_id': 267,
                                                           u'nlex_id': u'nlx_anat_100201'},
                                                     'std': array(4.9179941710688) * mV},
              'Injected current AP threshold test': {'mean': array(-38.9) * mV,
                                                     'n': {u'id': 129,
                                                           u'name': u'Olfactory bulb (main) mitral cell',
                                                           u'neuron_db_id': 267,
                                                           u'nlex_id': u'nlx_anat_100201'},
                                                     'std': array(7.4971105545181) * mV},
              'Injected current AP width test': {'mean': array(1.61) * ms,
                                                 'n': {u'id': 129,
                                                       u'name': u'Olfactory bulb (main) mitral cell',
                                                       u'neuron_db_id': 267,
                                                       u'nlex_id': u'nlx_anat_100201'},
                                                 'std': array(0.319687347262916) * ms},
              'Input resistance test': {'mean': array(130083333.333333) * ohm,
                                        'n': {u'id': 129,
                                              u'name': u'Olfactory bulb (main) mitral cell',
                                              u'neuron_db_id': 267,
                                              u'nlex_id': u'nlx_anat_100201'},
                                        'std': array(76575476.5647012) * ohm},
              'Resting potential test': {'mean': array(-58.140625) * mV,
                                         'n': {u'id': 129,
                                               u'name': u'Olfactory bulb (main) mitral cell',
                                               u'neuron_db_id': 267,
                                               u'nlex_id': u'nlx_anat_100201'},
                                         'std': array(4.9934087414686) * mV},
              'Time constant test': {'mean': array(24.4833333333333) * ms,
                                     'n': {u'id': 129,
                                           u'name': u'Olfactory bulb (main) mitral cell',
                                           u'neuron_db_id': 267,
                                           u'nlex_id': u'nlx_anat_100201'},
                                     'std': array(9.07329720786342) * ms}},
 'UserDefined': {'Injected current AP amplitude test': {'mean': array(74.529) * mV,
                                                        'n': 52,
                                                        'std': array(1.88) * mV},
                 'Injected current AP threshold test': {'mean': array(-48.47) * mV,
                                                        'n': 8,
                                                        'std': array(3.932) * mV},
                 'Injected current AP width test': {'mean': array(1.737) * ms,
                                                    'n': 64,
                                                    'std': array(0.145588) * ms},
                 'Input resistance test': {'mean': array(87398000.0) * ohm,
                                           'n': 386,
                                           'std': array(41420000.0) * ohm},
                 'Resting potential test': {'mean': array(-54.91) * mV,
                                            'n': 295,
                                            'std': array(3.5969) * mV},
                 'Time constant test': {'mean': array(27.78595) * ms,
                                        'n': 66,
                                        'std': array(11.75) * ms}}}

Store The Observations in a File


In [7]:
import pickle

with open("observations.dat", "wb") as file:
    pickle.dump(observations,file)