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 an unintuitive behaviour in ProfilePlot #2650

Merged
merged 7 commits into from
Jul 1, 2020

Conversation

neutrinoceros
Copy link
Member

PR Summary

Because of the way it's currently implemented, ProfilePlot produces unintuitive results when passed x_log=None, which is effectively, equivalent has passing x_log=True despite the fact that bool(None)==False.

with this change, the following produce the same result

import yt
ds = yt.testing.fake_random_ds(128)
yt.ProfilePlot(ds, 'y', ['density', "velocity_magnitude"], n_bins=500, x_log=None)
yt.ProfilePlot(ds, 'y', ['density', "velocity_magnitude"], n_bins=500, x_log=0)
yt.ProfilePlot(ds, 'y', ['density', "velocity_magnitude"], n_bins=500, x_log=False)

This issue was reported on slack by Jack Jenkins.
I'm opening this as a draft since there may be other appropriate changes to ProfilePlot.init() that could go with it.

@neutrinoceros neutrinoceros added the api-consistency naming conventions, code deduplication, informative error messages, code smells... label Jun 19, 2020
@munkm munkm added the enhancement Making something better label Jun 19, 2020
@neutrinoceros neutrinoceros marked this pull request as ready for review June 20, 2020 10:44
Copy link
Member

@munkm munkm left a comment

Choose a reason for hiding this comment

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

I have a few comments! But this is a good idea and I agree the way that we're currently that using None for these log fields is confusing. We need to be really clear in the release notes that this may cause different behavior in scripts of our downstream users.

yt/visualization/profile_plotter.py Outdated Show resolved Hide resolved
yt/visualization/profile_plotter.py Show resolved Hide resolved
@munkm munkm merged commit 2603b82 into yt-project:master Jul 1, 2020
@neutrinoceros neutrinoceros deleted the simplify_profileplot_api branch July 21, 2020 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-consistency naming conventions, code deduplication, informative error messages, code smells... enhancement Making something better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants