Synapses#

This documentation is auto-generated from the NeuroML schema.

AlphaCurrentSynapse#

class neuroml.nml.nml.AlphaCurrentSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, tau: a Nml2Quantity_time (required) = None, ibase: a Nml2Quantity_current (required) = None, gds_collector_=None, **kwargs_)#

Bases: BaseCurrentBasedSynapse

AlphaCurrentSynapse – Alpha current synapse: rise time and decay time are both tau.

Parameters:
  • tau (time) – Time course for rise and decay

  • ibase (current) – Baseline current increase after receiving a spike

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

AlphaSynapse#

class neuroml.nml.nml.AlphaSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, gbase: a Nml2Quantity_conductance (required) = None, erev: a Nml2Quantity_voltage (required) = None, tau: a Nml2Quantity_time (required) = None, gds_collector_=None, **kwargs_)#

Bases: BaseConductanceBasedSynapse

AlphaSynapse – Ohmic synapse model where rise time and decay time are both tau. Max conductance reached during this time ( assuming zero conductance before ) is gbase * weight.

Parameters:
  • tau (time) – Time course of rise/decay

  • gbase (conductance) – Baseline conductance, generally the maximum conductance following a single spike

  • erev (voltage) – Reversal potential of the synapse

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

BaseConductanceBasedSynapse#

class neuroml.nml.nml.BaseConductanceBasedSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, gbase: a Nml2Quantity_conductance (required) = None, erev: a Nml2Quantity_voltage (required) = None, extensiontype_=None, gds_collector_=None, **kwargs_)#

Bases: BaseVoltageDepSynapse

BaseConductanceBasedSynapse – Synapse model which exposes a conductance g in addition to producing a current. Not necessarily ohmic!! cno_0000027

Parameters:
  • gbase (conductance) – Baseline conductance, generally the maximum conductance following a single spike

  • erev (voltage) – Reversal potential of the synapse

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

BaseConductanceBasedSynapseTwo#

class neuroml.nml.nml.BaseConductanceBasedSynapseTwo(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, gbase1: a Nml2Quantity_conductance (required) = None, gbase2: a Nml2Quantity_conductance (required) = None, erev: a Nml2Quantity_voltage (required) = None, extensiontype_=None, gds_collector_=None, **kwargs_)#

Bases: BaseVoltageDepSynapse

BaseConductanceBasedSynapseTwo – Synapse model suited for a sum of two expTwoSynapses which exposes a conductance g in addition to producing a current. Not necessarily ohmic!! cno_0000027

Parameters:
  • gbase1 (conductance) – Baseline conductance 1

  • gbase2 (conductance) – Baseline conductance 2

  • erev (voltage) – Reversal potential of the synapse

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

BaseCurrentBasedSynapse#

class neuroml.nml.nml.BaseCurrentBasedSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, extensiontype_=None, gds_collector_=None, **kwargs_)#

Bases: BaseSynapse

BaseCurrentBasedSynapse – Synapse model which produces a synaptic current.

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

BaseSynapse#

class neuroml.nml.nml.BaseSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, extensiontype_=None, gds_collector_=None, **kwargs_)#

Bases: Standalone

BaseSynapse – Base type for all synapses, i. e. ComponentTypes which produce a current ( dimension current ) and change Dynamics in response to an incoming event. cno_0000009

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

BaseVoltageDepSynapse#

class neuroml.nml.nml.BaseVoltageDepSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, extensiontype_=None, gds_collector_=None, **kwargs_)#

Bases: BaseSynapse

BaseVoltageDepSynapse – Base type for synapses with a dependence on membrane potential

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

BlockingPlasticSynapse#

class neuroml.nml.nml.BlockingPlasticSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, gbase: a Nml2Quantity_conductance (required) = None, erev: a Nml2Quantity_voltage (required) = None, tau_decay: a Nml2Quantity_time (required) = None, tau_rise: a Nml2Quantity_time (required) = None, plasticity_mechanism: a PlasticityMechanism (optional) = None, block_mechanism: a BlockMechanism (optional) = None, gds_collector_=None, **kwargs_)#

Bases: ExpTwoSynapse

BlockingPlasticSynapse – Biexponential synapse that allows for optional block and plasticity mechanisms, which can be expressed as child elements.

Parameters:
  • tauRise (time)

  • tauDecay (time)

  • gbase (conductance) – Baseline conductance, generally the maximum conductance following a single spike

  • erev (voltage) – Reversal potential of the synapse

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

DoubleSynapse#

class neuroml.nml.nml.DoubleSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, synapse1: a NmlId (required) = None, synapse2: a NmlId (required) = None, synapse1_path: a string (required) = None, synapse2_path: a string (required) = None, gds_collector_=None, **kwargs_)#

Bases: BaseVoltageDepSynapse

DoubleSynapse – Synapse consisting of two independent synaptic mechanisms ( e. g. AMPA-R and NMDA-R ), which can be easily colocated in connections

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

ExpOneSynapse#

