PyNN#
This documentation is auto-generated from the NeuroML schema.
AlphaCondSynapse#
- class neuroml.nml.nml.AlphaCondSynapse(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_syn: a float (required) = None, e_rev: a float (required) = None, gds_collector_=None, **kwargs_)#
Bases:
BasePynnSynapse
AlphaCondSynapse – Alpha synapse: rise time and decay time are both tau_syn. Conductance based synapse.
- Parameters:
e_rev (none)
tau_syn (none)
- 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
AlphaCurrSynapse#
- class neuroml.nml.nml.AlphaCurrSynapse(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_syn: a float (required) = None, gds_collector_=None, **kwargs_)#
Bases:
BasePynnSynapse
AlphaCurrSynapse – Alpha synapse: rise time and decay time are both tau_syn. Current based synapse.
- Parameters:
tau_syn (none)
- 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
BasePynnSynapse#
- class neuroml.nml.nml.BasePynnSynapse(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_syn: a float (required) = None, extensiontype_=None, gds_collector_=None, **kwargs_)#
Bases:
BaseSynapse
BasePynnSynapse – Base type for all PyNN synapses. Note, the current I produced is dimensionless, but it requires a membrane potential v with dimension voltage
- Parameters:
tau_syn (none)
- 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
EIF_cond_alpha_isfa_ista#
- class neuroml.nml.nml.EIF_cond_alpha_isfa_ista(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, cm: a float (required) = None, i_offset: a float (required) = None, tau_syn_E: a float (required) = None, tau_syn_I: a float (required) = None, v_init: a float (required) = None, tau_m: a float (required) = None, tau_refrac: a float (required) = None, v_reset: a float (required) = None, v_rest: a float (required) = None, v_thresh: a float (required) = None, e_rev_E: a float (required) = None, e_rev_I: a float (required) = None, a: a float (required) = None, b: a float (required) = None, delta_T: a float (required) = None, tau_w: a float (required) = None, v_spike: a float (required) = None, gds_collector_=None, **kwargs_)#
Bases:
EIF_cond_exp_isfa_ista
EIF_cond_alpha_isfa_ista – Adaptive exponential integrate and fire neuron according to Brette R and Gerstner W ( 2005 ) with alpha-function-shaped post-synaptic conductance
- Parameters:
v_spike (none)
delta_T (none)
tau_w (none)
a (none)
b (none)
e_rev_E (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
e_rev_I (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
tau_refrac (none)
v_thresh (none)
tau_m (none)
v_rest (none)
v_reset (none)
cm (none)
i_offset (none)
tau_syn_E (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
tau_syn_I (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
v_init (none)
- 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
EIF_cond_exp_isfa_ista#
- class neuroml.nml.nml.EIF_cond_exp_isfa_ista(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, cm: a float (required) = None, i_offset: a float (required) = None, tau_syn_E: a float (required) = None, tau_syn_I: a float (required) = None, v_init: a float (required) = None, tau_m: a float (required) = None, tau_refrac: a float (required) = None, v_reset: a float (required) = None, v_rest: a float (required) = None, v_thresh: a float (required) = None, e_rev_E: a float (required) = None, e_rev_I: a float (required) = None, a: a float (required) = None, b: a float (required) = None, delta_T: a float (required) = None, tau_w: a float (required) = None, v_spike: a float (required) = None, extensiontype_=None, gds_collector_=None, **kwargs_)#
Bases:
basePyNNIaFCondCell
EIF_cond_exp_isfa_ista – Adaptive exponential integrate and fire neuron according to Brette R and Gerstner W ( 2005 ) with exponentially-decaying post-synaptic conductance
- Parameters:
v_spike (none)
delta_T (none)
tau_w (none)
a (none)
b (none)
e_rev_E (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
e_rev_I (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
tau_refrac (none)
v_thresh (none)
tau_m (none)
v_rest (none)
v_reset (none)
cm (none)
i_offset (none)
tau_syn_E (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
tau_syn_I (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
v_init (none)
- 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
ExpCondSynapse#
- class neuroml.nml.nml.ExpCondSynapse(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_syn: a float (required) = None, e_rev: a float (required) = None, gds_collector_=None, **kwargs_)#
Bases:
BasePynnSynapse
ExpCondSynapse – Conductance based synapse with instantaneous rise and single exponential decay ( with time constant tau_syn )
- Parameters:
e_rev (none)
tau_syn (none)
- 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
ExpCurrSynapse#
- class neuroml.nml.nml.ExpCurrSynapse(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_syn: a float (required) = None, gds_collector_=None, **kwargs_)#
Bases:
BasePynnSynapse
ExpCurrSynapse – Current based synapse with instantaneous rise and single exponential decay ( with time constant tau_syn )
- Parameters:
tau_syn (none)
- 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
HH_cond_exp#
- class neuroml.nml.nml.HH_cond_exp(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, cm: a float (required) = None, i_offset: a float (required) = None, tau_syn_E: a float (required) = None, tau_syn_I: a float (required) = None, v_init: a float (required) = None, v_offset: a float (required) = None, e_rev_E: a float (required) = None, e_rev_I: a float (required) = None, e_rev_K: a float (required) = None, e_rev_Na: a float (required) = None, e_rev_leak: a float (required) = None, g_leak: a float (required) = None, gbar_K: a float (required) = None, gbar_Na: a float (required) = None, gds_collector_=None, **kwargs_)#
Bases:
basePyNNCell
HH_cond_exp – Single-compartment Hodgkin-Huxley-type neuron with transient sodium and delayed-rectifier potassium currents using the ion channel models from Traub.
- Parameters:
gbar_K (none)
gbar_Na (none)
g_leak (none)
e_rev_K (none)
e_rev_Na (none)
e_rev_leak (none)
v_offset (none)
e_rev_E (none)
e_rev_I (none)
cm (none)
i_offset (none)
tau_syn_E (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
tau_syn_I (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
v_init (none)
- 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
IF_cond_alpha#
- class neuroml.nml.nml.IF_cond_alpha(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, cm: a float (required) = None, i_offset: a float (required) = None, tau_syn_E: a float (required) = None, tau_syn_I: a float (required) = None, v_init: a float (required) = None, tau_m: a float (required) = None, tau_refrac: a float (required) = None, v_reset: a float (required) = None, v_rest: a float (required) = None, v_thresh: a float (required) = None, e_rev_E: a float (required) = None, e_rev_I: a float (required) = None, gds_collector_=None, **kwargs_)#
Bases:
basePyNNIaFCondCell
IF_cond_alpha – Leaky integrate and fire model with fixed threshold and alpha-function-shaped post-synaptic conductance
- Parameters:
e_rev_E (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
e_rev_I (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
tau_refrac (none)
v_thresh (none)
tau_m (none)
v_rest (none)
v_reset (none)
cm (none)
i_offset (none)
tau_syn_E (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
tau_syn_I (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
v_init (none)
- 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
IF_cond_exp#
- class neuroml.nml.nml.IF_cond_exp(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, cm: a float (required) = None, i_offset: a float (required) = None, tau_syn_E: a float (required) = None, tau_syn_I: a float (required) = None, v_init: a float (required) = None, tau_m: a float (required) = None, tau_refrac: a float (required) = None, v_reset: a float (required) = None, v_rest: a float (required) = None, v_thresh: a float (required) = None, e_rev_E: a float (required) = None, e_rev_I: a float (required) = None, gds_collector_=None, **kwargs_)#
Bases:
basePyNNIaFCondCell
IF_cond_exp – Leaky integrate and fire model with fixed threshold and exponentially-decaying post-synaptic conductance
- Parameters:
e_rev_E (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
e_rev_I (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
tau_refrac (none)
v_thresh (none)
tau_m (none)
v_rest (none)
v_reset (none)
cm (none)
i_offset (none)
tau_syn_E (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
tau_syn_I (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
v_init (none)
- 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
IF_curr_alpha#
- class neuroml.nml.nml.IF_curr_alpha(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, cm: a float (required) = None, i_offset: a float (required) = None, tau_syn_E: a float (required) = None, tau_syn_I: a float (required) = None, v_init: a float (required) = None, tau_m: a float (required) = None, tau_refrac: a float (required) = None, v_reset: a float (required) = None, v_rest: a float (required) = None, v_thresh: a float (required) = None, gds_collector_=None, **kwargs_)#
Bases:
basePyNNIaFCell
IF_curr_alpha – Leaky integrate and fire model with fixed threshold and alpha-function-shaped post-synaptic current
- Parameters:
tau_refrac (none)
v_thresh (none)
tau_m (none)
v_rest (none)
v_reset (none)
cm (none)
i_offset (none)
tau_syn_E (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
tau_syn_I (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
v_init (none)
- 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
IF_curr_exp#
- class neuroml.nml.nml.IF_curr_exp(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, cm: a float (required) = None, i_offset: a float (required) = None, tau_syn_E: a float (required) = None, tau_syn_I: a float (required) = None, v_init: a float (required) = None, tau_m: a float (required) = None, tau_refrac: a float (required) = None, v_reset: a float (required) = None, v_rest: a float (required) = None, v_thresh: a float (required) = None, gds_collector_=None, **kwargs_)#
Bases:
basePyNNIaFCell
IF_curr_exp – Leaky integrate and fire model with fixed threshold and decaying-exponential post-synaptic current
- Parameters:
tau_refrac (none)
v_thresh (none)
tau_m (none)
v_rest (none)
v_reset (none)
cm (none)
i_offset (none)
tau_syn_E (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
tau_syn_I (none) – This parameter is never used in the NeuroML2 description of this cell! Any synapse producing a current can be placed on this cell
v_init (none)
- 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
SpikeSourcePoisson#
- class neuroml.nml.nml.SpikeSourcePoisson(id: a NonNegativeInteger (required) = None, metaid: a MetaId (optional) = None, notes: a string (optional) = None, properties: list of Property(s) (optional) = None, annotation: a Annotation (optional) = None, start: a Nml2Quantity_time (required) = None, duration: a Nml2Quantity_time (required) = None, rate: a Nml2Quantity_pertime (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
SpikeSourcePoisson – Spike source, generating spikes according to a Poisson process.
- Parameters:
start (time)
duration (time)
rate (per_time)
- 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