Non-handled exception when the units in view statement in wrong order
Input:
prop_data = ((temperature: 0.0, 100.0) [kelvin], (time: 0.0, 1.0) [ps])
view lineplot (prop_data, 'time', 'temperature', (units: 'fs', 'K'))
Error output:
Traceback (most recent call last):
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/utilities/errors.py", line 305, in wrapper
return func(*args, **kwargs)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/metamodel/view.py", line 167, in display
display_seaborn(self, show=show)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/metamodel/view.py", line 74, in display_seaborn
tab = convert_df_units(tab, units)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/utilities/units.py", line 58, in convert_df_units
columns.append(df[col].pint.to(unit))
File "python-3.10.12/lib/python3.10/site-packages/pint_pandas/pint_array.py", line 1226, in delegated_method
result = method(*args, **kwargs)
File "python-3.10.12/lib/python3.10/site-packages/pint/facets/plain/quantity.py", line 536, in to
magnitude = self._convert_magnitude_not_inplace(other, *contexts, **ctx_kwargs)
File "python-3.10.12/lib/python3.10/site-packages/pint/facets/plain/quantity.py", line 480, in _convert_magnitude_not_inplace
return self._REGISTRY.convert(self._magnitude, self._units, other)
File "python-3.10.12/lib/python3.10/site-packages/pint/facets/plain/registry.py", line 1050, in convert
return self._convert(value, src, dst, inplace)
File "python-3.10.12/lib/python3.10/site-packages/pint/facets/context/registry.py", line 405, in _convert
return super()._convert(value, src, dst, inplace)
File "python-3.10.12/lib/python3.10/site-packages/pint/facets/nonmultiplicative/registry.py", line 259, in _convert
return super()._convert(value, src, dst, inplace)
File "python-3.10.12/lib/python3.10/site-packages/pint/facets/plain/registry.py", line 1085, in _convert
raise factor
pint.errors.DimensionalityError: Cannot convert from 'kelvin' ([temperature]) to 'femtosecond' ([time])
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/utilities/errors.py", line 305, in wrapper
return func(*args, **kwargs)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/interpreter/session_manager.py", line 121, in get_model_value
return getattr(self.session.get_model(*args, uuid=self.uuid, **kwargs), 'value', '')
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/interpreter/session.py", line 150, in get_model
self.process_models(model_str, model_path)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/interpreter/session.py", line 232, in process_models
model, uuid = self._process_model(uuid, *args)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/interpreter/session.py", line 578, in _process_model
model = tx_get_model(model_src, deferred_mode=True,
File "python-3.10.12/lib/python3.10/site-packages/textx/metamodel.py", line 716, in model_from_str
p(model, self)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/metamodel/view.py", line 191, in view_processor
view.display(show=show)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/utilities/errors.py", line 340, in wrapper
raise RuntimeError('non-handled exception') from err
RuntimeError: non-handled exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/utilities/errors.py", line 305, in wrapper
return func(*args, **kwargs)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/interpreter/session_manager.py", line 168, in process_input
output = self.get_model_value(model_str=input_str)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/utilities/errors.py", line 340, in wrapper
raise RuntimeError('non-handled exception') from err
RuntimeError: non-handled exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/utilities/errors.py", line 305, in wrapper
return func(*args, **kwargs)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/cli/run_session.py", line 93, in main
mgr.main_loop()
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/interpreter/session_manager.py", line 137, in main_loop
if self.process_input(input_str):
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/utilities/errors.py", line 340, in wrapper
raise RuntimeError('non-handled exception') from err
RuntimeError: non-handled exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "python-3.10.12/bin/texts", line 8, in <module>
sys.exit(texts())
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/cli/__init__.py", line 28, in texts
clargs.func(clargs)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/utilities/errors.py", line 340, in wrapper
raise RuntimeError('non-handled exception') from err
RuntimeError: non-handled exception
Edited by Ivan Kondov