neuronunit package

Subpackages

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.bbp module

NeuronUnit module for interaction with the Blue Brain Project data.

neuronunit.bbp.find_or_download_data(url)[source]

Find or download data from the given URL.

Return a path to a local directory containing the unzipped data found at the provided url. The zipped file will be downloaded and unzipped if the directory cannot be found. The path to the directory is returned.

neuronunit.bbp.find_sweeps(path, extension='.ibw', depth=0)[source]

Find sweeps available at the given path.

Starting from ‘path’, recursively searches subdirectories and returns full paths to all files ending with ‘extension’.

neuronunit.bbp.get_curated_data(data_id, sweeps=None)[source]

Download curated data (Igor files) from the microcircuit portal.

data_id: An ID number like the ones in ‘list_curated_data()’ that appears in http://microcircuits.epfl.ch/#/article/article_4_eph.

neuronunit.bbp.get_sweeps(url, sweeps=None)[source]

Get sweeps of data from the given URL.

neuronunit.bbp.get_uncurated_data(data_id, sweeps=None)[source]

Download uncurated data (Igor files) from the microcircuit portal.

neuronunit.bbp.is_bbp_up()[source]

Check whether the BBP microcircuit portal is up.

neuronunit.bbp.list_curated_data()[source]

List all curated datasets as of July 1st, 2017.

Includes those found at http://microcircuits.epfl.ch/#/article/article_4_eph

neuronunit.bbp.list_sweeps(url, extension='.ibw')[source]

List all sweeps available in the file at the given URL.

neuronunit.bbp.open_data(path)[source]

Take a ‘path’ to an .ibw file and returns a neo.core.AnalogSignal.

neuronunit.bbp.plot_data(signal)[source]

Plot the data in a neo.core.AnalogSignal.

neuronunit.cellmodelp module

class neuronunit.cellmodelp.CellModel(*args, **kwargs)[source]

Bases: object

build_model(restore_tolerances=True)[source]
compute_waveform_error(lowest_error_v, lowest_error_range, v)[source]
find_border(lowerLevel, upperLevel, current_delay, current_duration, run_for_after_delay, test_condition, max_iterations, fig_file, skip_current_delay=False, on_unstable=None, test_early=False)[source]
getBiasCurrent(targetV)[source]
getRestingV(run_time, save_resting_state=False)[source]
getRheobase(minCurrent, maxI)[source]
getThreshold(minCurrent, maxI)[source]
get_abstract_cell(h)[source]
get_arb_current_response(delay, duration, get_current_ti, post_delay=0, test_condition=None, restore_state=False, dt=None, sampling_period=None)[source]
get_cell_with_morphology(h)[source]
get_id_from_nml_file(nml)[source]
get_number_of_compartments(h)[source]
get_ramp_response(ramp_delay, ramp_max_duration, ramp_increase_rate_per_second, stop_after_n_spikes_found, restore_state=False)[source]
get_square_response(delay, duration, post_delay, amp, restore_state=False)[source]
get_stability_range(testLow=-10, testHigh=15)[source]
get_structural_metrics()[source]
get_tv()[source]
init_cell_record()[source]
interpolate_time_signal(t, signal, new_interval)[source]
is_abstract_cell()[source]
list_process()[source]
load_model()[source]
recompute_range(upperLevel, lowerLevel)[source]
rotate_cell_along_PCA_axes(h)[source]
save_CVODE_STEP_FREQUENCIES()[source]
save_DRUCKMANN_PROPERTIES()[source]

