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

Refactor Element Result Saving #1534

Open joernweissenborn opened 1 week ago

joernweissenborn commented 1 week ago

This PR refactors the way element results are stored. Now every element stores it's own items. They return

@dataclass
class ElementResult:
    amplitudes: dict[str, xr.DataArray]
    concentrations: dict[str, xr.DataArray]
    extra: dict[str, xr.DataArray] = field(default_factory=dict)

The Kinetic element eg, stores amplitudes and contractions each with key "species" and "decay". This means in the final result this will be stored as eg species_associated_amplitude_ELEMENTNAME. K matrices etc are part of extra and only get the element name suffixed.

IMPORTANT To avoid collisions, all coords which are not the model or the global dim also get suffixed with the name, species coord will be renamend to species_ELEMENTNAME.

Checklist

Closes issues

closes #1498

sourcery-ai[bot] commented 1 week ago

🧙 Sourcery has finished reviewing your pull request!


Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.
github-actions[bot] commented 1 week ago

Binder :point_left: Launch a binder notebook on branch _joernweissenborn/pyglotaran/staging1474

joernweissenborn commented 1 week ago

I have checked the sonar cloud issues, this will be fixed in the cleanup when I add doc etc.

codecov[bot] commented 4 days ago

Codecov Report

Attention: Patch coverage is 94.51477% with 13 lines in your changes missing coverage. Please review.

Project coverage is 85.3%. Comparing base (06d4c98) to head (f41fd12).

Files with missing lines Patch % Lines
glotaran/builtin/items/activation/data_model.py 88.5% 2 Missing and 2 partials :warning:
...aran/builtin/elements/coherent_artifact/element.py 86.3% 1 Missing and 2 partials :warning:
glotaran/optimization/data.py 77.7% 1 Missing and 1 partial :warning:
glotaran/optimization/objective.py 98.1% 1 Missing and 1 partial :warning:
glotaran/builtin/elements/baseline/element.py 66.6% 1 Missing :warning:
glotaran/optimization/optimization.py 50.0% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## staging #1534 +/- ## ========================================= - Coverage 85.3% 85.3% -0.1% ========================================= Files 91 91 Lines 3752 3746 -6 Branches 734 719 -15 ========================================= - Hits 3203 3197 -6 - Misses 438 445 +7 + Partials 111 104 -7 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 4 days ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

jsnel commented 3 days ago

After internal discussions we decided to pivot on how to save results, see my summarizing comment on the issue.