Nektar++
Public Member Functions | Public Attributes | Private Member Functions | List of all members
CellMLToNektar.translators.ConfigurationStore Class Reference
Inheritance diagram for CellMLToNektar.translators.ConfigurationStore:
[legend]

Public Member Functions

def __init__ (self, doc, options=None)
 
def read_configuration_file (self, config_file)
 
def finalize_config (self)
 
def find_current_vars (self)
 
def annotate_currents_for_pe (self)
 
def expose_variables (self)
 
def annotate_metadata_for_pe (self)
 
def find_transmembrane_potential (self)
 
def find_membrane_capacitance (self)
 
def find_lookup_variables (self)
 
def validate_metadata (self, assume_valid=False)
 

Public Attributes

 doc
 
 options
 
 unit_definitions
 
 V_definitions
 
 V_variable
 
 Cm_definitions
 
 Cm_variable
 
 lut_config
 
 i_stim_definitions
 
 i_stim_var
 
 i_ionic_definitions
 
 i_ionic_vars
 
 i_ionic_negated
 
 i_stim_negated
 
 dt_variable
 
 i_data_clamp_current
 
 i_data_clamp_conductance
 
 metadata_vars
 

Private Member Functions

def _create_var_def (self, content, defn_type)
 
def _check_var_def (self, var_elt, var_desc)
 
def _parse_var (self, elt, name)
 
def _parse_Vm (self, vm_elt)
 
def _parse_Cm (self, cm_elt)
 
def _parse_currents (self, currents)
 
def _find_variable (self, defn, pe_done=False)
 
def _process_ci_elts (self, elt, func, **kwargs)
 
def _find_transmembrane_currents_from_voltage_ode (self)
 
def _find_var (self, oxmeta_name, definitions)
 
def _parse_lookup_tables (self, lookup_tables)
 
def _set_lut_defaults (self, lut_dict)
 

Detailed Description

A container for configuration information, read in from XML
configuration files.  The file structure is described in the
read_configuration_file method.

Definition at line 1807 of file translators.py.

Constructor & Destructor Documentation

◆ __init__()

def CellMLToNektar.translators.ConfigurationStore.__init__ (   self,
  doc,
  options = None 
)
Create a new store.

doc specifies a CellML document, the processing of which this configuration store will affect.

If given, options should be an optparse.Values instance containing command-line options.

Definition at line 1813 of file translators.py.

1813 def __init__(self, doc, options=None):
1814 """Create a new store.
1815
1816 doc specifies a CellML document, the processing of which this configuration store will affect.
1817
1818 If given, options should be an optparse.Values instance containing command-line options.
1819 """
1820 self.doc = doc
1821 doc._cml_config = self
1822 self.options = options
1823 self.unit_definitions = cellml_component.create_new(doc.model, '*lookup_table_units*')
1824 self.unit_definitions.xml_parent = doc.model # Needed for looking up standard units
1825 # Transmembrane potential
1826 self.V_definitions = [u'membrane,V']
1827 self.V_variable = None
1828 # Membrane capacitance
1829 self.Cm_definitions = []
1830 self.Cm_variable = None
1831 # Lookup table configuration
1832 self.lut_config = {}
1833 # Ionic currents configuration
1834 self.i_stim_definitions = [u'membrane,i_Stim']
1835 self.i_stim_var = None
1836 self.i_ionic_definitions = [u'membrane,i_.*']
1837 self.i_ionic_vars = []
1838 # Whether GetIIonic will need to negate the sum of i_ionic_vars
1839 self.i_ionic_negated = False
1840 # Whether the stimulus magnitude is positive, rather than negative
1841 self.i_stim_negated = False
1842 # Other variables that may be set by other code, for example an InterfaceGenerator
1843 self.dt_variable = None
1844 self.i_data_clamp_current = None
1845 self.i_data_clamp_conductance = None
1846 return
1847

Member Function Documentation

◆ _check_var_def()

def CellMLToNektar.translators.ConfigurationStore._check_var_def (   self,
  var_elt,
  var_desc 
)
private
Check a variable definition is syntactically valid.

If type == 'name', it must have text content of the form "component_name,variable_name".
If type == 'oxmeta', it must have text content drawn from METADATA_NAMES.
If type == 'config-name', it must have text content either 'stimulus' or 'transmembrane_potential'.

Definition at line 1978 of file translators.py.

1978 def _check_var_def(self, var_elt, var_desc):
1979 """Check a variable definition is syntactically valid.
1980
1981 If type == 'name', it must have text content of the form "component_name,variable_name".
1982 If type == 'oxmeta', it must have text content drawn from METADATA_NAMES.
1983 If type == 'config-name', it must have text content either 'stimulus' or 'transmembrane_potential'.
1984 """
1985 defn_type = getattr(var_elt, u'type', u'name')
1986 if defn_type == u'name':
1987 name_parts = unicode(var_elt).strip().split(',')
1988 if len(name_parts) != 2:
1989 raise ConfigurationError('Invalid definition of ' + var_desc + ': '
1990 + unicode(var_elt))
1991 elif defn_type == u'oxmeta':
1992 if unicode(var_elt) not in cellml_metadata.METADATA_NAMES:
1993 raise ConfigurationError('"' + unicode(var_elt) + '" is not a valid oxmeta name')
1994 elif defn_type == u'config-name':
1995 if unicode(var_elt) not in [u'stimulus', u'transmembrane_potential', u'membrane_capacitance']:
1996 raise ConfigurationError('"' + unicode(var_elt) + '" is not a name known to the config file')
1997 else:
1998 raise ConfigurationError('"' + defn_type + '" is not a valid variable definition type')
1999 return
2000

Referenced by CellMLToNektar.translators.ConfigurationStore._parse_var().

◆ _create_var_def()

def CellMLToNektar.translators.ConfigurationStore._create_var_def (   self,
  content,
  defn_type 
)
private
Create a variable definition object.

Definition at line 1973 of file translators.py.

1973 def _create_var_def(self, content, defn_type):
1974 """Create a variable definition object."""
1975 xml_fragment = '<var type="%s">%s</var>' % (defn_type, content)
1976 return amara.parse(str(xml_fragment)).var
1977

Referenced by CellMLToNektar.translators.ConfigurationStore._find_var(), and CellMLToNektar.translators.ConfigurationStore.find_lookup_variables().

◆ _find_transmembrane_currents_from_voltage_ode()

def CellMLToNektar.translators.ConfigurationStore._find_transmembrane_currents_from_voltage_ode (   self)
private
Analyse the expression for dV/dt to determine the transmembrane currents.

Looks for an equation defining dV/d(something) and assumes the something is
time; this will be checked during code generation for Chaste.  It then finds
all variables on the RHS of this equation which have the same units as the
stimulus current (self.i_stim_var) and identifies these as transmembrane
currents.  Will automatically exclude the stimulus current.

If self.V_variable is not set, returns the empty list.

Definition at line 2074 of file translators.py.

