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

BUG: Stream.plot(type='section'...) reftime parameter doesn't work #2493

Merged
merged 5 commits into from Dec 4, 2019

Conversation

@luca-s
Copy link
Contributor

luca-s commented Nov 1, 2019

What does this PR do?

Fix a plotting bug. When type='section' is used in Stream.plot the reftime doesn't behave correctly.

Why was it initiated? Any relevant Issues?

I couldn't plot my data correctly.

PR Checklist

  • Correct base branch selected? master for new features, maintenance_... for bug fixes
  • This PR is not directly related to an existing issue (which has no PR yet).
  • If the PR is making changes to documentation, docs pages can be built automatically.
    Just remove the space in the following string after the + sign: "+ DOCS"
  • If any network modules should be tested for the PR, add them as a comma separated list
    (e.g. clients.fdsn,clients.arclink) after the colon in the following magic string: "+TESTS:"
    (you can also add "ALL" to just simply run all tests across all modules)
  • All tests still pass.
  • Any new features or fixed regressions are be covered via new tests.
  • Any new or changed features have are fully documented.
  • Significant changes have been added to CHANGELOG.txt .
  • First time contributors have added your name to CONTRIBUTORS.txt .
@luca-s luca-s force-pushed the luca-s:maintenance_1.1.x branch 2 times, most recently from de28128 to d6ef533 Nov 1, 2019
@megies

This comment has been minimized.

Copy link
Member

megies commented Nov 4, 2019

Currently all PRs go into master since we won't do another 1.1.x bug fix release. I'll try to just change the base branch.

@megies megies added this to the 1.2.0 milestone Nov 4, 2019
@megies megies added the bug label Nov 4, 2019
@megies megies changed the base branch from maintenance_1.1.x to master Nov 4, 2019
@luca-s

This comment has been minimized.

Copy link
Contributor Author

luca-s commented Nov 4, 2019

@megies Thanks. Please let me know if you prefer me to do the rebase

@megies megies added this to Waiting for Review in Release 1.2.0 Nov 4, 2019
@megies

This comment has been minimized.

Copy link
Member

megies commented Nov 27, 2019

ideally this should have a regression test.. but i don't want it to slow down 1.2.0

@megies

This comment has been minimized.

Copy link
Member

megies commented Nov 27, 2019

for posterity, here's illustrating the bug

import matplotlib.pyplot as plt
import numpy as np
from obspy import read, UTCDateTime

tr = read()[0]
reftime = UTCDateTime("2009-08-24T00:20:00")
info = 'Trace starts at %s s after reftime' % (tr.stats.starttime - reftime)

fig, (ax1, ax2) = plt.subplots(nrows=2, sharex=True)
fig.suptitle('Trace starts at %s s after reftime' % (tr.stats.starttime - reftime))
times = (np.arange(len(tr)) + (tr.stats.starttime - reftime)) * tr.stats.delta
ax1.plot(times, tr.data)
ax1.set_title('Buggy start relative to reftime')
ax1.grid()
times = (np.arange(len(tr)) * tr.stats.delta + (tr.stats.starttime - reftime))
ax2.plot(times, tr.data)
ax2.set_title('Correct start relative to reftime')
ax2.grid()
plt.show()

Figure_1

@megies megies force-pushed the luca-s:maintenance_1.1.x branch from 560f954 to 1ef1886 Nov 27, 2019
@megies

This comment has been minimized.

Copy link
Member

megies commented Nov 27, 2019

I felt free to rebase and force push @luca-s

@megies megies added the .imaging label Nov 29, 2019
@megies megies force-pushed the luca-s:maintenance_1.1.x branch 2 times, most recently from 9527a8b to 0a06bc1 Nov 29, 2019
@megies

This comment has been minimized.

Copy link
Member

megies commented Dec 4, 2019

Remaining CI test file is unrelated, gonna rebase and merge

luca-s and others added 5 commits Nov 1, 2019
package versions:
matplotlib         2.2.2
basemap            1.1.0
basemap-data-hires 1.1.0
@megies megies force-pushed the luca-s:maintenance_1.1.x branch from 85d2325 to b4accec Dec 4, 2019
@megies

This comment has been minimized.

Copy link
Member

megies commented Dec 4, 2019

Thanks @luca-s !

@megies
megies approved these changes Dec 4, 2019
@megies megies merged commit d0c9a4a into obspy:master Dec 4, 2019
0 of 3 checks passed
0 of 3 checks passed
ci/circleci CircleCI is running your tests
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@megies megies moved this from Waiting for Review to Done in Release 1.2.0 Dec 4, 2019
@luca-s luca-s deleted the luca-s:maintenance_1.1.x branch Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2 participants
You can’t perform that action at this time.