neuronunit package

Submodules

neuronunit.aibs module

NeuronUnit module for interaction with the AIBS Cell Types Database.

neuronunit.aibs.get_observation(dataset_id, kind, cached=True, quiet=False)[source]

Get an observation.

Get an observation of kind ‘kind’ from the dataset with id ‘dataset_id’. optionally using the cached value retrieved previously.

neuronunit.aibs.get_sp(experiment_params, sweep_ids)[source]

Get sweep parameters.

A candidate method for replacing ‘get_sweep_params’. This fix is necessary due to changes in the allensdk. Warning: This method may not properly convey the original meaning of ‘get_sweep_params’.

neuronunit.aibs.get_sweep_params(dataset_id, sweep_id)[source]

Get sweep parameters.

Get those corresponding to the sweep with id ‘sweep_id’ from the dataset with id ‘dataset_id’.

neuronunit.aibs.get_value_dict(experiment_params, sweep_ids, kind)[source]

Get a dictionary of data values from the experiment.

A candidate method for replacing ‘get_observation’. This fix is necessary due to changes in the allensdk. Warning: Together with ‘get_sp’ this method may not properly convey the meaning of ‘get_observation’.

neuronunit.aibs.is_aibs_up()[source]

Check whether the AIBS Cell Types Database API is working.

neuronunit.neuroelectro module

NeuronUnit interface to Neuroelectro.org.

Interface for creating tests using neuroelectro.org as reference data.

Example workflow:

x = NeuroElectroDataMap() x.set_neuron(nlex_id=’nifext_152’) # neurolex.org ID for ‘Amygdala basolateral nucleus pyramidal neuron’. x.set_ephysprop(id=23) # neuroelectro.org ID for ‘Spike width’. x.set_article(pmid=18667618) # Pubmed ID for Fajardo et al, 2008 (J. Neurosci.) x.get_values() # Gets values for spike width from this paper. width = x.val # Spike width reported in that paper.

t = neurounit.tests.SpikeWidthTest(spike_width=width) c = sciunit.Candidate() # Instantiation of your model (or other candidate) c.execute = code_that_runs_your_model result = sciunit.run(t,m) print result.score # # OR # x = NeuroElectroSummary() x.set_neuron(nlex_id=’nifext_152’) # neurolex.org ID for ‘Amygdala basolateral

# nucleus pyramidal neuron’.

x.set_ephysprop(id=2) # neuroelectro.org ID for ‘Spike width’. x.get_values() # Gets values for spike width from this paper. width = x.mean # Mean Spike width reported across all matching papers. …

class neuronunit.neuroelectro.Article[source]

Bases: object

Describes a journal article in NeuroElectro.

id = None
pmid = None
class neuronunit.neuroelectro.EphysProp[source]

Bases: object

Describes an electrophysiolical property in NeuroElectro.

id = None
name = None
nlex_id = None
class neuronunit.neuroelectro.NeuroElectroData(neuron=None, ephysprop=None, get_values=False, cached=True)[source]

Bases: object

Abstract class based on neuroelectro.org data using that site’s API.

check()[source]

See if data requested from the server were obtained successfully.

get_json(params=None, quiet=False)[source]

Get JSON data from neuroelectro.org.

Data is based on the currently set neuron and ephys property. Use ‘params’ to constrain the data returned.

get_values(params=None, quiet=False)[source]

Get values from neuroelectro.org.

We will use ‘params’ in the future to specify metadata (e.g. temperature) that neuroelectro.org will provide.

make_url(params=None)[source]

Create the full URL to the neuroelectro API.

set_ephysprop(**kwargs)[source]

Set the electrophysiological property lookup attributes.

set_names(neuron_name, ephysprop_name)[source]

Set the names of the neurons (i.e. their types).

set_neuron(**kwargs)[source]

Set the biological neuron lookup attributes.

url = 'http://neuroelectro.org/api/1/'
class neuronunit.neuroelectro.NeuroElectroDataMap(neuron=None, ephysprop=None, get_values=False, cached=True)[source]

Bases: neuronunit.neuroelectro.NeuroElectroData

Class for getting single reported values from neuroelectro.org.

article = <neuronunit.neuroelectro.Article object>
get_values(params=None, quiet=False)[source]

Get values from neuroelectro.org.

We will use ‘params’ in the future to specify metadata (e.g. temperature) that neuroelectro.org will provide.

make_url(params=None)[source]

Create the full URL to the neuroelectro API.

require_attrs = ['val', 'sem']
set_article(id_=None, pmid=None)[source]

Set the biological neuron using a NeuroLex ID.

url = 'http://neuroelectro.org/api/1/nedm/'
exception neuronunit.neuroelectro.NeuroElectroError[source]

Bases: Exception

Base class for NeuroElectro errors.