2074 def _find_transmembrane_currents_from_voltage_ode(self):
2075 """Analyse the expression for dV/dt to determine the transmembrane currents.
2076
2077 Looks for an equation defining dV/d(something) and assumes the something is
2078 time; this will be checked during code generation for Chaste. It then finds
2079 all variables on the RHS of this equation which have the same units as the
2080 stimulus current (self.i_stim_var) and identifies these as transmembrane
2081 currents. Will automatically exclude the stimulus current.
2082
2083 If self.V_variable is not set, returns the empty list.
2084 """
2085 if not self.V_variable:
2086 DEBUG('config', "Transmembrane potential not configured, so can't determine currents from its ODE")
2087 return []
2088 if self.i_stim_var:
2089 current_units = [self.i_stim_var.component.get_units_by_name(self.i_stim_var.units)]
2090 else:
2091 from CellMLToNektarTranslator import CellMLToNektarTranslator
2092 current_units = CellMLToNektarTranslator.get_current_units_options(self.doc.model)
2093 ionic_vars = []
2094
2095 def find_units_match(test_units, units_list, remove_match=False, keep_only_match=False):
2096 """Look for a units definition dimensionally equivalent to test_units within units_list.
2097
2098 If remove_match is True, remove the first match from the list.
2099 If keep_only_match is True, remove all entries except the first match from the list.
2100 Return the matching units, or None if there are no matches.
2101 """
2102 for units in units_list:
2103 if test_units.dimensionally_equivalent(units):
2104 match = units
2105 break
2106 else:
2107 match = None
2108 if match and remove_match:
2109 units_list.remove(match)
2110 if match and keep_only_match:
2111 units_list[:] = [match]
2112 return match
2113
2114 def clear_values(expr, process_definitions=False):
2115 """Recursively clear saved values for variables in this expression.
2116
2117 If process_definitions is True, recursively treat expressions defining variables
2118 used in this expression, too.
2119 """
2120 def process_var(var):
2121 var.unset_values()
2122 var._unset_binding_time(only_temporary=True)
2123 if process_definitions:
2124 defn = var.get_dependencies()
2125 if defn:
2126 if isinstance(defn[0], mathml_apply):
2127 clear_values(defn[0].eq.rhs, process_definitions=True)
2128 elif isinstance(defn[0], cellml_variable):
2129 process_var(defn[0])
2130 def process_ci(ci_elt):
2131 process_var(ci_elt.variable)
2132 self._process_ci_elts(expr, process_ci)
2133
2134 def check_if_current(ci_elt, vars_found):
2135 """Check if this is a transmembrane current."""
2136 v = ci_elt.variable
2137 if v.get_source_variable(recurse=True) is not self.i_stim_var:
2138 vars_found.append(v)
2139 # Check units
2140 u = v.component.get_units_by_name(v.units)
2141 if find_units_match(u, current_units, keep_only_match=True):
2142 ionic_vars.append(v.get_source_variable(recurse=True))
2143 ionic_vars[-1]._cml_ref_in_dvdt = ci_elt # Hack for data clamp support (#2708)
2144 # Fake this variable being 1 so we can check the sign of GetIIonic
2145 if not v.is_statically_const(ignore_annotations=True):
2146 v.set_value(1.0)
2147
2148 def bfs(func, vars, *args, **kwargs):
2149 """Do a breadth first search of the definitions of variables in vars.
2150
2151 func is the recursive function to call. It will be given the list of defining expressions
2152 as its first argument, and args and kwargs as remaining arguments.
2153 """
2154 def get_defn(var):
2155 defn = var.get_dependencies()
2156 if defn:
2157 var._set_binding_time(BINDING_TIMES.static, temporary=True)
2158 if isinstance(defn[0], cellml_variable):
2159 defn = get_defn(defn[0])
2160 else:
2161 assert isinstance(defn[0], mathml_apply)
2162 var.unset_values()
2163 defn = defn[0].eq.rhs
2164 return defn
2165 defns = []
2166 for var in vars:
2167 defn = get_defn(var)
2168 if defn:
2169 defns.append(defn)
2170 if defns:
2171 func(defns, *args, **kwargs)
2172
2173 def find_currents(exprs, depth=0, maxdepth=2):
2174 """Find ionic currents by searching the given expressions.
2175
2176 On the initial call, exprs should contain just the definition of dV/dt (i.e. the RHS).
2177
2178 Uses breadth-first search of the equation dependency tree to find variables that
2179 have units dimensionally equivalent to one of the current formulations that Chaste
2180 can handle, or equivalent to the stimulus current's units if one is defined.
2181
2182 Initially, A_per_F is removed from the list, since the RHS of dV/dt should always
2183 have equivalent dimensions. If another option can't be found within maxdepth levels,
2184 we restart the search with A_per_F included. The depth limit is intended to guard against
2185 unexpectedly finding something that isn't a current; it's somewhat dodgy, but won't
2186 break on any model I know, and I haven't thought of a better approach yet.
2187
2188 When one variable with suitable units is found, further ionic currents must have units
2189 equivalent to its to be found. Also once one ionic current is found, only the remaining
2190 expressions at its depth will be processed.
2191 """
2192 if depth == 0 and maxdepth > 0:
2193 dvdt_units = exprs[0].xml_parent.eq.lhs.get_units()
2194 A_per_F = find_units_match(dvdt_units, current_units, remove_match=True)
2195# # We could do this check, but actually it doesn't catch much and later checks will pick up on the problem
2196# if A_per_F is None and not self.i_stim_var:
2197# raise ConfigurationError('Units ' + dvdt_units.description() + ' of dV/dt are not equivalent to V/s - unable to continue.')
2198 # Process all expressions at this depth
2199 vars_found = []
2200 for expr in exprs:
2201 self._process_ci_elts(expr, check_if_current, vars_found=vars_found)
2202 if not ionic_vars and depth != maxdepth:
2203 # Process the definitions of expressions at this depth
2204 bfs(find_currents, vars_found, depth+1, maxdepth)
2205 # If we reached maxdepth unsuccessfully, try again with A_per_F included (if it was an option)
2206 if not ionic_vars and depth == 0 and maxdepth > 0 and A_per_F:
2207 current_units.append(A_per_F)
2208 find_currents(exprs, depth, maxdepth=-1)
2209
2210 def assign_values_for_stimulus_check(exprs, found_stim=Sentinel()):
2211 """Assign temporary values to variables in order to check the stimulus sign.
2212
2213 This will process defining expressions in a breadth first search until the stimulus
2214 current is found. Each variable that doesn't have its definitions processed will
2215 be given a value as follows:
2216 - stimulus current = 1
2217 - other currents = 0
2218 - other variables = 1
2219 The stimulus current is then negated from the sign expected by Chaste if evaluating
2220 dV/dt gives a positive value.
2221 """
2222 assert len(current_units) == 1 # We are using the stimulus units
2223 vars = []
2224 def f(ci_elt):
2225 v = ci_elt.variable
2226 if v.get_source_variable(recurse=True) is self.i_stim_var:
2227 v.set_value(1.0)
2228 found_stim.set()
2229 else:
2230 u = v.component.get_units_by_name(v.units)
2231 if u.dimensionally_equivalent(current_units[0]):
2232 v.set_value(0.0)
2233 elif not v.is_statically_const(ignore_annotations=True):
2234 v.set_value(1.0)
2235 vars.append(v)
2236 for expr in exprs:
2237 self._process_ci_elts(expr, f)
2238 if not found_stim:
2239 bfs(assign_values_for_stimulus_check, vars, found_stim=found_stim)
2240
2241 # Iterate over all expressions in the model, to find the one for dV/d(something)
2242 for expr in (e for e in self.doc.model.get_assignments() if isinstance(e, mathml_apply) and e.is_ode()):
2243 # Assume the independent variable is time; if it isn't, we'll catch this later
2244 (dep_var, time_var) = expr.assigned_variable()
2245 if dep_var.get_source_variable(recurse=True) is self.V_variable:
2246 # Recursively search for ionic currents
2247 find_currents([expr.eq.rhs])
2248 if not ionic_vars:
2249 # The sign checks below will be nonsense in this case. An error will be raised later.
2250 break
2251 # Check the sign of the RHS
2252 self.i_ionic_negated = expr.eq.rhs.evaluate() > 0.0
2253 clear_values(expr.eq.rhs, process_definitions=True)
2254 if self.i_stim_var:
2255 # Check the sign of the stimulus current
2256 assign_values_for_stimulus_check([expr.eq.rhs])
2257 self.i_stim_negated = expr.eq.rhs.evaluate() > 0.0
2258 clear_values(expr.eq.rhs, process_definitions=True)
2259 # Found dV/d(something); don't check any more expressions
2260 break
2261 DEBUG('config', "Found ionic currents from dV/dt: ", ionic_vars)
2262 call_if(self.i_ionic_negated, DEBUG, 'config', "Ionic current is negated")
2263 call_if(self.i_stim_negated, DEBUG, 'config', "Stimulus current is negated")
2264 return ionic_vars
2265
def call_if(tf, callable, *args, **kwargs)
Definition: utilities.py:255
def DEBUG(facility, *args)
Definition: utilities.py:95
std::vector< double > d(NPUPPER *NPUPPER)

