NeuroMLCoreCompTypes#
This documentation is auto-generated from the NeuroML schema.
Annotation#
- class neuroml.nml.nml.Annotation(anytypeobjs_=None, gds_collector_=None, **kwargs_)#
Bases:
BaseWithoutId
Annotation – A structured annotation containing metadata, specifically RDF or property elements
- 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
Point3DWithDiam#
- class neuroml.nml.nml.Point3DWithDiam(x: a double (required) = None, y: a double (required) = None, z: a double (required) = None, diameter: a DoubleGreaterThanZero (required) = None, gds_collector_=None, **kwargs_)#
Bases:
BaseWithoutId
Point3DWithDiam – Base type for ComponentTypes which specify an ( x, y, z ) coordinate along with a diameter. Note: no dimension used in the attributes for these coordinates! These are assumed to have dimension micrometer ( 10^-6 m ). This is due to micrometers being the default option for the majority of neuronal morphology formats, and dimensions are omitted here to facilitate reading and writing of morphologies in NeuroML.
- Parameters:
x (none) – x coordinate of the point. Note: no dimension used, see description of point3DWithDiam for details.
y (none) – y coordinate of the ppoint. Note: no dimension used, see description of point3DWithDiam for details.
z (none) – z coordinate of the ppoint. Note: no dimension used, see description of point3DWithDiam for details.
diameter (none) – Diameter of the ppoint. Note: no dimension used, see description of point3DWithDiam for details.
- 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
- distance_to(other_3d_point) float #
Find the distance between this point and another.
- Parameters:
other_3d_point (Point3DWithDiam) – other 3D point to calculate distance to
- Returns:
distance between the two points
- Return type:
float
- 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
Property#
- class neuroml.nml.nml.Property(tag: a string (required) = None, value: a string (required) = None, gds_collector_=None, **kwargs_)#
Bases:
BaseWithoutId
Property – A property ( a tag and value pair ), which can be on any baseStandalone either as a direct child, or within an Annotation . Generally something which helps the visual display or facilitates simulation of a Component, but is not a core physiological property. Common examples include: numberInternalDivisions, equivalent of nseg in NEURON; radius, for a radius to use in graphical displays for abstract cells ( i. e. without defined morphologies ); color, the color to use for a Population or populationList of cells; recommended_dt_ms, the recommended timestep to use for simulating a Network , recommended_duration_ms the recommended duration to use when running a Network
- 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