brian2tools.nmlimport.nml module

class brian2tools.nmlimport.nml.NMLMorphology(file_obj, name_heuristic=True)[source]

Bases: object

A class that extracts and store all morphology related information from a .nml file.

class SectionObject[source]

Bases: object

build_morphology(section, parent_section=None)[source]

A recursive function that converts Section tree to a Brian Morphology object.

Parameters:
  • section (SectionObject) – An object of class SectionObject containing segment member information.

  • parent_section (SectionObject) – Parent of the section object passed.

Returns:

Generated Brian morphology object.

Return type:

Morphology

get_channel_equations(ion_channel)[source]

This method extracts information for the ion_channel id passed as argument, convert required values to quantity objects and substitute it in its corresponding template to generate ion channel equations. Currently this method only support ion channels of type ionChannelHH and ionChannelPassive.

Parameters:

ion_channel (str) – ion channel id.

Returns:

equation object for the given ion channel.

Return type:

Equations

get_resolved_group_ids(m)[source]

Returns dictionary of relative ids(i.e ids used inside Brian’s morphology) of all segments in each SegmentGroup present in given morphology object.

Returns:

A dictionary of resolved segment ids of each SegmentGroup, here each SegmentGroup’s id is a key of this dictionary.

Return type:

dict

get_segment_group_ids(group_id, morph)[source]

Returns segment ids of all segments of a SegmentGroup with id group_id present in .nml file.

Parameters:
  • group_id (str) – SegmentGroup’s id/name whose information is required.

  • morph (Morphology) – Brian’s morphology object created from .nml file.

Returns:

List of segment ids

Return type:

list

printtree(section)[source]
set_neuron_properties(neuron, name, value_dict)[source]

Method to apply properties present in given dictionary to the spatialNeuron provided.

Parameters:
  • neuron_prop (SpatialNeuron) – SpatialNeuron object on which you want to apply these properties.

  • name (str) – Name of the property that should be set.

  • value_dict (dict) – Dictionary of properties to be applied.

exception brian2tools.nmlimport.nml.ValidationException[source]

Bases: Exception

brian2tools.nmlimport.nml.validate_morphology(segments)[source]

Validates if the segments are connected to each other or not.

Parameters:

segments (list) – list of segments present in a morphology