References CellMLToNektar.optimize.PartialEvaluator._process_ci_elts(), CellMLToNektar.translators.ConfigurationStore._process_ci_elts(), CellMLToNektar.utilities.call_if(), Nektar::UnitTests.d(), CellMLToNektar.utilities.DEBUG(), Nektar::LibUtilities::H5DataSource.doc, CellMLToNektar.optimize.PartialEvaluator.doc, CellMLToNektar.optimize.LookupTableAnalyser.doc, CellMLToNektar.translators.CellMLTranslator.doc, CellMLToNektar.translators.ConfigurationStore.doc, CellMLToNektar.translators.ConfigurationStore.i_ionic_negated, CellMLToNektar.translators.ConfigurationStore.i_stim_negated, CellMLToNektar.translators.ConfigurationStore.i_stim_var, and CellMLToNektar.translators.ConfigurationStore.V_variable.

Referenced by CellMLToNektar.translators.ConfigurationStore.find_current_vars().

◆ _find_var()

def CellMLToNektar.translators.ConfigurationStore._find_var (   self,
  oxmeta_name,
  definitions 
)
private
Find the variable object in the model for a particular concept.

Will look for a variable annotated with the given oxmeta_name first, then
try the list of definitions from the configuration file in turn.

Definition at line 2266 of file translators.py.

2266 def _find_var(self, oxmeta_name, definitions):
2267 """Find the variable object in the model for a particular concept.
2268
2269 Will look for a variable annotated with the given oxmeta_name first, then
2270 try the list of definitions from the configuration file in turn.
2271 """
2272 var = None
2273 # Prepend an oxmeta definition
2274 oxmeta_defn = self._create_var_def(oxmeta_name, 'oxmeta')
2275 for defn in [oxmeta_defn] + definitions:
2276 var = self._find_variable(defn)
2277 if var:
2278 break
2279 return var
2280

References CellMLToNektar.translators.ConfigurationStore._create_var_def(), and CellMLToNektar.translators.ConfigurationStore._find_variable().

Referenced by CellMLToNektar.translators.ConfigurationStore.find_membrane_capacitance(), and CellMLToNektar.translators.ConfigurationStore.find_transmembrane_potential().

◆ _find_variable()

def CellMLToNektar.translators.ConfigurationStore._find_variable (   self,
  defn,
  pe_done = False 
)
private
Find a variable matching the given definition.

If pe_done is True, then partial evaluation has been performed
on the model, so looking for variables by name needs to look for
variables called compname__varname in the single component.

Definition at line 2031 of file translators.py.

2031 def _find_variable(self, defn, pe_done=False):
2032 """Find a variable matching the given definition.
2033
2034 If pe_done is True, then partial evaluation has been performed
2035 on the model, so looking for variables by name needs to look for
2036 variables called compname__varname in the single component.
2037 """
2038 defn_type = getattr(defn, u'type', u'name')
2039 if defn_type == u'name':
2040 name_parts = unicode(defn).strip().split(',')
2041 if pe_done:
2042 try:
2043 var = self.doc.model.component.get_variable_by_name(u'__'.join(name_parts))
2044 except KeyError:
2045 var = None
2046 else:
2047 var = self.doc.model.xml_xpath(u'cml:component[@name="%s"]/cml:variable[@name="%s"]'
2048 % tuple(name_parts))
2049 if var:
2050 var = var[0]
2051 elif defn_type == u'oxmeta':
2052 var = self.doc.model.get_variable_by_oxmeta_name(str(defn), throw=False)
2053 elif defn_type == u'config-name':
2054 if unicode(defn) == u'stimulus':
2055 var = self.i_stim_var
2056 elif unicode(defn) == u'transmembrane_potential':
2057 var = self.V_variable
2058 elif unicode(defn) == u'membrane_capacitance':
2059 var = self.Cm_variable
2060 else:
2061 raise ConfigurationError('"' + str(defn) + '" is not a valid configuration file variable name')
2062 else:
2063 raise ConfigurationError('"' + defn_type + '" is not a valid variable definition type')
2064 return var
2065

References CellMLToNektar.translators.ConfigurationStore.Cm_variable, Nektar::LibUtilities::H5DataSource.doc, CellMLToNektar.optimize.PartialEvaluator.doc, CellMLToNektar.optimize.LookupTableAnalyser.doc, CellMLToNektar.translators.CellMLTranslator.doc, CellMLToNektar.translators.ConfigurationStore.doc, CellMLToNektar.translators.ConfigurationStore.i_stim_var, and CellMLToNektar.translators.ConfigurationStore.V_variable.

Referenced by CellMLToNektar.translators.ConfigurationStore._find_var(), and CellMLToNektar.translators.ConfigurationStore.find_lookup_variables().

◆ _parse_Cm()

def CellMLToNektar.translators.ConfigurationStore._parse_Cm (   self,
  cm_elt 
)
private
Parse definition of variable holding the cell membrane capacitance.

