glotaran / pyglotaran

A Python library for Global and Target Analysis of time-resolved spectroscopy data
GNU Lesser General Public License v3.0
53 stars 18 forks source link

Error in Model.py 🐛 #1399

Closed luccablois closed 11 months ago

luccablois commented 11 months ago

Version information

Describe the bug

I built my model.yaml file but i keep getting an error arrising from Model.py:

File :40 in init self.dataset = __attr_converter_dataset(dataset)

File ~.conda\envs\spyder-env\Lib\site-packages\glotaran\model\model.py:193 in converter=lambda value: _load_model_items_from_dict(item_type, value),

File ~.conda\envs\spyder-env\Lib\site-packages\glotaran\model\model.py:112 in _load_model_items_from_dict return {

File ~.conda\envs\spyder-env\Lib\site-packages\glotaran\model\model.py:113 in label: _load_item_from_dict(item_type, value, extra={"label": label}) # type:ignore[misc]

File ~.conda\envs\spyder-env\Lib\site-packages\glotaran\model\model.py:86 in _load_item_from_dict value = value | extra

TypeError: unsupported operand type(s) for |: 'NoneType' and 'dict'

#

Screenshots

Here is what i have done up to now:

image

and my model.yaml file:

image

I managed to get a SVD for 5 decay constants, but this error in model.py keeps getting in the way. I tried removing the "| extra" part in the model.py file but it did not work so i restored it to the original version.

I would apreciate any help whatsoever

Best regards Lucca

s-weigand commented 11 months ago

Yaml is an indentation-sensitive language and the definition of dataset1 is not properly indented.

dataset:
-   dataset1:
-   initial_concentration: input
-   megacomplex: [m1]
-   irf: irf1
+   dataset1:
+     initial_concentration: input
+     megacomplex: [m1]
+     irf: irf1

We are working on a rewrite for the 0.8.0 release which will add proper editor support for model files via the yaml language server and json schema, so those kinds of errors can be quickly spotted. In addition, the new version will have a lot better parsing error handling.

Hope that helps

luccablois commented 11 months ago

It solved, thanks, did not pay attention to that!