pyneuroml.analysis package#

pyneuroml.analysis.analyse_spiketime_vs_dt(nml2_file, target, duration, simulator, cell_v_path, dts, verbose=False, spike_threshold_mV=0, show_plot_already=True, save_figure_to=None, num_of_last_spikes=None)#
pyneuroml.analysis.generate_current_vs_frequency_curve(nml2_file: str, cell_id: str, start_amp_nA: float = -0.1, end_amp_nA: float = 0.1, step_nA: float = 0.01, custom_amps_nA: List[float] = [], analysis_duration: float = 1000, analysis_delay: float = 0, pre_zero_pulse: float = 0, post_zero_pulse: float = 0, dt: float = 0.05, temperature: str = '32degC', spike_threshold_mV: float = 0.0, plot_voltage_traces: bool = False, plot_if: bool = True, plot_iv: bool = False, xlim_if: Optional[List[float]] = None, ylim_if: Optional[List[float]] = None, xlim_iv: Optional[List[float]] = None, ylim_iv: Optional[List[float]] = None, label_xaxis: bool = True, label_yaxis: bool = True, show_volts_label: bool = True, grid: bool = True, font_size: int = 12, if_iv_color: str = 'k', linewidth: str = '1', bottom_left_spines_only: bool = False, show_plot_already: bool = True, save_voltage_traces_to: Optional[str] = None, save_if_figure_to: Optional[str] = None, save_iv_figure_to: Optional[str] = None, save_if_data_to: Optional[str] = None, save_iv_data_to: Optional[str] = None, simulator: str = 'jNeuroML', num_processors: int = 1, include_included: bool = True, title_above_plot: bool = False, return_axes: bool = False, verbose: bool = False)#

Generate current vs firing rate frequency curve for provided cell.

Parameters
  • nml2_file (str) – name of NeuroML file containing cell definition

  • cell_id (str) – id of cell to analyse

  • start_amp_nA (float) – min current to use for analysis

  • end_amp_nA (float) – max current to use for analysis

  • step_nA (float) – step value to use to generate analysis currents between start_amp_nA and end_amp_nA

  • custom_amps_nA – list of currents in nA to use. Note that this overrides the list created using start_amp_nA, end_amp_nA, and step_nA) :type custom_amps_nA: list(float)

  • analysis_duration (float) – duration of analysis

  • analysis_delay (float) – delay period before analysis begins

  • pre_zero_pulse (float) – duration of pre-zero pulse

  • post_zero_pulse (float) – duration of post-zero pulse

  • dt (float) – integration time step

  • temperature (str) – temperature to use for analysis

  • spike_threshold_mV (float) – spike threshold potential

  • plot_voltage_traces

  • plot_if (bool) – toggle whether to plot I-F graphs

  • plot_iv (bool) – toggle whether to plot I-V graphs

  • xlim_if ([min, max]) – x-limits of I-F curve

  • ylim_if ([min, max]) – y limits of I-F curve

  • xlim_iv ([min, max]) – x limits of I-V curve

  • ylim_iv ([min, max]) – y limits of I-V curve

  • label_xaxis (str) – label for x axis

  • label_yaxis (str) – label for y axis

  • show_volts_label (bool) – toggle whether voltage traces should have corresponding current values labelled in the plot

  • grid (bool) – toggle whether grid should be shown in plot

  • font_size (int) – font size for plot

  • if_iv_color (str) – color to use for I-F and I-V plots

  • linewidth (str) – line width for plotting

  • bottom_left_spines_only

  • show_plot_already (bool) – toggle whether generated plots should be shown

  • save_voltage_traces_to (str) – file to save membrane potential traces to

  • save_if_figure_to (str) – file to save I-F plot figure to

  • save_iv_figure_to (str) – file to save I-V plot figure to

  • save_if_data_to (str) – file to save I-F plot data to

  • save_iv_data_to (str) – file to save I-V plot data to

  • simulator (str) – simulator to use

  • num_processors (int) – number of processors to use for analysis

  • include_included

  • title_above_plot

  • return_axes (bool) – toggle whether plotting axis should be returned. This is useful if one wants to overlay more graphs in the same plot.

  • verbose