Definition at line 2019 of file translators.py.

2019 def _parse_Cm(self, cm_elt):
2020 """Parse definition of variable holding the cell membrane capacitance."""
2021 self.Cm_definitions = self._parse_var(cm_elt, 'membrane_capacitance')
2022

References CellMLToNektar.translators.ConfigurationStore._parse_var(), and CellMLToNektar.translators.ConfigurationStore.Cm_definitions.

Referenced by CellMLToNektar.translators.ConfigurationStore.read_configuration_file().

◆ _parse_currents()

def CellMLToNektar.translators.ConfigurationStore._parse_currents (   self,
  currents 
)
private
Parse definitions of ionic and stimulus currents.

Definition at line 2023 of file translators.py.

2023 def _parse_currents(self, currents):
2024 """Parse definitions of ionic and stimulus currents."""
2025 if hasattr(currents, u'stimulus'):
2026 self.i_stim_definitions = self._parse_var(currents.stimulus, 'stimulus current')
2027 if hasattr(currents, u'ionic_match'):
2028 self.i_ionic_definitions = self._parse_var(currents.ionic_match, 'ionic currents')
2029 return
2030

References CellMLToNektar.translators.ConfigurationStore._parse_var(), CellMLToNektar.translators.ConfigurationStore.i_ionic_definitions, and CellMLToNektar.translators.ConfigurationStore.i_stim_definitions.

Referenced by CellMLToNektar.translators.ConfigurationStore.read_configuration_file().

◆ _parse_lookup_tables()

def CellMLToNektar.translators.ConfigurationStore._parse_lookup_tables (   self,
  lookup_tables 
)
private
Parse a lookup_tables element.

Definition at line 2319 of file translators.py.

2319 def _parse_lookup_tables(self, lookup_tables):
2320 """Parse a lookup_tables element."""
2321 for lt in lookup_tables.lookup_table:
2322 var_type = getattr(lt.var, u'type', u'name')
2323 var_name = unicode(lt.var).strip()
2324 config_key = (var_type, var_name)
2325 if not config_key in self.lut_config:
2326 self.lut_config[config_key] = {}
2327 self._set_lut_defaults(self.lut_config[config_key])
2328 for elt in lt.xml_element_children():
2329 if elt.localName != u'var':
2330 self.lut_config[config_key]['table_' + elt.localName] = unicode(elt).strip()
2331 if hasattr(lt, u'units'):
2332 try:
2333 units = self.unit_definitions.get_units_by_name(lt.units)
2334 except KeyError:
2335 raise ConfigurationError('The units "%s" referenced by the lookup table for "%s" do not exist'
2336 % (lt.units, var_name))
2337 self.lut_config[config_key]['table_units'] = units
2338 return
2339
def get_units_by_name(self, uname)
Definition: pycml.py:2725

References CellMLToNektar.translators.ConfigurationStore._set_lut_defaults(), CellMLToNektar.pycml.get_units_by_name(), CellMLToNektar.translators.ConfigurationStore.lut_config, and CellMLToNektar.translators.ConfigurationStore.unit_definitions.

Referenced by CellMLToNektar.translators.ConfigurationStore.read_configuration_file().

◆ _parse_var()

def CellMLToNektar.translators.ConfigurationStore._parse_var (   self,
  elt,
  name 
)
private
Parse definition of a special variable.

Definition at line 2001 of file translators.py.

2001 def _parse_var(self, elt, name):
2002 """Parse definition of a special variable."""
2003 if hasattr(elt, 'var'):
2004 # List of possibilities
2005 defs = []
2006 for vardef in elt.var:
2007 self._check_var_def(vardef, name)
2008 defs.append(vardef)
2009 else:
2010 # Old style - single variable given by text content
2011 self._check_var_def(elt, name)
2012 defs = [elt]
2013 return defs
2014

References CellMLToNektar.translators.ConfigurationStore._check_var_def().

Referenced by CellMLToNektar.translators.ConfigurationStore._parse_Cm(), CellMLToNektar.translators.ConfigurationStore._parse_currents(), and CellMLToNektar.translators.ConfigurationStore._parse_Vm().

◆ _parse_Vm()

def CellMLToNektar.translators.ConfigurationStore._parse_Vm (   self,
  vm_elt 
)
private
Parse definition of variable holding the transmembrane potential.

Definition at line 2015 of file translators.py.

2015 def _parse_Vm(self, vm_elt):
2016 """Parse definition of variable holding the transmembrane potential."""
2017 self.V_definitions = self._parse_var(vm_elt, 'transmembrane_potential')
2018

References CellMLToNektar.translators.ConfigurationStore._parse_var(), and CellMLToNektar.translators.ConfigurationStore.V_definitions.

Referenced by CellMLToNektar.translators.ConfigurationStore.read_configuration_file().

◆ _process_ci_elts()

def CellMLToNektar.translators.ConfigurationStore._process_ci_elts (   self,
  elt,
  func,
**  kwargs 
)
private
Recursively apply func to any ci elements in the tree rooted at elt.

Definition at line 2066 of file translators.py.

2066 def _process_ci_elts(self, elt, func, **kwargs):
2067 """Recursively apply func to any ci elements in the tree rooted at elt."""
2068 if isinstance(elt, mathml_ci):
2069 func(elt, **kwargs)
2070 else:
2071 for child in getattr(elt, 'xml_children', []):
2072 self._process_ci_elts(child, func, **kwargs)
2073

References CellMLToNektar.optimize.PartialEvaluator._process_ci_elts(), and CellMLToNektar.translators.ConfigurationStore._process_ci_elts().

Referenced by CellMLToNektar.translators.ConfigurationStore._find_transmembrane_currents_from_voltage_ode(), CellMLToNektar.optimize.PartialEvaluator._process_ci_elts(), CellMLToNektar.translators.ConfigurationStore._process_ci_elts(), and CellMLToNektar.optimize.PartialEvaluator.is_instantiable().

◆ _set_lut_defaults()

def CellMLToNektar.translators.ConfigurationStore._set_lut_defaults (   self,
  lut_dict 
)
private
Set default configuration for a lookup table.

Definition at line 2340 of file translators.py.

2340 def _set_lut_defaults(self, lut_dict):
2341 """Set default configuration for a lookup table."""
2342 def_dict = optimize.LookupTableAnalyser._LT_DEFAULTS
2343 for k, v in def_dict.iteritems():
2344 if k != 'table_var':
2345 lut_dict[k] = v
2346 lut_dict['table_units'] = None
2347 return
2348

Referenced by CellMLToNektar.translators.ConfigurationStore._parse_lookup_tables(), and CellMLToNektar.translators.ConfigurationStore.finalize_config().

◆ annotate_currents_for_pe()

def CellMLToNektar.translators.ConfigurationStore.annotate_currents_for_pe (   self)
Annotate ionic & stimulus current vars so PE doesn't remove them.
Also annotate the membrane capacitance, if defined.

Definition at line 2349 of file translators.py.

