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

✨Make guidance spectra a first class citizen #983

Closed
wants to merge 9 commits into from

Conversation

s-weigand
Copy link
Member

@s-weigand s-weigand commented Jan 30, 2022

This is just a preview for maintainers

Change summary

  • ✨ Initial draft for a simplified specification of guidance spectra
  • ♻️🩹 Renamed overwrite_{model|global}dimension to force{model|global}_dimension
  • 🩹 Fixed tests
  • ♻️ Renamed attributes force_{model|global}dimension back to overwrite{model|global}_dimension
  • ♻️ Renamed methods overwrite_{model|global}dimension to replace{model|global}_dimension

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)
  • 📚 Adds documentation of the feature

Closes issues

closes #846

@github-actions
Copy link
Contributor

Binder 👈 Launch a binder notebook on branch s-weigand/pyglotaran/simplify-guidance

@sonarqubecloud
Copy link

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

Copy link
Member

@joernweissenborn joernweissenborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtrm

@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 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]       [a4df8f93]
     <v0.5.1>                   
       49.2±0.1ms       49.4±0.4ms     1.00  BenchmarkOptimize.time_optimize(False, False, False)
       53.0±0.5ms       53.1±0.7ms     1.00  BenchmarkOptimize.time_optimize(False, False, True)
       49.6±0.6ms       49.7±0.4ms     1.00  BenchmarkOptimize.time_optimize(False, True, False)
        54.7±20ms        54.3±10ms     0.99  BenchmarkOptimize.time_optimize(False, True, True)
         59.6±2ms       60.0±0.5ms     1.01  BenchmarkOptimize.time_optimize(True, False, False)
        68.8±40ms        63.6±30ms     0.92  BenchmarkOptimize.time_optimize(True, False, True)
       59.7±0.2ms       59.7±0.4ms     1.00  BenchmarkOptimize.time_optimize(True, True, False)
        64.1±50ms        65.6±30ms     1.02  BenchmarkOptimize.time_optimize(True, True, True)
             201M             206M     1.02  IntegrationTwoDatasets.peakmem_optimize
       1.71±0.08s       1.61±0.04s     0.94  IntegrationTwoDatasets.time_optimize

Benchmark diff main vs. PR

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [d15d9bd3]       [a4df8f93]
       49.8±0.3ms       49.4±0.4ms     0.99  BenchmarkOptimize.time_optimize(False, False, False)
       53.1±0.4ms       53.1±0.7ms     1.00  BenchmarkOptimize.time_optimize(False, False, True)
       49.3±0.6ms       49.7±0.4ms     1.01  BenchmarkOptimize.time_optimize(False, True, False)
         57.5±5ms        54.3±10ms     0.94  BenchmarkOptimize.time_optimize(False, True, True)
         66.9±7ms       60.0±0.5ms    ~0.90  BenchmarkOptimize.time_optimize(True, False, False)
        74.3±40ms        63.6±30ms    ~0.86  BenchmarkOptimize.time_optimize(True, False, True)
        65.2±10ms       59.7±0.4ms     0.92  BenchmarkOptimize.time_optimize(True, True, False)
        84.3±50ms        65.6±30ms    ~0.78  BenchmarkOptimize.time_optimize(True, True, True)
             202M             206M     1.02  IntegrationTwoDatasets.peakmem_optimize
       1.64±0.05s       1.61±0.04s     0.98  IntegrationTwoDatasets.time_optimize

@codecov
Copy link

codecov bot commented Jan 30, 2022

Codecov Report

Merging #983 (a4df8f9) into main (279b24c) will decrease coverage by 0.2%.
The diff coverage is 58.3%.

@@           Coverage Diff           @@
##            main    #983     +/-   ##
=======================================
- Coverage   85.9%   85.7%   -0.3%     
=======================================
  Files         92      93      +1     
  Lines       4972    5002     +30     
  Branches     937     942      +5     
=======================================
+ Hits        4272    4287     +15     
- Misses       552     564     +12     
- Partials     148     151      +3     
Impacted Files Coverage Δ
glotaran/model/model.py 85.5% <0.0%> (-0.1%) ⬇️
glotaran/model/dataset_model.py 76.9% <58.6%> (-5.1%) ⬇️
glotaran/model/clp_guidance_megacomplex.py 61.1% <61.1%> (ø)

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 279b24c...a4df8f9. Read the comment docs.

@jsnel jsnel changed the title ✨Make guidance spectra a first class thing ✨Make guidance spectra a first class citizen Jan 30, 2022
glotaran/model/model.py Outdated Show resolved Hide resolved
Copy link
Member

@jsnel jsnel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming things ...

s-weigand and others added 5 commits March 12, 2022 16:42
Co-authored-by: Jörn Weißenborn <[email protected]>
Co-authored-by: Joris Snellenburg <[email protected]>
…}_dimension

So they won't conflict with the method which has the same name
overwrite_{model|global}_dimension
♻️ Renamed methods overwrite_{model|global}_dimension to replace_{model|global}_dimension
@s-weigand
Copy link
Member Author

s-weigand commented Mar 25, 2022

As discussed with @joernweissenborn today he will implement this as a builtin megacomplex because it will make it more consistent with the modeling language spec and the theory description in "the book" (his thesis).

@joernweissenborn please also note this discussion

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 26, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 5.38 ⭐ 5.52 ⭐ 0.14 👎
Method Length 53.32 ⭐ 53.16 ⭐ -0.16 👍
Working memory 7.88 🙂 7.91 🙂 0.03 👎
Quality 68.77% 🙂 68.59% 🙂 -0.18% 👎
Other metrics Before After Change
Lines 876 897 21
Changed files Quality Before Quality After Quality Change
glotaran/builtin/megacomplexes/baseline/test/test_baseline_megacomplex.py 65.48% 🙂 65.48% 🙂 0.00%
glotaran/builtin/megacomplexes/coherent_artifact/test/test_coherent_artifact.py 42.64% 😞 42.64% 😞 0.00%
glotaran/builtin/megacomplexes/spectral/test/test_spectral_model.py 61.32% 🙂 61.32% 🙂 0.00%
glotaran/model/dataset_model.py 80.93% ⭐ 79.35% ⭐ -1.58% 👎
glotaran/model/model.py 70.83% 🙂 70.55% 🙂 -0.28% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
glotaran/builtin/megacomplexes/coherent_artifact/test/test_coherent_artifact.py test_coherent_artifact 6 ⭐ 459 ⛔ 11 😞 42.64% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/model/model.py Model.markdown 13 🙂 168 😞 10 😞 48.74% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/model/model.py Model.from_dict 12 🙂 162 😞 10 😞 50.19% 🙂 Try splitting into smaller methods. Extract out complex expressions
glotaran/model/dataset_model.py DatasetModel.get_global_dimension 15 🙂 128 😞 10 😞 51.34% 🙂 Try splitting into smaller methods. Extract out complex expressions
glotaran/builtin/megacomplexes/spectral/test/test_spectral_model.py test_spectral_model 1 ⭐ 237 ⛔ 9 🙂 57.03% 🙂 Try splitting into smaller methods

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 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 this quality report!

@sonarqubecloud
Copy link

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

@s-weigand
Copy link
Member Author

Superseded by #1029

@s-weigand s-weigand closed this Mar 26, 2022
@s-weigand s-weigand deleted the simplify-guidance branch April 2, 2022 20:32
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.

✨ Create Clp Guidance
3 participants