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

Update parameter names in for ThermoPhase.equilibrate #684

Merged
merged 1 commit into from
Dec 3, 2019
Merged

Update parameter names in for ThermoPhase.equilibrate #684

merged 1 commit into from
Dec 3, 2019

Conversation

sameshl
Copy link
Contributor

@sameshl sameshl commented Aug 8, 2019

changed keyword arguments from :

  • maxsteps to max_steps
  • maxiter to max_iter
  • loglevel to log_level

closes #675

@@ -379,6 +379,22 @@ cdef class ThermoPhase(_SolutionBase):
:param loglevel:
Set to a value > 0 to write diagnostic output.
"""
# check for old parameters and warn the user
if 'maxsteps' in **kwargs:
Copy link
Member

Choose a reason for hiding this comment

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

Currently there is a syntax error here (which caused the CI checks to fail): when checking the contents of a dictionary, the ** that unpack it shouldn't be there. I.e.

if 'maxsteps' in kwargs:
    ...

should work. Before resubmitting, I'd also recommend running scons build and scons test on your own machine, as it will catch those glitches.

@ischoegl
Copy link
Member

ischoegl commented Aug 8, 2019

@sameshl ... thanks for the PR. The wording of the warning may need some tweaks, but that goes above my pay grade ;)

Copy link
Member

@bryanwweber bryanwweber left a comment

Choose a reason for hiding this comment

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

As @ischoegl said, thank you for the changes here! I've also requested some additional changes.

log_level = log_level
warnings.warn("To be deprecated after Cantera 2.5."
"Use property `log_level` instead", DeprecationWarning)

self.thermo.equilibrate(stringify(XY.upper()), stringify(solver), rtol,
maxsteps, maxiter, estimate_equil, loglevel)
Copy link
Member

Choose a reason for hiding this comment

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

If you're changing the variable names, you have to actually use the new names in the function call here.

if 'loglevel' in **kwargs:
log_level = log_level
warnings.warn("To be deprecated after Cantera 2.5."
"Use property `log_level` instead", DeprecationWarning)
Copy link
Member

Choose a reason for hiding this comment

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

No need to include the backticks, this output will be shown unformatted anyways. I think the text of the warning message should say:

Keyword argument 'loglevel' is deprecated and will be removed after Cantera 2.5.0. Use argument 'log_level' instead.

And similar for the other warnings.

@sameshl
Copy link
Contributor Author

sameshl commented Aug 8, 2019

@bryanwweber Thanks for the review! Will make the required changes.

@ischoegl
Copy link
Member

ischoegl commented Aug 9, 2019

@sameshl ... currently the build fails as you need to pick out maxiter (and similar) from the kwargs dictionary. I.e.

max_iter = kwargs['maxiter']

Also, please squash your commits into a single commit using rebase (CONTRIBUTING.md has some pointers about git's history-rewriting features). As mentioned earlier, you can easily catch coding glitches by running scons build and scons test prior to pushing your commits.

@bryanwweber
Copy link
Member

@sameshl If you can't figure out how to rebase to combine the commits, don't worry, we can do it just before the changes are merged. I agree with @ischoegl about testing locally being a big help to you though 😊

@sameshl
Copy link
Contributor Author

sameshl commented Aug 9, 2019

@bryanwweber thanks a lot for offering help! 😅 But the thing is I was encountering a lot of issues setting up my dev env so I could not run build tests. I will try to rebase the commits. Will let you know if I have any problems

@codecov
Copy link

codecov bot commented Aug 9, 2019

Codecov Report

Merging #684 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #684      +/-   ##
==========================================
+ Coverage   70.62%   70.62%   +<.01%     
==========================================
  Files         372      372              
  Lines       43565    43565              
==========================================
+ Hits        30768    30769       +1     
+ Misses      12797    12796       -1
Impacted Files Coverage Δ
src/transport/GasTransport.cpp 90.58% <0%> (+0.2%) ⬆️

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 bbdc790...bea4ee6. Read the comment docs.

@codecov
Copy link

codecov bot commented Aug 9, 2019

Codecov Report

Merging #684 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #684      +/-   ##
==========================================
- Coverage   71.35%   71.34%   -0.01%     
==========================================
  Files         372      372              
  Lines       43758    43758              
==========================================
- Hits        31223    31221       -2     
- Misses      12535    12537       +2
Impacted Files Coverage Δ
src/transport/GasTransport.cpp 90.58% <0%> (-0.21%) ⬇️
src/thermo/HMWSoln.cpp 71.54% <0%> (-0.05%) ⬇️

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 3cd1802...b54e7e2. Read the comment docs.

@sameshl
Copy link
Contributor Author

sameshl commented Aug 9, 2019

@bryanwweber Made the required changes! Let me know if I need to do anythink else!

Changed keyword arguments from:

* `maxsteps` to `max_steps`
* `maxiter` to `max_iter`
* `loglevel` to `log_level`

Minor docstring formatting updates.

closes #675
@speth speth merged commit 864d4cd into Cantera:master Dec 3, 2019
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.

Inconsistent parameter names in equilibrate
4 participants