2349 def annotate_currents_for_pe(self):
2350 """Annotate ionic & stimulus current vars so PE doesn't remove them.
2351 Also annotate the membrane capacitance, if defined."""
2352 if self.i_stim_var:
2353 self.i_stim_var.set_pe_keep(True)
2354 for var in self.i_ionic_vars:
2355 var.set_pe_keep(True)
2356 if self.Cm_variable:
2357 self.Cm_variable.set_pe_keep(True)
2358 return
2359

References CellMLToNektar.translators.ConfigurationStore.Cm_variable, CellMLToNektar.translators.ConfigurationStore.i_ionic_vars, and CellMLToNektar.translators.ConfigurationStore.i_stim_var.

◆ annotate_metadata_for_pe()

def CellMLToNektar.translators.ConfigurationStore.annotate_metadata_for_pe (   self)

Definition at line 2379 of file translators.py.

2379 def annotate_metadata_for_pe(self):
2380 "Annotate all vars tagged with metadata so PE doesn't remove them."
2381 for var in self.metadata_vars:
2382 var.set_pe_keep(True)
2383 return
2384

References CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.metadata_vars, and CellMLToNektar.translators.ConfigurationStore.metadata_vars.

◆ expose_variables()

def CellMLToNektar.translators.ConfigurationStore.expose_variables (   self)
Expose variables for access with GetAnyVariable if desired.

Definition at line 2360 of file translators.py.

2360 def expose_variables(self):
2361 """Expose variables for access with GetAnyVariable if desired."""
2362 def annotate(var):
2363 t = var.get_type()
2364 if t == VarTypes.Constant:
2365 var.set_is_modifiable_parameter(True)
2366 elif t in [VarTypes.Computed, VarTypes.Free, VarTypes.Mapped]:
2367 var.set_is_derived_quantity(True)
2368 if self.options.expose_annotated_variables:
2369 for var in self.metadata_vars:
2370 if (not self.options.use_chaste_stimulus or
2371 not var.oxmeta_name in cellml_metadata.STIMULUS_NAMES):
2372 annotate(var)
2373 DEBUG('translate', "+++ Exposed annotated variables")
2374 if self.options.expose_all_variables:
2375 for var in self.doc.model.get_all_variables():
2376 annotate(var)
2377 DEBUG('translate', "+++ Exposed all variables")
2378

References CellMLToNektar.utilities.DEBUG(), Nektar::LibUtilities::H5DataSource.doc, CellMLToNektar.optimize.PartialEvaluator.doc, CellMLToNektar.optimize.LookupTableAnalyser.doc, CellMLToNektar.translators.CellMLTranslator.doc, CellMLToNektar.translators.ConfigurationStore.doc, CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.metadata_vars, CellMLToNektar.translators.ConfigurationStore.metadata_vars, CellMLToNektar.translators.CellMLTranslator.options, and CellMLToNektar.translators.ConfigurationStore.options.

◆ finalize_config()

def CellMLToNektar.translators.ConfigurationStore.finalize_config (   self)
Having read all the configuration files, apply to the model.

Definition at line 1960 of file translators.py.

1960 def finalize_config(self):
1961 """Having read all the configuration files, apply to the model."""
1962 # If no LT options given, add defaults
1963 if not self.lut_config:
1964 config_key = ('config-name', 'transmembrane_potential')
1965 self.lut_config[config_key] = {}
1966 self._set_lut_defaults(self.lut_config[config_key])
1967 # Identify the variables in the model
1968 self.find_transmembrane_potential()
1969 self.find_membrane_capacitance()
1970 if not self.options.protocol:
1971 self.find_current_vars()
1972

References CellMLToNektar.translators.ConfigurationStore._set_lut_defaults(), CellMLToNektar.translators.ConfigurationStore.find_current_vars(), CellMLToNektar.translators.ConfigurationStore.find_membrane_capacitance(), CellMLToNektar.translators.ConfigurationStore.find_transmembrane_potential(), CellMLToNektar.translators.ConfigurationStore.lut_config, CellMLToNektar.translators.CellMLTranslator.options, and CellMLToNektar.translators.ConfigurationStore.options.

◆ find_current_vars()

def CellMLToNektar.translators.ConfigurationStore.find_current_vars (   self)
Find the variables representing currents.

Definition at line 2281 of file translators.py.

2281 def find_current_vars(self):
2282 """Find the variables representing currents."""
2283 # Find the stimulus current, if it exists for this kind of model (some are self-excitatory)
2284 if not self.doc.model.is_self_excitatory():
2285 # self.i_stim_var = self._find_var('membrane_stimulus_current', self.i_stim_definitions)
2286 # DEBUG('config', 'Found stimulus', self.i_stim_var)
2287 if not self.i_stim_var:
2288 # No match :(
2289 msg = "No stimulus current found; you'll have trouble generating Nektar code"
2290 if self.options.fully_automatic:
2291 raise ConfigurationError(msg)
2292 else:
2293 print >>sys.stderr, msg
2294 self.i_stim_var = None
2295 # For other ionic currents, try using the equation for dV/dt unless told otherwise
2296 if not self.options.use_i_ionic_regexp:
2297 self.i_ionic_vars = self._find_transmembrane_currents_from_voltage_ode()
2298 else:
2299 for defn in self.i_ionic_definitions:
2300 if getattr(defn, u'type', u'name') != u'name':
2301 raise ConfigurationError('Ionic current definitions have to have type "name"')
2302 regexps = unicode(defn).strip().split(',')
2303 comp_re = re.compile(regexps[0] + '$')
2304 var_re = re.compile(regexps[1] + '$')
2305 for component in getattr(self.doc.model, u'component', []):
2306 if comp_re.match(unicode(component.name).strip()):
2307 for var in getattr(component, u'variable', []):
2308 if (var is not self.i_stim_var and
2309 var_re.match(unicode(var.name).strip())):
2310 self.i_ionic_vars.append(var)
2311 if not self.i_ionic_vars:
2312 msg = "No ionic currents found; you'll have trouble generating Nektar code"
2313 if self.options.fully_automatic:
2314 raise ConfigurationError(msg)
2315 else:
2316 print >>sys.stderr, msg
2317 return
2318

References CellMLToNektar.translators.ConfigurationStore._find_transmembrane_currents_from_voltage_ode(), Nektar::LibUtilities::H5DataSource.doc, CellMLToNektar.optimize.PartialEvaluator.doc, CellMLToNektar.optimize.LookupTableAnalyser.doc, CellMLToNektar.translators.CellMLTranslator.doc, CellMLToNektar.translators.ConfigurationStore.doc, CellMLToNektar.translators.ConfigurationStore.i_ionic_definitions, CellMLToNektar.translators.ConfigurationStore.i_ionic_vars, CellMLToNektar.translators.ConfigurationStore.i_stim_var, CellMLToNektar.translators.CellMLTranslator.options, and CellMLToNektar.translators.ConfigurationStore.options.

Referenced by CellMLToNektar.translators.ConfigurationStore.finalize_config().

◆ find_lookup_variables()

