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 ParameterGroup repr when created with 'from_list' #827

Merged
merged 1 commit into from
Sep 25, 2021

Conversation

s-weigand
Copy link
Member

@s-weigand s-weigand commented Sep 18, 2021

Currently, the repr of ParameterGroup doesn't work properly when it is created with from_list.

In [1]: from glotaran.parameter import ParameterGroup

In [2]: ParameterGroup.from_list([2.0,3.0])
Out[2]: ParameterGroup.from_dict({})

With this fix in place it looks like this:

In [1]: from glotaran.parameter import ParameterGroup

In [2]: ParameterGroup.from_list([2.0,3.0])
Out[2]: ParameterGroup.from_list([['1', 2.0], ['2', 3.0]])

Change summary

  • 🩹 Fix ParameterGroup repr when created with 'from_list'

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)
  • 🧪 Adds new tests for the feature (mandatory for ✨ feature and 🩹 bug fix PR's)
  • 📚 Added change to changelog

@github-actions
Copy link
Contributor

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

jsnel
jsnel previously approved these changes Sep 18, 2021
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.

LGTM!

@github-actions
Copy link
Contributor

github-actions bot commented Sep 18, 2021

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

Benchmark diff v0.4.1 vs. main

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [21ba272a]       [85a08a9a]
     <v0.4.1>                   
-        67.5±2ms         44.6±1ms     0.66  BenchmarkOptimize.time_optimize(False, False, False)
-         422±2ms         58.9±4ms     0.14  BenchmarkOptimize.time_optimize(False, False, True)
-        89.7±3ms         77.1±2ms     0.86  BenchmarkOptimize.time_optimize(False, True, False)
         95.2±3ms        87.3±40ms     0.92  BenchmarkOptimize.time_optimize(False, True, True)
-        71.4±1ms         59.2±3ms     0.83  BenchmarkOptimize.time_optimize(True, False, False)
-         440±6ms        68.7±40ms     0.16  BenchmarkOptimize.time_optimize(True, False, True)
         96.7±4ms         92.9±2ms     0.96  BenchmarkOptimize.time_optimize(True, True, False)
          101±1ms         102±20ms     1.02  BenchmarkOptimize.time_optimize(True, True, True)
             182M             181M     0.99  IntegrationTwoDatasets.peakmem_create_result
             197M             197M     1.00  IntegrationTwoDatasets.peakmem_optimize
-         277±6ms         224±10ms     0.81  IntegrationTwoDatasets.time_create_result
-      5.89±0.02s       1.83±0.05s     0.31  IntegrationTwoDatasets.time_optimize

Benchmark diff main vs. PR

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [0ba531dc]       [85a08a9a]
         45.0±1ms         44.6±1ms     0.99  BenchmarkOptimize.time_optimize(False, False, False)
         61.0±6ms         58.9±4ms     0.97  BenchmarkOptimize.time_optimize(False, False, True)
         77.1±2ms         77.1±2ms     1.00  BenchmarkOptimize.time_optimize(False, True, False)
         87.0±4ms        87.3±40ms     1.00  BenchmarkOptimize.time_optimize(False, True, True)
         59.5±1ms         59.2±3ms     1.00  BenchmarkOptimize.time_optimize(True, False, False)
        67.4±20ms        68.7±40ms     1.02  BenchmarkOptimize.time_optimize(True, False, True)
         91.2±4ms         92.9±2ms     1.02  BenchmarkOptimize.time_optimize(True, True, False)
         102±40ms         102±20ms     1.00  BenchmarkOptimize.time_optimize(True, True, True)
             181M             181M     1.00  IntegrationTwoDatasets.peakmem_create_result
             200M             197M     0.99  IntegrationTwoDatasets.peakmem_optimize
          220±8ms         224±10ms     1.02  IntegrationTwoDatasets.time_create_result
       1.87±0.08s       1.83±0.05s     0.98  IntegrationTwoDatasets.time_optimize

@codecov
Copy link

codecov bot commented Sep 18, 2021

Codecov Report

Merging #827 (85a08a9) into main (0ba531d) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #827   +/-   ##
=====================================
  Coverage   84.7%   84.7%           
=====================================
  Files         77      77           
  Lines       4343    4343           
  Branches     785     785           
=====================================
  Hits        3682    3682           
  Misses       521     521           
  Partials     140     140           
Impacted Files Coverage Δ
glotaran/parameter/parameter_group.py 88.7% <ø> (ø)

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 0ba531d...85a08a9. Read the comment docs.

jsnel
jsnel previously approved these changes Sep 19, 2021
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.

LGTM.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Sep 19, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.48%.

Quality metrics Before After Change
Complexity 6.89 ⭐ 6.69 ⭐ -0.20 👍
Method Length 54.69 ⭐ 55.10 ⭐ 0.41 👎
Working memory 7.52 🙂 7.44 🙂 -0.08 👍
Quality 71.46% 🙂 71.94% 🙂 0.48% 👍
Other metrics Before After Change
Lines 502 516 14
Changed files Quality Before Quality After Quality Change
glotaran/parameter/parameter_group.py 69.30% 🙂 69.08% 🙂 -0.22% 👎
glotaran/parameter/test/test_parameter_group.py 86.66% ⭐ 87.27% ⭐ 0.61% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
glotaran/parameter/parameter_group.py ParameterGroup.from_dataframe 28 😞 267 ⛔ 13 😞 26.41% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
glotaran/parameter/parameter_group.py ParameterGroup.__repr__ 6 ⭐ 72 🙂 12 😞 63.49% 🙂 Extract out complex expressions
glotaran/parameter/parameter_group.py ParameterGroup.markdown 3 ⭐ 118 🙂 10 😞 63.64% 🙂 Extract out complex expressions
glotaran/parameter/parameter_group.py ParameterGroup.get_label_value_and_bounds_arrays 4 ⭐ 79 🙂 11 😞 66.12% 🙂 Extract out complex expressions
glotaran/parameter/parameter_group.py ParameterGroup.update_parameter_expression 6 ⭐ 51 ⭐ 10 😞 70.39% 🙂 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 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!

@sonarcloud
Copy link

sonarcloud bot commented Sep 19, 2021

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.

lgtm

@s-weigand s-weigand added this to the v0.5.0 milestone Sep 23, 2021
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.

👍

@jsnel jsnel merged commit 9a2d733 into glotaran:main Sep 25, 2021
@jsnel jsnel deleted the fix_paramergroup_repr branch September 25, 2021 17:36
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.

3 participants