class neuronunit.neuroelectro.NeuroElectroPooledSummary(neuron=None, ephysprop=None, get_values=False, cached=True)[source]

Bases: neuronunit.neuroelectro.NeuroElectroDataMap

Class for getting summary values from neuroelectro.org.

Values are computed by pooling each report’s mean and SD across reports.

fill_missing_ns(ns)[source]

Fill in the missing N’s with median N.

fill_missing_sems_sds(sems, sds, ns)[source]

Fill in computable sems/sds.

get_observation(params=None, show=False)[source]

Get the observation from neuroelectro.org.

get_pooled_stats(data, quiet=True)[source]

Get pooled statistics from the data.

get_values(params=None, quiet=False)[source]

Get all papers reporting the neuron’s property value.

class neuronunit.neuroelectro.NeuroElectroSummary(neuron=None, ephysprop=None, get_values=False, cached=True)[source]

Bases: neuronunit.neuroelectro.NeuroElectroData

Class for getting summary values (across reports) from neuroelectro.org.

get_observation(params=None, show=False)[source]

Get the observation from neuroelectro.org.

get_values(params=None, quiet=False)[source]

Get values from neuroelectro.org.

We will use ‘params’ in the future to specify metadata (e.g. temperature) that neuroelectro.org will provide.

require_attrs = ['mean', 'std']
url = 'http://neuroelectro.org/api/1/nes/'
class neuronunit.neuroelectro.Neuron[source]

Bases: object

Describes a neuron type in NeuroElectro.

id = None
name = None
nlex_id = None
neuronunit.neuroelectro.is_neuroelectro_up()[source]

Check if neuroelectro.org is up.

neuronunit.plottools module

Tools for plotting (contributed by Blue Brain Project)

neuronunit.plottools.adjust_spines(ax, spines, color='k', d_out=10, d_down=None)[source]
neuronunit.plottools.bar_chart(vms, name=None)[source]
neuronunit.plottools.best_worst(history)[source]

Query the GA’s DEAP history object to get the best and worst candidates ever evaluated.

inputs DEAP history object best output should be the same as the first index of the ParetoFront list (pf[0]). outputs best and worst candidates evaluated.

neuronunit.plottools.dtc_to_plotting(dtc)[source]
neuronunit.plottools.light_palette(color, n_colors=6, reverse=False, lumlight=0.8, light=None)[source]
neuronunit.plottools.not_just_mean(log, hypervolumes)[source]

https://github.com/BlueBrain/BluePyOpt/blob/master/examples/graupnerbrunelstdp/run_fit.py Input: DEAP Plot logbook

Outputs: This method only has side effects, not datatype outputs from the method.

The most important side effect being a plot in png format.

neuronunit.plottools.pca(best_worst, vmpop, fitnesses, td)[source]

Principle Component Analysis. Use PCA to find out which of the model parameters are the most resonsible for causing variations in error/fitness

neuronunit.plottools.plot_log(log)[source]

https://github.com/BlueBrain/BluePyOpt/blob/master/examples/graupnerbrunelstdp/run_fit.py Input: DEAP Plot logbook Outputs: This method only has side effects, not datatype outputs from the method.

The most important side effect being a plot in png format.

neuronunit.plottools.plot_objectives_history(log)[source]

https://github.com/BlueBrain/BluePyOpt/blob/master/examples/graupnerbrunelstdp/run_fit.py Input: DEAP Plot logbook Outputs: This method only has side effects, not datatype outputs from the method.

The most important side effect being a plot in png format.

neuronunit.plottools.plot_surface(model_param0, model_param1, td, history)[source]

Move this method back to plottools Inputs should be keys, that are parameters see new function definition below

neuronunit.plottools.plot_suspicious(dtc)[source]
neuronunit.plottools.shadow(dtcpop, best_vm)[source]

A method to plot the best and worst candidate solution waveforms side by side

Inputs: An individual gene from the population that has compound parameters, and a tuple iterator that is a virtual model object containing an appropriate parameter set, zipped togethor with an appropriate rheobase value, that was found in a previous rheobase search.

Outputs: This method only has side effects, not datatype outputs from the method.

The most important side effect being a plot in png format.

neuronunit.plottools.surfaces(history, td)[source]
neuronunit.plottools.tiled_figure(figname='', frames=1, columns=2, figs={}, axs=None, orientation='page', width_ratios=None, height_ratios=None, top=0.97, bottom=0.05, left=0.07, right=0.97, hspace=0.6, wspace=0.2, dirname='')[source]
neuronunit.plottools.try_hard_coded0()[source]
neuronunit.plottools.try_hard_coded1()[source]
neuronunit.plottools.use_dtc_to_plotting(dtcpop)[source]

Module contents

NeuronUnit.

Testing for neuron and ion channel models using the SciUnit framework.