glotaran/pyglotaran

[staging] ๐Ÿ› Use of clp_relations results crashes with multiple datasets

jsnel opened this issue ยท 3 comments

jsnel commented

Version information

  • pyglotaran version: staging
  • Python version: 3.10

Describe the bug

It was observed that the use of clp_relations crashes the result creation post optimization

  • if clp labels are not present in all datasets (e.g. clp guide)
  • if multiple datasets are involved

To Reproduce

Optimize a scheme with more than 1 dataset (which can also be a clp_guide) and which contains clp_relations

Steps to reproduce the behavior:

  1. Run tmp_debug_2d_ta.py

  2. See error

Traceback (most recent call last):
  File "pyglotaran_porting_examples\examples\case_studies\02-transient_absorption\tmp_debug_2d_ta.py", line 53, in <module>
    result = optimize(scheme, parameters)
  File "pyglotaran_porting_examples\examples\case_studies\02-transient_absorption\tmp_debug_2d_ta.py", line 31, in optimize
    return scheme.optimize(parameters=parameters, maximum_number_function_evaluations=7)
  File "pyglotaran_porting_examples\glotaran\project\scheme.py", line 79, in optimize
    optimization.dry_run() if dry_run else optimization.run()
  File "pyglotaran_porting_examples\glotaran\optimization\optimization.py", line 138, in run
    data = dict(ChainMap(*[o.get_result() for o in self._objectives]))
  File "pyglotaran_porting_examples\glotaran\optimization\optimization.py", line 138, in <listcomp>
    data = dict(ChainMap(*[o.get_result() for o in self._objectives]))
  File "pyglotaran_porting_examples\glotaran\optimization\objective.py", line 95, in get_result
    else self.create_linked_result()
  File "pyglotaran_porting_examples\glotaran\optimization\objective.py", line 277, in create_linked_result
    estimations = self.resolve_estimations(
  File "pyglotaran_porting_examples\glotaran\optimization\objective.py", line 58, in resolve_estimations
    return [
  File "pyglotaran_porting_examples\glotaran\optimization\objective.py", line 59, in <listcomp>
    e.resolve_clp(m.clp_axis, r.clp_axis, i, self._model.clp_relations)
  File "pyglotaran_porting_examples\glotaran\optimization\estimation.py", line 63, in resolve_clp
    target_idx = clp_axis.index(relation.target)
ValueError: 's3' is not in list

Expected behavior

No crash is expected.

Screenshots

Additional context

02-transient_absorption.zip

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I tested that the issue reported here is indeed fixes with #1455.

Closing, fixed on staging - no issue on main.