def CellMLToNektar.translators.ConfigurationStore.find_lookup_variables (   self)
Find the variable objects used as lookup table keys.

This method translates the variable names given in the configuration file into objects
in the document, and then uses those objects as keys in our lut_config dictionary.
The ultimate source variable for the variable specified is used, in order to avoid
complications caused by intermediaries being removed (e.g. by PE).

The table settings are also units-converted to match the units of the key variable.

Definition at line 2411 of file translators.py.

2411 def find_lookup_variables(self):
2412 """Find the variable objects used as lookup table keys.
2413
2414 This method translates the variable names given in the configuration file into objects
2415 in the document, and then uses those objects as keys in our lut_config dictionary.
2416 The ultimate source variable for the variable specified is used, in order to avoid
2417 complications caused by intermediaries being removed (e.g. by PE).
2418
2419 The table settings are also units-converted to match the units of the key variable.
2420 """
2421 new_config = {}
2422 for key in self.lut_config:
2423 defn_type, content = key
2424 defn = self._create_var_def(content, defn_type)
2425 var = self._find_variable(defn)
2426 if not var:
2427 # Variable doesn't exist, so we can't index on it
2428 LOG('lookup-tables', logging.WARNING, 'Variable', content, 'not found, so not using as table index.')
2429 else:
2430 var = var.get_source_variable(recurse=True)
2431 if not var in new_config:
2432 new_config[var] = {}
2433 new_config[var].update(self.lut_config[key])
2434 # Apply units conversions to the table settings if required
2435 table_units = new_config[var]['table_units']
2436 if table_units:
2437 var_units = var.get_units()
2438 if not table_units.dimensionally_equivalent(var_units):
2439 LOG('lookup-tables', logging.WARNING, 'Variable', content, 'is in units', var_units.description(),
2440 'which are incompatible with', table_units.description(), 'so not using as table index.')
2441 elif not table_units.equals(var_units):
2442 # New setting[var_units] = m[var_units/table_units]*(setting-o1[table_units]) + o2[var_units]
2443 # c.f. mathml_units_mixin._add_units_conversion
2444 print 'LT conversion:', table_units.description(), 'to', var_units.description(), 'equal?', table_units.equals(var_units)
2445 m = table_units.get_multiplicative_factor() / var_units.get_multiplicative_factor()
2446 for setting in new_config[var]:
2447 try:
2448 old_value = float(new_config[var][setting])
2449 new_value = m * (old_value - table_units.get_offset()) + var_units.get_offset()
2450 new_config[var][setting] = unicode(new_value)
2451 print 'LT conversion', setting, old_value, new_value
2452 except (ValueError, TypeError):
2453 pass
2454 self.lut_config = new_config
2455 DEBUG('config', 'Lookup tables configuration:', new_config)
2456 return
2457
def LOG(facility, level, *args)
Definition: utilities.py:105

References CellMLToNektar.translators.ConfigurationStore._create_var_def(), CellMLToNektar.translators.ConfigurationStore._find_variable(), CellMLToNektar.utilities.DEBUG(), CellMLToNektar.utilities.LOG(), and CellMLToNektar.translators.ConfigurationStore.lut_config.

◆ find_membrane_capacitance()

def CellMLToNektar.translators.ConfigurationStore.find_membrane_capacitance (   self)
Find and store the variable object representing the cell membrane capacitance.

Uses first metadata, if present, then the configuration file.

Definition at line 2404 of file translators.py.

2404 def find_membrane_capacitance(self):
2405 """Find and store the variable object representing the cell membrane capacitance.
2406
2407 Uses first metadata, if present, then the configuration file."""
2408 self.Cm_variable = self._find_var('membrane_capacitance', self.Cm_definitions)
2409 DEBUG('config', 'Found capacitance', self.Cm_variable)
2410

References CellMLToNektar.translators.ConfigurationStore._find_var(), CellMLToNektar.translators.ConfigurationStore.Cm_definitions, CellMLToNektar.translators.ConfigurationStore.Cm_variable, and CellMLToNektar.utilities.DEBUG().

Referenced by CellMLToNektar.translators.ConfigurationStore.finalize_config().

◆ find_transmembrane_potential()

def CellMLToNektar.translators.ConfigurationStore.find_transmembrane_potential (   self)
Find and store the variable object representing V.

Tries metadata annotation first.  If that fails, uses the name given in
the command line options, if present.  If that fails, uses the config file.

Definition at line 2385 of file translators.py.

2385 def find_transmembrane_potential(self):
2386 """Find and store the variable object representing V.
2387
2388 Tries metadata annotation first. If that fails, uses the name given in
2389 the command line options, if present. If that fails, uses the config file.
2390 """
2391 if not self.options:
2392 raise ValueError('No command line options given')
2393 # Check command line option before config file
2394 if self.options.transmembrane_potential:
2395 self.V_definitions[0:0] = [self.options.transmembrane_potential.strip().split(',')]
2396 if len(self.V_definitions[0]) != 2:
2397 raise ConfigurationError('The name of V must contain both component and variable name')
2398 self.V_variable = self._find_var('membrane_voltage', self.V_definitions)
2399 DEBUG('config', 'Found V', self.V_variable)
2400 if not self.V_variable and not self.options.protocol:
2401 raise ConfigurationError('No transmembrane potential found; check your configuration')
2402 return self.V_variable
2403

References CellMLToNektar.translators.ConfigurationStore._find_var(), CellMLToNektar.utilities.DEBUG(), CellMLToNektar.translators.CellMLTranslator.options, CellMLToNektar.translators.ConfigurationStore.options, CellMLToNektar.translators.ConfigurationStore.V_definitions, and CellMLToNektar.translators.ConfigurationStore.V_variable.

Referenced by CellMLToNektar.translators.ConfigurationStore.finalize_config().

◆ read_configuration_file()

def CellMLToNektar.translators.ConfigurationStore.read_configuration_file (   self,
  config_file 
)
Read configuration stored in config_file.

The configuration file is expected to be XML, conforming to
the following structure.  Currently little checking is done on
the file format; incorrectly formatted files are unlikely to
give particularly helpful error messages.

The root element may contain a 'global' element, giving global
configuration options.  These include:

 * 'lookup_tables'
   Contains one or more 'lookup_table' elements, one for each
   type of lookup table available.  These contain (a selection of)
   the elements:
   * 'var' - the variable to key on.  The component name given
     should be that from which the variable is exported.  Must be
     present.
   * 'min', 'max', 'step' - table bounds parameters.  Optional.
   Default values are used for parameters that are not present.
 * 'currents'
   Defines which variables hold the ionic and stimulus currents,
   if any.  It contains 2 elements:
   * 'stimulus' - the full name of the stimulus current variable
   * 'ionic_match' - a regular expression matching full names of
     ionic current variables.  It may also match the stimulus
     current, but the stimulus will never be considered an ionic
     current.  The value is split on ','; the first part is then
     matched against component names, and the second against
     variables in matching components.
     
     This is mostly redundant now, because the equation for dV/dt
     is used first to determine the ionic currents (see documentation
     for _find_transmembrane_currents_from_voltage_ode), and only
     if this fails to find suitable currents will the ionic_match
     definition be used.
 * 'transmembrane_potential'
   Defines which variable holds the transmembrane potential.
   Defaults to 'membrane,V' if not present.
 * 'membrane_capacitance'
   Defines which variable holds the cell membrane capacitance.
   
