Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🩹Fix bug in create_index_independent_result_dataset #948

Merged

Conversation

jsnel
Copy link
Member

@jsnel jsnel commented Jan 4, 2022

Change summary

  • Indexing did not match content of _group.matrices (list of CalculatedMatrix objects)
  • Dimension did not match (for guidance spectra) (global_dimension_index appeared to be missing

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)
  • 🚧 Added changes to changelog (mandatory for all PR's)
  • 👌 Closes issue (mandatory for ✨ feature and 🩹 bug fix PR's)
  • 🧪 Adds new tests for the feature (mandatory for ✨ feature and 🩹 bug fix PR's)

Closes issues

Closes #950

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2022

Binder 👈 Launch a binder notebook on branch jsnel/pyglotaran/fix-create-index-independent-result-dataset

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2022

Benchmark is done. Checkout the benchmark result page.
Benchmark differences below 5% might be due to CI noise.

Benchmark diff v0.5.1 vs. main

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [96b42630]       [ba7f8bff]
     <v0.5.1>                   
       52.4±0.7ms       52.7±0.5ms     1.01  BenchmarkOptimize.time_optimize(False, False, False)
       56.1±0.7ms       55.3±0.3ms     0.98  BenchmarkOptimize.time_optimize(False, False, True)
       52.1±0.3ms       52.6±0.4ms     1.01  BenchmarkOptimize.time_optimize(False, True, False)
         56.8±1ms         57.4±9ms     1.01  BenchmarkOptimize.time_optimize(False, True, True)
       63.3±0.6ms       63.3±0.3ms     1.00  BenchmarkOptimize.time_optimize(True, False, False)
        71.8±30ms        67.8±40ms     0.94  BenchmarkOptimize.time_optimize(True, False, True)
       63.4±0.5ms       63.3±0.4ms     1.00  BenchmarkOptimize.time_optimize(True, True, False)
       66.6±0.5ms        68.0±30ms     1.02  BenchmarkOptimize.time_optimize(True, True, True)
             191M             194M     1.01  IntegrationTwoDatasets.peakmem_optimize
       1.86±0.09s       1.78±0.06s     0.95  IntegrationTwoDatasets.time_optimize

Benchmark diff main vs. PR

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [b1f678a4]       [ba7f8bff]
       52.7±0.2ms       52.7±0.5ms     1.00  BenchmarkOptimize.time_optimize(False, False, False)
        57.9±20ms       55.3±0.3ms     0.96  BenchmarkOptimize.time_optimize(False, False, True)
       52.3±0.4ms       52.6±0.4ms     1.01  BenchmarkOptimize.time_optimize(False, True, False)
       56.3±0.6ms         57.4±9ms     1.02  BenchmarkOptimize.time_optimize(False, True, True)
       63.8±0.2ms       63.3±0.3ms     0.99  BenchmarkOptimize.time_optimize(True, False, False)
        85.5±30ms        67.8±40ms    ~0.79  BenchmarkOptimize.time_optimize(True, False, True)
       63.6±0.3ms       63.3±0.4ms     0.99  BenchmarkOptimize.time_optimize(True, True, False)
        68.0±20ms        68.0±30ms     1.00  BenchmarkOptimize.time_optimize(True, True, True)
             201M             194M     0.96  IntegrationTwoDatasets.peakmem_optimize
       1.74±0.07s       1.78±0.06s     1.02  IntegrationTwoDatasets.time_optimize

@codecov
Copy link

codecov bot commented Jan 4, 2022

Codecov Report

Merging #948 (ba7f8bf) into main (b1f678a) will decrease coverage by 0.0%.
The diff coverage is 60.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #948     +/-   ##
=======================================
- Coverage   85.1%   85.0%   -0.1%     
=======================================
  Files         85      85             
  Lines       4799    4802      +3     
  Branches     921     923      +2     
=======================================
+ Hits        4085    4086      +1     
- Misses       562     563      +1     
- Partials     152     153      +1     
Impacted Files Coverage Δ
...n/analysis/optimization_group_calculator_linked.py 95.7% <60.0%> (-0.8%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1f678a...ba7f8bf. Read the comment docs.

@jsnel
Copy link
Member Author

jsnel commented Jan 5, 2022

In lieu of review by another code owner (@joernweissenborn), considering all unit tests are passing I will use my administrator privileges to merge in the patch so @ism200 can proceed with his case study. If a more elegant solution is available that can be addressed in a future PR.

jsnel and others added 4 commits January 5, 2022 01:34
- Indexing did not match content of _group.matrices (list of CalculatedMatrix objects)
- Dimension did not match (for guidance spectra) (global_dimension_index appeared to be missing
- 🩹 Fix Crash in optimization_group_calculator_linked when using guidance spectra Type: Bug (glotaran#950)

Closes: glotaran#950
@jsnel jsnel force-pushed the fix-create-index-independent-result-dataset branch from d29606d to ba7f8bf Compare January 5, 2022 00:39
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 5, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.31%.

Quality metrics Before After Change
Complexity 6.00 ⭐ 6.07 ⭐ 0.07 👎
Method Length 104.20 🙂 105.95 🙂 1.75 👎
Working memory 10.75 😞 10.75 😞 0.00
Quality 60.83% 🙂 60.52% 🙂 -0.31% 👎
Other metrics Before After Change
Lines 560 571 11
Changed files Quality Before Quality After Quality Change
glotaran/analysis/optimization_group_calculator_linked.py 60.83% 🙂 60.52% 🙂 -0.31% 👎
            Here are some functions in these files that still need a tune-up:

            | File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
            | --- | --- | :---: | :---: | :---: | :---: | --- |
            | glotaran/analysis/optimization_group_calculator_linked.py | OptimizationGroupCalculatorLinked.\_append\_to\_grouped\_bag | 12 🙂 | 269 ⛔ | 23 ⛔ | 29.09% 😞 | Try splitting into smaller methods. Extract out complex expressions |

| glotaran/analysis/optimization_group_calculator_linked.py | OptimizationGroupCalculatorLinked.init_bag | 10 🙂 | 175 😞 | 16 ⛔ | 41.77% 😞 | Try splitting into smaller methods. Extract out complex expressions |
| glotaran/analysis/optimization_group_calculator_linked.py | combine_matrices | 12 🙂 | 141 😞 | 11 😞 | 50.50% 🙂 | Try splitting into smaller methods. Extract out complex expressions |
| glotaran/analysis/optimization_group_calculator_linked.py | OptimizationGroupCalculatorLinked.calculate_index_independent_matrices | 16 🙂 | 137 😞 | 9 🙂 | 51.53% 🙂 | Try splitting into smaller methods |
| glotaran/analysis/optimization_group_calculator_linked.py | OptimizationGroupCalculatorLinked.calculate_index_dependent_matrices | 6 ⭐ | 189 😞 | 10 😞 | 53.34% 🙂 | Try splitting into smaller methods. Extract out complex expressions |

            ## Legend and Explanation

            The emojis denote the absolute quality of the code:

             - ⭐ excellent
             - 🙂 good
             - 😞 poor
             - ⛔ very poor


            The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.

            ***

            Please see our documentation [here](https://docs.sourcery.ai/GitHub/Quality-Report/) for details on how these metrics are calculated.

            We are actively working on this report - lots more documentation and extra metrics to come!

            Help us [improve](https://research.typeform.com/to/j06Spdfr?type=quality_report&github_login=jsnel&base_repo=https%3A%2F%2Fgithub.com%2Fglotaran%2Fpyglotaran.git&base_remote_ref=refs%2Fpull%2F948%2Fhead&base_ref=main&base_sha=ba7f8bff26b6e5e0fc98d51caff8ee3efc547c54&head_repo=https%3A%2F%2Fgithub.com%2Fglotaran%2Fpyglotaran.git&head_ref=sourcery%2Fpull-948&base_pr_number=948&base_pr_state=open) this quality report!

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 5, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jsnel jsnel merged commit 91930ae into glotaran:main Jan 5, 2022
@jsnel jsnel deleted the fix-create-index-independent-result-dataset branch January 9, 2022 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Crash in optimization_group_calculator_linked when using guidance spectra
1 participant