Definition at line 4145 of file pycml.py.
◆ __init__()
def CellMLToNektar.pycml.mathml_cn.__init__ |
( |
|
self | ) |
|
Definition at line 4146 of file pycml.py.
4148 self._cml_units =
None
◆ _get_binding_time()
def CellMLToNektar.pycml.mathml_cn._get_binding_time |
( |
|
self | ) |
|
|
private |
◆ _reduce()
def CellMLToNektar.pycml.mathml_cn._reduce |
( |
|
self | ) |
|
|
private |
Reduce this expression by evaluating its static parts.
Is actually a no-op; we must have been annotated explicitly as dynamic.
Definition at line 4193 of file pycml.py.
4194 """Reduce this expression by evaluating its static parts. 4196 Is actually a no-op; we must have been annotated explicitly as dynamic.
◆ create_new()
def CellMLToNektar.pycml.mathml_cn.create_new |
( |
|
elt, |
|
|
|
value, |
|
|
|
units |
|
) |
| |
|
static |
Create a new <cn> element with the given value and units.
Definition at line 4211 of file pycml.py.
4212 """Create a new <cn> element with the given value and units.""" 4213 attrs = {(
u'cml:units', NSS[
u'cml']): unicode(units)}
4214 new_elt = elt.xml_create_element(
u'cn', NSS[
u'm'],
4216 content=unicode(value))
def create_new(parent, name, bases, add_to_parent=False, standard=False)
◆ evaluate()
def CellMLToNektar.pycml.mathml_cn.evaluate |
( |
|
self | ) |
|
Convert the text content of this element to a floating point
value and return it. Will handle the type attribute and, if
relevant to the type, the sep child element, but does not yet
handle the base attribute.
Definition at line 4151 of file pycml.py.
Referenced by CellMLToNektar.pycml.mathml_constructor._eval_self(), and CellMLToNektar.pycml.mathml_ci._reduce().
4153 Convert the text content of this element to a floating point 4154 value and return it. Will handle the type attribute and, if 4155 relevant to the type, the sep child element, but does not yet 4156 handle the base attribute. 4158 if hasattr(self,
u'base'):
4159 raise ValueError(
'pycml does not yet support the base attribute on cn elements')
4160 if hasattr(self,
u'type'):
4161 if self.type ==
u'real':
4162 val = float(unicode(self))
4163 elif self.type ==
u'integer':
4164 val = int(unicode(self))
4165 elif self.type ==
u'e-notation':
4166 assert len(self.xml_children) == 3
4167 assert self.xml_children[1]
is self.sep
4168 mantissa = unicode(self.xml_children[0]).strip()
4169 exponent = unicode(self.xml_children[2]).strip()
4170 val = float(mantissa +
'e' + exponent)
4171 elif self.type ==
u'rational':
4172 assert len(self.xml_children) == 3
4173 assert self.xml_children[1]
is self.sep
4174 numer = int(unicode(self.xml_children[0]))
4175 denom = int(unicode(self.xml_children[2]))
4178 raise ValueError(
'Unsupported type attribute for cn element: ' 4181 val = float(unicode(self))
◆ get_units()
def CellMLToNektar.pycml.mathml_cn.get_units |
( |
|
self, |
|
|
|
return_set = True |
|
) |
| |
◆ _cml_units
CellMLToNektar.pycml.mathml_cn._cml_units |
|
private |
◆ type
CellMLToNektar.pycml.mathml_cn.type |