class neuroml.nml.nml.ExpOneSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, gbase: a Nml2Quantity_conductance (required) = None, erev: a Nml2Quantity_voltage (required) = None, tau_decay: a Nml2Quantity_time (required) = None, gds_collector_=None, **kwargs_)#

Bases: BaseConductanceBasedSynapse

ExpOneSynapse – Ohmic synapse model whose conductance rises instantaneously by ( gbase * weight ) on receiving an event, and which decays exponentially to zero with time course tauDecay

Parameters:
  • tauDecay (time) – Time course of decay

  • gbase (conductance) – Baseline conductance, generally the maximum conductance following a single spike

  • erev (voltage) – Reversal potential of the synapse

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

ExpThreeSynapse#

class neuroml.nml.nml.ExpThreeSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, gbase1: a Nml2Quantity_conductance (required) = None, gbase2: a Nml2Quantity_conductance (required) = None, erev: a Nml2Quantity_voltage (required) = None, tau_decay1: a Nml2Quantity_time (required) = None, tau_decay2: a Nml2Quantity_time (required) = None, tau_rise: a Nml2Quantity_time (required) = None, gds_collector_=None, **kwargs_)#

Bases: BaseConductanceBasedSynapseTwo

ExpThreeSynapse – Ohmic synapse similar to expTwoSynapse but consisting of two components that can differ in decay times and max conductances but share the same rise time.

Parameters:
  • tauRise (time)

  • tauDecay1 (time)

  • tauDecay2 (time)

  • gbase1 (conductance) – Baseline conductance 1

  • gbase2 (conductance) – Baseline conductance 2

  • erev (voltage) – Reversal potential of the synapse

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

ExpTwoSynapse#

class neuroml.nml.nml.ExpTwoSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, gbase: a Nml2Quantity_conductance (required) = None, erev: a Nml2Quantity_voltage (required) = None, tau_decay: a Nml2Quantity_time (required) = None, tau_rise: a Nml2Quantity_time (required) = None, extensiontype_=None, gds_collector_=None, **kwargs_)#

Bases: BaseConductanceBasedSynapse

ExpTwoSynapse – Ohmic synapse model whose conductance waveform on receiving an event has a rise time of tauRise and a decay time of tauDecay. Max conductance reached during this time ( assuming zero conductance before ) is gbase * weight.

Parameters:
  • tauRise (time)

  • tauDecay (time)

  • gbase (conductance) – Baseline conductance, generally the maximum conductance following a single spike

  • erev (voltage) – Reversal potential of the synapse

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

GapJunction#

class neuroml.nml.nml.GapJunction(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, conductance: a Nml2Quantity_conductance (required) = None, gds_collector_=None, **kwargs_)#

Bases: BaseSynapse

GapJunction – Gap junction/single electrical connection

Parameters:

conductance (conductance)

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

GradedSynapse#

class neuroml.nml.nml.GradedSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, conductance: a Nml2Quantity_conductance (required) = None, delta: a Nml2Quantity_voltage (required) = None, Vth: a Nml2Quantity_voltage (required) = None, k: a Nml2Quantity_pertime (required) = None, erev: a Nml2Quantity_voltage (required) = None, gds_collector_=None, **kwargs_)#

Bases: BaseSynapse

GradedSynapse – Graded/analog synapse. Based on synapse in Methods of http://www. nature.com/neuro/journal/v7/n12/abs/nn1352.html

Parameters:
  • conductance (conductance)

  • delta (voltage) – Slope of the activation curve

  • k (per_time) – Rate constant for transmitter-receptor dissociation rate

  • Vth (voltage) – The half-activation voltage of the synapse

  • erev (voltage) – The reversal potential of the synapse

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

LinearGradedSynapse#

class neuroml.nml.nml.LinearGradedSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, conductance: a Nml2Quantity_conductance (required) = None, gds_collector_=None, **kwargs_)#

Bases: BaseSynapse

LinearGradedSynapse – Behaves just like a one way gap junction.

Parameters:

conductance (conductance)

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid

SilentSynapse#