The root element also contains 0 or more 'for_model' elements,
which contain settings for individual models.  These must have
at least one of an 'id' or 'name' attribute, which specify the
model in question.  They can also contain anything allowable as
global configuration options.  Options given here override those
specified globally.

Configuration which is identical for groups of models may be given
using the 'for_models' element.  This has an 'ids' element as its
first child, which contains 'id' elements holding either the name
or id of a model.  The remaining contents of the 'for_models'
element are as for 'for_model'.

There are 3 ways of specifying variables:
1. By name (var type='name')
   Variable names are given in full form, i.e. component_name,variable_name
2. By standardised name (var type='oxmeta')
   Use the name from the oxmeta annotations
3. By reference to a section of the config file (when defining lookup table keys)
   e.g. <var type='config-name'>transmembrane_potential</var>

Within any element that specifies a variable, a list of <var> elements can be
provided.  Each will be tried in turn to see if a match can be found in the model,
and the first match wins.

Some items are overridden if oxmeta annotations are present in the model, with
the annotated variable taking precedence over the config file specification.

Definition at line 1848 of file translators.py.

1848 def read_configuration_file(self, config_file):
1849 """Read configuration stored in config_file.
1850
1851 The configuration file is expected to be XML, conforming to
1852 the following structure. Currently little checking is done on
1853 the file format; incorrectly formatted files are unlikely to
1854 give particularly helpful error messages.
1855
1856 The root element may contain a 'global' element, giving global
1857 configuration options. These include:
1858
1859 * 'lookup_tables'
1860 Contains one or more 'lookup_table' elements, one for each
1861 type of lookup table available. These contain (a selection of)
1862 the elements:
1863 * 'var' - the variable to key on. The component name given
1864 should be that from which the variable is exported. Must be
1865 present.
1866 * 'min', 'max', 'step' - table bounds parameters. Optional.
1867 Default values are used for parameters that are not present.
1868 * 'currents'
1869 Defines which variables hold the ionic and stimulus currents,
1870 if any. It contains 2 elements:
1871 * 'stimulus' - the full name of the stimulus current variable
1872 * 'ionic_match' - a regular expression matching full names of
1873 ionic current variables. It may also match the stimulus
1874 current, but the stimulus will never be considered an ionic
1875 current. The value is split on ','; the first part is then
1876 matched against component names, and the second against
1877 variables in matching components.
1878
1879 This is mostly redundant now, because the equation for dV/dt
1880 is used first to determine the ionic currents (see documentation
1881 for _find_transmembrane_currents_from_voltage_ode), and only
1882 if this fails to find suitable currents will the ionic_match
1883 definition be used.
1884 * 'transmembrane_potential'
1885 Defines which variable holds the transmembrane potential.
1886 Defaults to 'membrane,V' if not present.
1887 * 'membrane_capacitance'
1888 Defines which variable holds the cell membrane capacitance.
1889
1890 The root element also contains 0 or more 'for_model' elements,
1891 which contain settings for individual models. These must have
1892 at least one of an 'id' or 'name' attribute, which specify the
1893 model in question. They can also contain anything allowable as
1894 global configuration options. Options given here override those
1895 specified globally.
1896
1897 Configuration which is identical for groups of models may be given
1898 using the 'for_models' element. This has an 'ids' element as its
1899 first child, which contains 'id' elements holding either the name
1900 or id of a model. The remaining contents of the 'for_models'
1901 element are as for 'for_model'.
1902
1903 There are 3 ways of specifying variables:
1904 1. By name (var type='name')
1905 Variable names are given in full form, i.e. component_name,variable_name
1906 2. By standardised name (var type='oxmeta')
1907 Use the name from the oxmeta annotations
1908 3. By reference to a section of the config file (when defining lookup table keys)
1909 e.g. <var type='config-name'>transmembrane_potential</var>
1910
1911 Within any element that specifies a variable, a list of <var> elements can be
1912 provided. Each will be tried in turn to see if a match can be found in the model,
1913 and the first match wins.
1914
1915 Some items are overridden if oxmeta annotations are present in the model, with
1916 the annotated variable taking precedence over the config file specification.
1917 """
1918 DEBUG('config', "Reading configuration from ", config_file)
1919 binder = amara.bindery.binder()
1920 binder.set_binding_class(None, "units", cellml_units)
1921 binder.set_binding_class(None, "unit", cellml_unit)
1922 rules = [bt.ws_strip_element_rule(u'*')]
1923 config_doc = amara_parse(config_file, rules=rules, binderobj=binder)
1924 # Store extra units definitions
1925 for defn in config_doc.xml_xpath(u'/*/units'):
1926 defn.xml_parent = self.unit_definitions # Needed for looking up the units this definition is derived from
1927 self.unit_definitions.add_units(defn.name, defn)
1928 # Overrides for command-line options
1929 if self.options and hasattr(config_doc.pycml_config, 'command_line_args'):
1930 args = map(str, config_doc.pycml_config.command_line_args.arg)
1931 args.append('dummy-file')
1932 get_options(args, self.options)
1933 # Sections to use in configuration; later sections take precedence
1934 sections = []
1935 # Use global configuration?
1936 glo = config_doc.xml_xpath(u'/*/global')
1937 if glo:
1938 sections.append(glo[0])
1939 # Get the config section(s) for our model. Sections
1940 # specifically for this model come after sections covering
1941 # multiple models, so they take precedence.
1942 model_id = getattr(self.doc.model, u'id', self.doc.model.name)
1943 sections.extend(config_doc.xml_xpath(
1944 u'/*/for_models[ids/id="%s" or ids/id="%s"]'
1945 % (self.doc.model.name, model_id)))
1946 sections.extend(config_doc.xml_xpath(
1947 u'/*/for_model[@name="%s" or @id="%s"]'
1948 % (self.doc.model.name, model_id)))
1949 # Main items of configuration
1950 for section in sections:
1951 if hasattr(section, u'lookup_tables'):
1952 self._parse_lookup_tables(section.lookup_tables)
1953 if hasattr(section, u'currents'):
1954 self._parse_currents(section.currents)
1955 if hasattr(section, u'transmembrane_potential'):
1956 self._parse_Vm(section.transmembrane_potential)
1957 if hasattr(section, u'membrane_capacitance'):
1958 self._parse_Cm(section.membrane_capacitance)
1959
def get_options(args, default_options=None)
def amara_parse(source, uri=None, rules=None, binderobj=None, prefixes=None)
Definition: utilities.py:192