Tests of features described in Druckmann et. al. 2013 (https://academic.oup.com/cercor/article/23/12/2994/470476)

These tests use SQUARE and LONG_SQUARE waveforms obtained from the NMLDB Web API The waveforms should be uploaded to production server (dendrite) before running these tests. :return: None

save_DT_SENSITIVITY()[source]
save_LMeasure_metrics(swc_file)[source]
save_LONG_SQUARE()[source]

Long square is a 2s current pulse after steady state :return: None

save_NOISE()[source]
save_NOISE_RAMP()[source]
save_RAMP()[source]

From steady state, run ramp injection :return: None

save_SHORT_SQUARE()[source]

# Short square is a brief, threshold current pulse after steady state :return: None

save_SHORT_SQUARE_HOLD()[source]

SHORT_SQUARE_HOLD is a short threshold stimulus, while under bias current :return:

save_SHORT_SQUARE_TRIPPLE()[source]
save_SQUARE()[source]
save_SQUARE_SUBTHRESHOLD()[source]

Subthreshold pulses to measure capacitance :return: None

save_STEADY_STATE()[source]

Reach steady state and save model state :return: None

save_arb_current(protocol, delay, duration, get_current_ti, meta_protocol=None, label=None, restore_state=False)[source]
save_bias_current()[source]
save_cvode_step_frequencies(protocol, delay, sub_rheobase, rheobase)[source]
save_dt_sensitivity_set(rheobase, protocol='DT_SENSITIVITY', steps_per_ms_set=[1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1], save_max_stable_dt=True)[source]
Parameters:
  • rheobase – Cell rheobase current
  • protocol – The label of the protocol to use when saving the waveform to DB
  • steps_per_ms_set – A sequence (power of 2 works well to ensure values can be compared at same time points
  • save_max_stable_dt – Record the largest dt that does not blow up the simulation
Returns:

Nothing

save_morphology_data()[source]
save_morphometrics(h)[source]
save_noise_response_set(protocol, delay, duration, post_delay, rheobase, noise_pickle_file, multiples, meta_protocol=None, restore_state=False)[source]
save_resting_voltage()[source]
save_rheobase()[source]
save_rotating_gif(bl)[source]
save_square_current_set(protocol, square_low, square_high, square_steps, delay, duration, post_delay=250)[source]
save_square_tuple_set(delay, threshold_current, intervals=[7, 11, 15, 19, 23, 27, 31, 35], stim_width=3, tuples=3)[source]
save_stability_range()[source]
save_structural_metrics()[source]
save_threshold()[source]
save_to_SWC(h)[source]
save_tolerances_with_stim()[source]
setCurrent(amp, delay, dur)[source]
sim_init()[source]
simulate_iteration()[source]
use_optimal_dt_if_available()[source]

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 std across reports.

fill_missing_ns(ns)[source]

Fill in the missing N’s with median N.

fill_missing_sems_stds(sems, stds, ns)[source]

Fill in computable sems/stds.

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.neuromldb module

class neuronunit.neuromldb.NeuroMLDBModel(model_id='NMLCL000086')[source]

Bases: object

fetch_waveform_as_AnalogSignal(waveform_id, resolution_ms=0.01, units='mV')[source]
fetch_waveform_list()[source]
get_druckmann2013_input_resistance_currents()[source]
get_druckmann2013_standard_current()[source]
get_druckmann2013_strong_current()[source]
get_files()[source]
get_steady_state_waveform()[source]
get_waveform_by_current(amplitude_nA)[source]
get_waveform_current_amplitude(waveform)[source]
read_api_url(url)[source]
class neuronunit.neuromldb.NeuroMLDBStaticModel(model_id, **params)[source]

Bases: neuronunit.models.static.StaticModel

inject_square_current(current)[source]

Static model always returns the same waveform. This method is for compatibility only.

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.load_data()[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_evaluate(vms_best, vms_worst, names=['best', 'worst'])[source]
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(fig_trip, ax_trip, model_param0, model_param1, history)[source]

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

neuronunit.plottools.plot_vm(hof, ax, key)[source]
neuronunit.plottools.plotss(matrix, hof)[source]
neuronunit.plottools.scatter_surface(fig_trip, ax_trip, model_param0, model_param1, history)[source]

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

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.sp_spike_width(best_worst)[source]
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.use_dtc_to_plotting(dtcpop)[source]

Module contents

NeuronUnit.

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