Support of parameters of non-numeric type in map, filter and reduce
Map does not accept non-numerical types for its parameter:
orr1 = Reaction M + O2 + 0.5 H2 = MOOH: ((free_energy: 1.23) [eV])
orr = (reactions: orr1)
H2 = Species H2
O2 = Species O2
M = Species M
MOOH = Species MOOH
orr_free_energies = map((r: r.free_energy), orr) # test if subscriptions work in map with lambda
print(orr_free_energies)
Here, orr
is a Series
of Reaction
type.
I get this error:
Traceback (most recent call last):
File "vre-language/src/virtmat/language/utilities/errors.py", line 91, in wrapper
return func(*args, **kwargs)
File "../scripts/run_model.py", line 54, in run_instant_deferred
return meta.model_from_file(clargs.model_file, deferred_mode=deferred,
File "jupyter-tensorflow-2023-01-02/lib64/python3.8/site-packages/textx/metamodel.py", line 658, in model_from_file
return self.internal_model_from_file(
File "jupyter-tensorflow-2023-01-02/lib64/python3.8/site-packages/textx/metamodel.py", line 712, in internal_model_from_file
p(model, self)
File "vre-language/src/virtmat/language/constraints/typechecks.py", line 59, in check_types_processor
_ = obj.type_
File "/usr/lib64/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/constraints/typechecks.py", line 105, in variable_type
return self.parameter.type_
File "/usr/lib64/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/constraints/typechecks.py", line 666, in map_type
assert issubclass(datatype, (bool, str, int, float))
AssertionError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "../scripts/run_model.py", line 96, in <module>
main()
File "../scripts/run_model.py", line 86, in main
prog = run_instant_deferred(clargs, deferred=False)
File "vre-language/src/virtmat/language/utilities/errors.py", line 96, in wrapper
raise RuntimeError('non-handled exception') from err
RuntimeError: non-handled exception