pyneuroml.analysis.NML2ChannelAnalysis module#

pyneuroml.analysis.NML2ChannelAnalysis.compute_iv_curve(channel, a, results, grid=True)#
pyneuroml.analysis.NML2ChannelAnalysis.generate_lems_channel_analyser(channel_file: str, channel: str, min_target_voltage: float, step_target_voltage: float, max_target_voltage: float, clamp_delay: float, clamp_duration: float, clamp_base_voltage: float, duration: float, erev: float, gates: List[str], temperature: float, ca_conc: float, iv_curve: bool, scale_dt: float = 1, dat_suffix: str = '', verbose: bool = True)#

Generate analysis simulation LEMS file.

Parameters
  • channel_file (str) – path to channel file

  • channel (string) – name of channel

  • min_target_voltage (float) – magnitude of minimum target voltage in mV

  • max_target_voltage (float) – magnitude of maximum target voltage in mV

  • clamp_delay (float) – magnitude of delay for clamp in ms

  • clamp_duration – magnitude of duration of clamp in ms

  • clamp_base_voltage (float) – magnitude of base voltage of clamp in mV

  • duration (float) – magnitude of duration of simulation in ms

  • erev (float) – magnitude of reversal potential in mV

  • gates (list of str) – list of gates

  • temperature (float) – magnitude of temperature in degC

  • ca_conc (float) – magnitude of calcium concentration in mM

  • iv_curve (bool) – toggle whether to plot iv curve

  • scale_dt (float) – magnitude to scale dt by in ms

  • dat_suffix (str) – suffix of data file

  • verbose (bool) – toggle verbosity

pyneuroml.analysis.NML2ChannelAnalysis.get_channel_gates(channel: Union[IonChannel, IonChannelHH]) List[Union[GateHHUndetermined, GateHHRates, GateHHTauInf, GateHHInstantaneous]]#

Get gates in a channel

Parameters

channel (neuroml.IonChannel, neuroml.IonChannelHH) – channel object

Returns

list of gates

Return type

list

pyneuroml.analysis.NML2ChannelAnalysis.get_channels_from_channel_file(channel_file: str) List[Union[IonChannelHH, IonChannel]]#

Get IonChannelHH and IonChannel instances from a NeuroML channel file.

Parameters

channel_file (str) – complete path to a channel file

Returns

list of channels

Return type

list

pyneuroml.analysis.NML2ChannelAnalysis.get_colour_hex(fract: float, min_colour: Tuple[int, int, int] = (255, 255, 0), max_colour: Tuple[int, int, int] = (255, 0, 0)) str#

Get colour hex at fraction between min_colour and max_colour.

Parameters
  • fract (float between (0, 1)) – fraction between min_colour and max_colour

  • min_colour (tuple) – lower colour tuple (R, G, B)

:param max_colour upper colour tuple (R, G, B) :type max_colour: tuple :returns: colour in hex representation :rtype: string

pyneuroml.analysis.NML2ChannelAnalysis.get_conductance_expression(channel: Union[IonChannel, IonChannelHH]) str#

Get expression of conductance in channel.

Parameters

channel (neuroml.IonChannel, neuroml.IonChannelHH) – channel object

Returns

expression for conductance of channel.

Return type

str

pyneuroml.analysis.NML2ChannelAnalysis.get_includes_from_channel_file(channel_file: str) List[IncludeType]#

Get includes from a NeuroML channel file

Parameters

channel_file (str) – complete path to a channel file

Returns

list of includes

Return type

list

pyneuroml.analysis.NML2ChannelAnalysis.get_ion_color(ion: str) str#

Get colours for ions in hex format.

Hard codes for na, k, ca, h. All others get a grey.

Parameters

ion (str) – name of ion

Returns

colour in hex

Return type

str

pyneuroml.analysis.NML2ChannelAnalysis.get_state_color(s: str) str#

Get colours for state variables.

Hard codes for m, k, r, h, l, n, a, b, c, q, e, f, p, s, u.

Parameters

state (str) – name of state

Returns

colour in hex format

Return type

str

pyneuroml.analysis.NML2ChannelAnalysis.make_html_file(info)#
pyneuroml.analysis.NML2ChannelAnalysis.make_iv_curve_fig(a, grid=True)#
pyneuroml.analysis.NML2ChannelAnalysis.make_lems_file(channel, a)#
pyneuroml.analysis.NML2ChannelAnalysis.make_md_file(info)#
pyneuroml.analysis.NML2ChannelAnalysis.make_overview_dir()#
pyneuroml.analysis.NML2ChannelAnalysis.merge_with_template(model: Dict[Any, Any], templfile: str) str#

Merge model information with airspeed template.

Parameters
  • model (dict) – model information

  • templfile (string) – name of airspeed template file

Returns

merged template string

Return type

str

pyneuroml.analysis.NML2ChannelAnalysis.plot_channel(channel, a, results, iv_data=None, grid=True)#
pyneuroml.analysis.NML2ChannelAnalysis.plot_iv_curve(a, hold_v, i, *plt_args, **plt_kwargs)#

A single IV curve

pyneuroml.analysis.NML2ChannelAnalysis.plot_iv_curve_vm(channel, a, hold_v, times, currents, grid=True)#
pyneuroml.analysis.NML2ChannelAnalysis.plot_iv_curves(channel, a, iv_data, grid=True)#
pyneuroml.analysis.NML2ChannelAnalysis.plot_kinetics(channel, a, results, grid=True)#
pyneuroml.analysis.NML2ChannelAnalysis.plot_steady_state(channel, a, results, grid=True)#
pyneuroml.analysis.NML2ChannelAnalysis.process_channel_file(channel_file: str, a) List[Any]#

Process the channel file.

Parameters
  • channel_file (str) – complete path to channel file

  • a (argparse.Namsepace) – argparse.Namespace instance holding all arguments

Returns

list of channel information

Return type

list

Raises

IOError – if channel file could not be found

pyneuroml.analysis.NML2ChannelAnalysis.run(a=None, **kwargs)#
pyneuroml.analysis.NML2ChannelAnalysis.run_lems_file(lems_file, verbose)#
pyneuroml.analysis.NML2ChannelAnalysis.save_fig(name)#

pyneuroml.analysis.ChannelDensityPlot module#

pyneuroml.analysis.ChannelDensityPlot.add_text(row, text)#
pyneuroml.analysis.ChannelDensityPlot.format_float(dens)#
pyneuroml.analysis.ChannelDensityPlot.generate_channel_density_plots(nml2_file, text_densities=False, passives_erevs=False, target_directory=None)#
pyneuroml.analysis.ChannelDensityPlot.get_ion_color(ion)#

pyneuroml.analysis.ChannelHelper module#

pyneuroml.analysis.ChannelHelper.evaluate_HHExpLinearRate(rate, midpoint, scale, v)#

Helper for putting values into HHExpLinearRate, see also https://docs.neuroml.org/Userdocs/Schemas/Channels.html#hhexplinearrate

pyneuroml.analysis.ChannelHelper.evaluate_HHExpRate(rate, midpoint, scale, v)#

Helper for putting values into HHExpRate, see also https://docs.neuroml.org/Userdocs/Schemas/Channels.html#hhexprate

pyneuroml.analysis.ChannelHelper.evaluate_HHSigmoidRate(rate, midpoint, scale, v)#

Helper for putting values into HHSigmoidRate, see also https://docs.neuroml.org/Userdocs/Schemas/Channels.html#hhsigmoidrate