Inputs#
This documentation is auto-generated from the NeuroML schema.
CompoundInput#
- class neuroml.nml.nml.CompoundInput(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, pulse_generators: list of PulseGenerator(s) (optional) = None, sine_generators: list of SineGenerator(s) (optional) = None, ramp_generators: list of RampGenerator(s) (optional) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
CompoundInput – Generates a current which is the sum of all its child basePointCurrent element, e. g. can be a combination of pulseGenerator , sineGenerator elements producing a single i. Scaled by weight, if set
- 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
CompoundInputDL#
- class neuroml.nml.nml.CompoundInputDL(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, pulse_generator_dls: list of PulseGeneratorDL(s) (optional) = None, sine_generator_dls: list of SineGeneratorDL(s) (optional) = None, ramp_generator_dls: list of RampGeneratorDL(s) (optional) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
CompoundInputDL – Generates a current which is the sum of all its child basePointCurrentDL elements, e. g. can be a combination of pulseGeneratorDL , sineGeneratorDL elements producing a single i. Scaled by weight, if set
- 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
PoissonFiringSynapse#
- class neuroml.nml.nml.PoissonFiringSynapse(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, average_rate: a Nml2Quantity_pertime (required) = None, synapse: a string (required) = None, spike_target: a string (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
PoissonFiringSynapse – Poisson spike generator firing at averageRate, which is connected to single synapse that is triggered every time a spike is generated, producing an input current. See also transientPoissonFiringSynapse .
- Parameters:
averageRate (per_time) – The average rate at which spikes are emitted
- 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
PulseGenerator#
- class neuroml.nml.nml.PulseGenerator(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, delay: a Nml2Quantity_time (required) = None, duration: a Nml2Quantity_time (required) = None, amplitude: a Nml2Quantity_current (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
PulseGenerator – Generates a constant current pulse of a certain amplitude for a specified duration after a delay. Scaled by weight, if set
- Parameters:
delay (time) – Delay before change in current. Current is zero prior to this.
duration (time) – Duration for holding current at amplitude. Current is zero after delay + duration.
amplitude (current) – Amplitude of current pulse
- 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
PulseGeneratorDL#
- class neuroml.nml.nml.PulseGeneratorDL(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, delay: a Nml2Quantity_time (required) = None, duration: a Nml2Quantity_time (required) = None, amplitude: a Nml2Quantity_current (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
PulseGeneratorDL – Dimensionless equivalent of pulseGenerator . Generates a constant current pulse of a certain amplitude for a specified duration after a delay. Scaled by weight, if set
- Parameters:
delay (time) – Delay before change in current. Current is zero prior to this.
duration (time) – Duration for holding current at amplitude. Current is zero after delay + duration.
amplitude (none) – Amplitude of current pulse
- 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
RampGenerator#
- class neuroml.nml.nml.RampGenerator(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, delay: a Nml2Quantity_time (required) = None, duration: a Nml2Quantity_time (required) = None, start_amplitude: a Nml2Quantity_current (required) = None, finish_amplitude: a Nml2Quantity_current (required) = None, baseline_amplitude: a Nml2Quantity_current (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
RampGenerator – Generates a ramping current after a time delay, for a fixed duration. During this time the current steadily changes from startAmplitude to finishAmplitude. Scaled by weight, if set
- Parameters:
delay (time) – Delay before change in current. Current is baselineAmplitude prior to this.
duration (time) – Duration for holding current at amplitude. Current is baselineAmplitude after delay + duration.
startAmplitude (current) – Amplitude of linearly varying current at time delay
finishAmplitude (current) – Amplitude of linearly varying current at time delay + duration
baselineAmplitude (current) – Amplitude of current before time delay, and after time delay + duration
- 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
RampGeneratorDL#
- class neuroml.nml.nml.RampGeneratorDL(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, delay: a Nml2Quantity_time (required) = None, duration: a Nml2Quantity_time (required) = None, start_amplitude: a Nml2Quantity_current (required) = None, finish_amplitude: a Nml2Quantity_current (required) = None, baseline_amplitude: a Nml2Quantity_current (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
RampGeneratorDL – Dimensionless equivalent of rampGenerator . Generates a ramping current after a time delay, for a fixed duration. During this time the dimensionless current steadily changes from startAmplitude to finishAmplitude. Scaled by weight, if set
- Parameters:
delay (time) – Delay before change in current. Current is baselineAmplitude prior to this.
duration (time) – Duration for holding current at amplitude. Current is baselineAmplitude after delay + duration.
startAmplitude (none) – Amplitude of linearly varying current at time delay
finishAmplitude (none) – Amplitude of linearly varying current at time delay + duration
baselineAmplitude (none) – Amplitude of current before time delay, and after time delay + duration
- 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
SineGenerator#
- class neuroml.nml.nml.SineGenerator(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, delay: a Nml2Quantity_time (required) = None, phase: a Nml2Quantity_none (required) = None, duration: a Nml2Quantity_time (required) = None, amplitude: a Nml2Quantity_current (required) = None, period: a Nml2Quantity_time (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
SineGenerator – Generates a sinusoidally varying current after a time delay, for a fixed duration. The period and maximum amplitude of the current can be set as well as the phase at which to start. Scaled by weight, if set
- Parameters:
phase (none) – Phase ( between 0 and 2*pi ) at which to start the varying current ( i. e. at time given by delay )
delay (time) – Delay before change in current. Current is zero prior to this.
duration (time) – Duration for holding current at amplitude. Current is zero after delay + duration.
amplitude (current) – Maximum amplitude of current
period (time) – Time period of oscillation
- 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
SineGeneratorDL#
- class neuroml.nml.nml.SineGeneratorDL(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, delay: a Nml2Quantity_time (required) = None, phase: a Nml2Quantity_none (required) = None, duration: a Nml2Quantity_time (required) = None, amplitude: a Nml2Quantity_current (required) = None, period: a Nml2Quantity_time (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
SineGeneratorDL – Dimensionless equivalent of sineGenerator . Generates a sinusoidally varying current after a time delay, for a fixed duration. The period and maximum amplitude of the current can be set as well as the phase at which to start. Scaled by weight, if set
- Parameters:
phase (none) – Phase ( between 0 and 2*pi ) at which to start the varying current ( i. e. at time given by delay )
delay (time) – Delay before change in current. Current is zero prior to this.
duration (time) – Duration for holding current at amplitude. Current is zero after delay + duration.
amplitude (none) – Maximum amplitude of current
period (time) – Time period of oscillation
- 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
Spike#
- class neuroml.nml.nml.Spike(id: a NonNegativeInteger (required) = None, time: a Nml2Quantity_time (required) = None, gds_collector_=None, **kwargs_)#
Bases:
BaseNonNegativeIntegerId
Spike – Emits a single spike at the specified time
- Parameters:
time (time) – Time at which to emit one spike event
- 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
SpikeArray#
- class neuroml.nml.nml.SpikeArray(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, spikes: list of Spike(s) (optional) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
SpikeArray – Set of spike ComponentTypes, each emitting one spike at a certain time. Can be used to feed a predetermined spike train into a cell
- 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
SpikeGenerator#
- class neuroml.nml.nml.SpikeGenerator(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, period: a Nml2Quantity_time (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
SpikeGenerator – Simple generator of spikes at a regular interval set by period
- Parameters:
period (time) – Time between spikes. The first spike will be emitted after this 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
SpikeGeneratorPoisson#
- class neuroml.nml.nml.SpikeGeneratorPoisson(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, average_rate: a Nml2Quantity_pertime (required) = None, extensiontype_=None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
SpikeGeneratorPoisson – Generator of spikes whose ISI is distributed according to an exponential PDF with scale: 1 / averageRate
- Parameters:
averageRate (per_time) – The average rate at which spikes are emitted
- 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
SpikeGeneratorRandom#
- class neuroml.nml.nml.SpikeGeneratorRandom(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, max_isi: a Nml2Quantity_time (required) = None, min_isi: a Nml2Quantity_time (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
SpikeGeneratorRandom – Generator of spikes with a random interspike interval of at least minISI and at most maxISI
- Parameters:
maxISI (time) – Maximum interspike interval
minISI (time) – Minimum interspike interval
- 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
SpikeGeneratorRefPoisson#
- class neuroml.nml.nml.SpikeGeneratorRefPoisson(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, average_rate: a Nml2Quantity_pertime (required) = None, minimum_isi: a Nml2Quantity_time (required) = None, gds_collector_=None, **kwargs_)#
Bases:
SpikeGeneratorPoisson
SpikeGeneratorRefPoisson – Generator of spikes whose ISI distribution is the maximum entropy distribution over [ minimumISI, +infinity ) with mean: 1 / averageRate
- Parameters:
minimumISI (time) – The minimum interspike interval
averageRate (per_time) – The average rate at which spikes are emitted
- 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
TimedSynapticInput#
- class neuroml.nml.nml.TimedSynapticInput(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, synapse: a NmlId (required) = None, spike_target: a string (required) = None, spikes: list of Spike(s) (optional) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
TimedSynapticInput – Spike array connected to a single synapse, producing a current triggered by each spike in the array.
- 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
TransientPoissonFiringSynapse#
- class neuroml.nml.nml.TransientPoissonFiringSynapse(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, average_rate: a Nml2Quantity_pertime (required) = None, delay: a Nml2Quantity_time (required) = None, duration: a Nml2Quantity_time (required) = None, synapse: a string (required) = None, spike_target: a string (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
TransientPoissonFiringSynapse – Poisson spike generator firing at averageRate after a delay and for a duration, connected to single synapse that is triggered every time a spike is generated, providing an input current. Similar to ComponentType poissonFiringSynapse .
- Parameters:
averageRate (per_time)
delay (time)
duration (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
VoltageClamp#
- class neuroml.nml.nml.VoltageClamp(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, delay: a Nml2Quantity_time (required) = None, duration: a Nml2Quantity_time (required) = None, target_voltage: a Nml2Quantity_voltage (required) = None, simple_series_resistance: a Nml2Quantity_resistance (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
VoltageClamp – Voltage clamp. Applies a variable current i to try to keep parent at targetVoltage. Not yet fully tested!!! Consider using voltageClampTriple!!
- Parameters:
delay (time) – Delay before change in current. Current is zero prior to this.
duration (time) – Duration for attempting to keep parent at targetVoltage. Current is zero after delay + duration.
targetVoltage (voltage) – Current will be applied to try to get parent to this target voltage
simpleSeriesResistance (resistance) – Current will be calculated by the difference in voltage between the target and parent, divided by this value
- 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
VoltageClampTriple#
- class neuroml.nml.nml.VoltageClampTriple(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, active: a ZeroOrOne (required) = None, delay: a Nml2Quantity_time (required) = None, duration: a Nml2Quantity_time (required) = None, conditioning_voltage: a Nml2Quantity_voltage (required) = None, testing_voltage: a Nml2Quantity_voltage (required) = None, return_voltage: a Nml2Quantity_voltage (required) = None, simple_series_resistance: a Nml2Quantity_resistance (required) = None, gds_collector_=None, **kwargs_)#
Bases:
Standalone
VoltageClampTriple – Voltage clamp with 3 clamp levels. Applies a variable current i ( through simpleSeriesResistance ) to try to keep parent cell at conditioningVoltage until time delay, testingVoltage until delay + duration, and returnVoltage afterwards. Only enabled if active = 1.
- Parameters:
active (none) – Whether the voltage clamp is active ( 1 ) or inactive ( 0 ).
delay (time) – Delay before switching from conditioningVoltage to testingVoltage.
duration (time) – Duration to hold at testingVoltage.
conditioningVoltage (voltage) – Target voltage before time delay
testingVoltage (voltage) – Target voltage between times delay and delay + duration
returnVoltage (voltage) – Target voltage after time duration
simpleSeriesResistance (resistance) – Current will be calculated by the difference in voltage between the target and parent, divided by this value
- 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