References CellMLToNektar.translators.ConfigurationStore._parse_Cm(), CellMLToNektar.translators.ConfigurationStore._parse_currents(), CellMLToNektar.translators.ConfigurationStore._parse_lookup_tables(), CellMLToNektar.translators.ConfigurationStore._parse_Vm(), CellMLToNektar.utilities.amara_parse(), CellMLToNektar.utilities.DEBUG(), Nektar::LibUtilities::H5DataSource.doc, CellMLToNektar.optimize.PartialEvaluator.doc, CellMLToNektar.optimize.LookupTableAnalyser.doc, CellMLToNektar.translators.CellMLTranslator.doc, CellMLToNektar.translators.ConfigurationStore.doc, CellMLToNektar.translators.get_options(), CellMLToNektar.translators.CellMLTranslator.options, CellMLToNektar.translators.ConfigurationStore.options, and CellMLToNektar.translators.ConfigurationStore.unit_definitions.

◆ validate_metadata()

def CellMLToNektar.translators.ConfigurationStore.validate_metadata (   self,
  assume_valid = False 
)
Check that the metadata annotations are 'sensible'.

Ensures that only names we know are used, and that the same name isn't used for multiple variables.

Definition at line 2459 of file translators.py.

2459 def validate_metadata(self, assume_valid=False):
2460 """Check that the metadata annotations are 'sensible'.
2461
2462 Ensures that only names we know are used, and that the same name isn't used for multiple variables.
2463 """
2464 vars = cellml_metadata.find_variables(self.doc.model, ('bqbiol:is', NSS['bqbiol']))
2465 self.metadata_vars = filter(lambda v: v.oxmeta_name, vars)
2466 if assume_valid:
2467 return
2468 names_used = [var.oxmeta_name for var in self.metadata_vars]
2469 DEBUG('metadata', 'Names found: ', names_used)
2470 # Check all metadata is allowed
2471 unknown_names = frozenset(names_used) - cellml_metadata.METADATA_NAMES
2472 if unknown_names:
2473 msg = ['Unrecognised oxmeta variable names found (run with --assume-valid to ignore):']
2474 msg.extend(sorted(unknown_names))
2475 raise ConfigurationError('\n '.join(msg))
2476 # Check for duplicates
2477 d = {}
2478 for name in names_used:
2479 if name in d:
2480 raise ConfigurationError(name + ' metadata attribute is duplicated in the cellml file.')
2481 else:
2482 d[name] = name
2483
2484

References Nektar::LibUtilities::H5DataSource.doc, CellMLToNektar.optimize.PartialEvaluator.doc, CellMLToNektar.optimize.LookupTableAnalyser.doc, CellMLToNektar.translators.CellMLTranslator.doc, and CellMLToNektar.translators.ConfigurationStore.doc.

Member Data Documentation

◆ Cm_definitions

CellMLToNektar.translators.ConfigurationStore.Cm_definitions

◆ Cm_variable

CellMLToNektar.translators.ConfigurationStore.Cm_variable

◆ doc

CellMLToNektar.translators.ConfigurationStore.doc

Definition at line 1820 of file translators.py.

Referenced by CellMLToNektar.optimize.LookupTableAnalyser._determine_duplicate_tables(), CellMLToNektar.optimize.LookupTableAnalyser._determine_unneeded_tables(), CellMLToNektar.optimize.PartialEvaluator._do_reduce_eval_loop(), CellMLToNektar.optimize.LookupTableAnalyser._find_tables(), CellMLToNektar.translators.ConfigurationStore._find_transmembrane_currents_from_voltage_ode(), CellMLToNektar.translators.ConfigurationStore._find_variable(), CellMLToNektar.optimize.PartialEvaluator._get_assignment_exprs(), CellMLToNektar.optimize.LookupTableAnalyser.analyse_model(), CellMLToNektar.optimize.LookupTableAnalyser.annotate_as_suitable(), CellMLToNektar.optimize.LookupTableAnalyser.config(), CellMLToNektar.translators.CellMLTranslator.config(), CellMLToNektar.translators.ConfigurationStore.expose_variables(), CellMLToNektar.translators.ConfigurationStore.find_current_vars(), CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.get_stimulus_assignment(), CellMLToNektar.optimize.PartialEvaluator.is_instantiable(), CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.lut_parameters(), CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.output_backward_euler_mathematics(), CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.output_constructor(), CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.output_derived_quantities(), CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.output_equations(), CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.output_get_i_ionic(), CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.output_intracellular_calcium(), CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.output_lut_class(), CellMLToNektar.translators.CellMLTranslator.output_lut_declarations(), CellMLToNektar.translators.CellMLTranslator.output_lut_deletion(), CellMLToNektar.translators.CellMLTranslator.output_lut_generation(), CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.output_lut_indexing_methods(), CellMLToNektar.translators.CellMLTranslator.output_lut_indices(), CellMLToNektar.translators.CellMLTranslator.output_lut_methods(), CellMLToNektar.translators.CellMLTranslator.output_lut_row_lookup_memory(), CellMLToNektar.translators.CellMLTranslator.output_lut_row_lookup_methods(), CellMLToNektar.CellMLToNektarTranslator.CellMLToNektarTranslator.output_rush_larsen_mathematics(), CellMLToNektar.translators.CellMLTranslator.output_table_index_generation(), CellMLToNektar.translators.ConfigurationStore.read_configuration_file(), CellMLToNektar.optimize.LookupTableAnalyser.remove_lut_annotations(), CellMLToNektar.translators.CellMLTranslator.scan_for_lookup_tables(), and CellMLToNektar.translators.ConfigurationStore.validate_metadata().

◆ dt_variable

CellMLToNektar.translators.ConfigurationStore.dt_variable

Definition at line 1843 of file translators.py.

◆ i_data_clamp_conductance

CellMLToNektar.translators.ConfigurationStore.i_data_clamp_conductance

Definition at line 1845 of file translators.py.

◆ i_data_clamp_current

CellMLToNektar.translators.ConfigurationStore.i_data_clamp_current

Definition at line 1844 of file translators.py.

◆ i_ionic_definitions

CellMLToNektar.translators.ConfigurationStore.i_ionic_definitions

◆ i_ionic_negated

CellMLToNektar.translators.ConfigurationStore.i_ionic_negated

◆ i_ionic_vars

CellMLToNektar.translators.ConfigurationStore.i_ionic_vars

◆ i_stim_definitions

CellMLToNektar.translators.ConfigurationStore.i_stim_definitions

◆ i_stim_negated

CellMLToNektar.translators.ConfigurationStore.i_stim_negated

◆ i_stim_var

CellMLToNektar.translators.ConfigurationStore.i_stim_var

◆ lut_config

CellMLToNektar.translators.ConfigurationStore.lut_config

◆ metadata_vars

CellMLToNektar.translators.ConfigurationStore.metadata_vars

◆ options

CellMLToNektar.translators.ConfigurationStore.options

◆ unit_definitions

CellMLToNektar.translators.ConfigurationStore.unit_definitions

◆ V_definitions

CellMLToNektar.translators.ConfigurationStore.V_definitions

◆ V_variable

CellMLToNektar.translators.ConfigurationStore.V_variable