class neuroml.nml.nml.SilentSynapse(id: a NmlId (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, neuro_lex_id: a NeuroLexId (optional) = None, gds_collector_=None, **kwargs_)#

Bases: BaseSynapse

SilentSynapse – Dummy synapse which emits no current. Used as presynaptic endpoint for analog synaptic connection.

add(obj=None, hint=None, force=False, validate=True, **kwargs)#

Generic function to allow easy addition of a new member to a NeuroML object. Without arguments, when obj=None, it simply calls the info() method to provide the list of valid member types for the NeuroML class.

Please use the info() method directly for more information on the current contents of this component object.

When obj is given a string name of a NeuroML class (“NeuroMLDocument”), or the class itself (neuroml.NeuroMLDocument), a new object will be created of this type and added as a member to the calling (parent) component type object.

Parameters:
  • obj (Object) – member object or class type (neuroml.NeuroMLDocument) or name of class type (“NeuroMLDocument”), or None

  • hint (string) – member name to add to when there are multiple members that obj can be added to

  • force (bool) – boolean to force addition when an obj has already been added previously

  • validate (bool) – validate component after adding (default: True)

Returns obj:

the provided or created object

Raises:
  • Exception – if a member compatible to obj could not be found

  • Exception – if multiple members can accept the object and no hint is provided.

classmethod component_factory(component_type, validate=True, **kwargs)#

Factory function to create a NeuroML Component object.

Users can provide the name of the component as a string or the class variable, along with its named constructor arguments, and this function will create a new object of the Component and return it.

Users can use the add() helper function to further modify components

This factory runs two checks while creating the component object:

  • that all arguments given do belong to the ComponentType (useful for caching typos)

  • that the created component is valid NeuroML

It is therefore less error prone than creating Components directly using the ComponentType constructors.

It may be useful to disable validation when starting a model. The validate parameter can be set to False for this.

Parameters:
  • component_type (str/type) – component type to create component from: this can either be the name of the component as a string, e.g. “NeuroMLDocument”, or it can be the class type itself: NeuroMLDocument. Note that when providing the class type, one will need to import it, e.g.: import NeuroMLDocument, to ensure that it is defined, whereas this will not be required when using the string.

  • validate (bool) – toggle validation (default: True)

  • kwargs (named arguments) – named arguments to be passed to ComponentType constructor

Returns:

new Component (object) of provided ComponentType

Return type:

object

Raises:

ValueError – if validation/checks fail

classmethod get_class_hierarchy()#

Get the class hierarchy for a component classs.

Reference: https://stackoverflow.com/a/75161393/375067

See the methods in neuroml.utils to use this generated hierarchy.

Returns:

nested single key dictionaries where the key of each dictionary is the root node of that subtree, and keys are its immediate descendents

classmethod get_nml2_class_hierarchy()#

Return the NeuroML class hierarchy.

The root here is NeuroMLDocument. This is useful in calculating paths to different components to aid in construction of relative paths.

This caches the value as a class variable so that it is not re-calculated when used multiple times.

has__content()#
info(show_contents=False, return_format='string')#

Provide information on NeuroML component.

This is useful to quickly check what members can go into a particular NeuroML class (which will match the Schema definitions). It lists these members and notes whether they are “single” type elements (Child elements) or “List” elements (Children elements). It will also note whether a member is optional or required.

To get a list of possible parents, use the parentinfo() method.

By default, this will only show the members, and not their contents. To see contents that have been set, use show_contents=True. This will not show empty/unset contents. To see all contents, set show_contents=all.

Note that not all members will have ids (since not all NeuroML2 ComponentTypes have ids). For members that do not have ids, the object reference is listed instead.

See http://www.davekuhlman.org/generateDS.html#user-methods for more information on the MemberSpec_ class that generateDS uses.

Parameters:
  • show_contents (bool or str) – toggle to print out the contents of the members

  • return_format (str) –

    select what format to return information in “string” (default), or “dict” or “list”.

    If “dict” or “list” is provided, the information is returned as a dict/list instead of being printed. Note that if show_contents is False, only a list of members is available and will be returned even if “dict” is supplied. If show_contents is True or “all” but “list” is provided, only the list of members will be returned. If something other than “string”, “list”, or “dict” is provided, the string representation is returned and printed.

Returns:

info string, or list of members or dict with members as keys and member values as values

Return type:

str, list/dict

parentinfo(return_format='string')#

Show the list of possible parents.

This object can then be added to objects of the parents using the add method.

It is similar to the info() method. However, where in the info() method, it is possible to find the contents of members for a component (object) rather easily, it is not so easily possible to get all the objects that may refer to another object.

So, this will provide information on possible parents. It will not provide information on whether the components (objects) of the particular parent have already been instantiated and what their values are. The user should be able to gather this information easily by reading the sources.

Please also note that various component types in NeuroML take ids of components as parameters. For example, an ExplicitInput will take the id of a cell as its target, and the id of a PulseGenerator as input. However, these are string fields, and the cell/pulse generator classes do not currently know that their ids can be used in ExplicitInput. This information does not live in the XSD schema, and so cannot be obtained here either.

Parameters:

return_format (str) – format in which to return information. If “string” (default), an information string is returned. If “list” or “dict”, a list or dictionary is returned. The list will only contain the parent names, whereas the dict will also include the member of the parent that the component type matches to.

Returns:

info string, or list of parents or dict with parents as keys and member information as values

Return type:

str, list/dict

validate(recursive=False)#

Validate the component.

Throws a Python ValueError if a the component is invalid. You can ignore this by using a try .. except ValueError: pass block.

Note: validating your NeuroML file against the schema, which pynml and jnml do, will also check this.

Note: that this is different from the validate_ method, which does not validate inherited members.

Parameters:

recursive (bool) – toggle recursive validation (default: False)

Returns:

None

Return type:

None

Raises:

ValueError – if component is invalid