Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

In LogTransform, clip after log, not before.#9477

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 7 commits intomatplotlib:masterfromanntzer:clip-log-further
Oct 25, 2017

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedOct 19, 2017
edited
Loading

In LogTransform, clip after log, not before.

When clipping before taking the log, the clip value in the output array
cannot be beyond log(epsilon) ~ -300. When clipping after taking the
log, the clip value can be much further (see comments regarding choice
of value).

This allows setting the default nonpos mode back to "clip".

Some test images had to be updated as this effectively moves the
position of the "clip point", slightly changing the slope of the line
that goes to that point and thus the rasterization (by a tiny amount).

I think this is a better fix than#9305.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzeranntzerforce-pushed theclip-log-further branch 3 times, most recently from33efc48 to0f89c30CompareOctober 20, 2017 01:53
When clipping before taking the log, the clip value in the output arraycannot be beyond log(epsilon) ~ -300.  When clipping after taking thelog, the clip value can be much further (see comments regarding choiceof value).This allows setting the default nonpos mode back to "clip".Some test images had to be updated as this effectively moves theposition of the "clip point", slightly changing the slope of the linethat goes to that point and thus the rasterization (by a tiny amount).
@tacaswelltacaswell added this to thev2.1.1 milestoneOct 21, 2017
@tacaswelltacaswell added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelOct 21, 2017
Copy link
Member

@tacaswelltacaswell left a comment

Choose a reason for hiding this comment

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

Added some tests + doc changes.

@@ -1673,6 +1674,7 @@ def semilogy(self, *args, **kwargs):
self.cla()
d = {'basey': kwargs.pop('basey', 10),
'subsy': kwargs.pop('subsy', None),
'nonposy': kwargs.pop('nonposy', 'mask'),
Copy link
Member

Choose a reason for hiding this comment

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

Why mask here instead of 'clip' like semilogx?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Because typo. But actually both should be using "mask" mode if we want to keep backcompatibility (that's what we had before). Feel free to push either option (but it seems normal to return to the 2.0.1 behavior for now).

@tacaswell
Copy link
Member

I am in favor of putting this in for 2.1.1. It is an API change, but it is reverting an API change in 2.1.0 that was more disruptive than we expected. The change to errorbars is a very nice perk.

This will also fix#9149

raise ValueError(("provided too many kwargs, can only pass "
"{'basex', 'subsx', nonposx'} or "
"{'basey', 'subsy', nonposy'}. You passed ") +
"{!r}".format(kwargs))
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

just format the entire string? no need to add, also no need for!r asrepr(dict) == format(dict, "")

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 try to format the whole string it blows up on a key error with "'basex', 'subsx', nonposx'".

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

"{" -> "{{".
If you think it's not an improvement, then at least replace "{!r}.format(...)" by repr(...), no? seems a bit perverse otherwise :)

@dopplershift
Copy link
Contributor

See#9288 and#9457 for relevant issues.

Copy link
Contributor

@dopplershiftdopplershift left a comment

Choose a reason for hiding this comment

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

👍 on the change for 2.1.1 because it closes some very real, confusing behavior.

I'll let@tacaswell and@anntzer sort out the error message formatting. 😁

@anntzer
Copy link
ContributorAuthor

it's fine if you want to leave the error formatting as it is too... i'll just clean it some day.

tacaswell reacted with thumbs up emoji

Copy link
Member

@efiringefiring left a comment

Choose a reason for hiding this comment

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

I'm happy with the API reversion.

@tacaswelltacaswell merged commit7bd5d64 intomatplotlib:masterOct 25, 2017
@anntzeranntzer deleted the clip-log-further branchOctober 25, 2017 18:17
dstansby added a commit that referenced this pull requestOct 26, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@efiringefiringefiring approved these changes

@tacaswelltacaswelltacaswell approved these changes

@dopplershiftdopplershiftdopplershift approved these changes

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v2.1.1
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@tacaswell@dopplershift@efiring

[8]ページ先頭

©2009-2025 Movatter.jp