Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
A collection of Matt and David's commits from #2316 #2491
A collection of Matt and David's commits from #2316 #2491
Changes from all commits
34ed5a3
a6742e9
49bb3c1
7cee142
5badbd1
92fad47
54d9e72
bd1d25d
20adbd1
4425ac5
7d527a3
23d88f2
0a6c456
2180175
9609275
88adf99
f8fdf43
f9991fe
25ff548
409b39d
6071531
09a39e9
4013707
cfe970f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 3626 in rmgpy/data/kinetics/family.py
Codecov / codecov/patch
rmgpy/data/kinetics/family.py#L3625-L3626
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just use Python's built in average, or numpy's. i.e.
np.mean([i.n.value_si for i in kinetics_list])
(and include thelog10
for geometric, or use a method that just does geometric mean).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we'd have to iterate through the list multiple times (once for each attribute) and create a bunch of lists. Is this a verbosity thing? an efficiency thing? a less-likely-to-make-mistakes thing?
I don't like playing code golf for the sake of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do it very efficiently in one line like this:
This is an antipattern, which we benefit from removing for all of these reasons. Numpy will be faster, less code is easier to maintain and read, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A hole in one!
I quite like it. Although, having now taught programming a few times, I am learning to appreciate the benefits of code that a novice can understand at a glance. More participation, fewer mistakes, less time spent explaining or parsing, etc. etc.
Anyway, the main reason to not do it your way here and now is that we soon need to revert this commit
2180175
and the merge conflicts would be horrible to resolve.
We can revisit optimizing this code after that happens.
(Though I think this code is seldom called)
Check warning on line 4706 in rmgpy/data/kinetics/family.py
Codecov / codecov/patch
rmgpy/data/kinetics/family.py#L4706
Check warning on line 4709 in rmgpy/data/kinetics/family.py
Codecov / codecov/patch
rmgpy/data/kinetics/family.py#L4709
Check warning on line 4712 in rmgpy/data/kinetics/family.py
Codecov / codecov/patch
rmgpy/data/kinetics/family.py#L4712
Check warning on line 4715 in rmgpy/data/kinetics/family.py
Codecov / codecov/patch
rmgpy/data/kinetics/family.py#L4715
Check warning on line 4718 in rmgpy/data/kinetics/family.py
Codecov / codecov/patch
rmgpy/data/kinetics/family.py#L4718
Check warning on line 4720 in rmgpy/data/kinetics/family.py
Codecov / codecov/patch
rmgpy/data/kinetics/family.py#L4720
Check warning on line 4723 in rmgpy/data/kinetics/family.py
Codecov / codecov/patch
rmgpy/data/kinetics/family.py#L4723
Check warning on line 1203 in rmgpy/data/solvation.py
Codecov / codecov/patch
rmgpy/data/solvation.py#L1202-L1203
Check warning on line 1611 in rmgpy/rmg/model.py
Codecov / codecov/patch
rmgpy/rmg/model.py#L1611
Check warning on line 1715 in rmgpy/rmg/model.py
Codecov / codecov/patch
rmgpy/rmg/model.py#L1715
Check warning on line 128 in rmgpy/yml.py
Codecov / codecov/patch
rmgpy/yml.py#L128
Check warning on line 144 in rmgpy/yml.py
Codecov / codecov/patch
rmgpy/yml.py#L144