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

[staging] 🐛 Use of clp_relations results crashes with multiple datasets #1429

Closed jsnel closed 3 months ago

jsnel commented 7 months ago

Version information

Describe the bug

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

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

stale[bot] commented 4 months ago

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.

jsnel commented 3 months ago

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

jsnel commented 3 months ago

Closing, fixed on staging - no issue on main.