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

Dayplot error when giving the events argument #767

Merged
merged 9 commits into from
Jul 18, 2014

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Jul 17, 2014

I am giving the events argument to generate the dayplot with events labeled on the plot, but it gave me the following error, looking into the waveform.py, it seems this check should be checked when the code automatically download the Catalog object (when using events={"min_magnitude": 5.5}) instead of manually giving the time of the events.

st.plot(type = 'dayplot', events=[{"time": UTCDateTime("2014-03-29T04:09:42"), "text": "M 5.1"}])
/Library/Python/2.7/site-packages/obspy/imaging/waveform.pyc in _plotEvent(self, event)
    573                 markersize=12, linewidth=self.linewidth)
    574 
--> 575         for pick in event.picks:
    576             # check that network/station/location matches
    577             if pick.waveform_id.getSEEDString().split(".")[:-1] != \

AttributeError: 'dict' object has no attribute 'picks'

@barsch
Copy link
Member

barsch commented May 22, 2014

st = read("http://examples.obspy.org/GR.BFO..LHZ.2012.108")
st.plot(type = 'dayplot', events=[{"time": UTCDateTime("2014-03-29T04:09:42"), "text": "M 5.1"}])

works for me as expected on master - in order to fix this I need more details - e.g. python version, obspy version, input data

@QuLogic
Copy link
Member

QuLogic commented Jul 10, 2014

Your example actually fails with a different error on master now (maybe Py 3 problem?):

obspy/imaging/waveform.py in plotDay(self, *args, **kwargs)
    445         self.axis = [ax]
    446         # Set ticks.
--> 447         self.__dayplotSetYTicks(*args, **kwargs)
    448         self.__dayplotSetXTicks(*args, **kwargs)
    449         # Choose to show grid but only on the x axis.

obspy/imaging/waveform.py in __dayplotSetYTicks(self, *args, **kwargs)
   1082             ticks -= 0.5
   1083         else:
-> 1084             tick_steps = list(range(0, intervals, self.repeat))
   1085             ticks = np.arange(intervals, 0, -1 * self.repeat, dtype=np.float)
   1086             ticks -= 0.5

TypeError: 'float' object cannot be interpreted as an integer

@QuLogic
Copy link
Member

QuLogic commented Jul 17, 2014

I've added two tests for day plots; one plain, one with an event. I've also fixed the bug indicated by the reporter. However, the error I found above is not fixed yet, since it doesn't seem to be triggered by the example I used.

This will probably fail due to a bug in python-future (PythonCharmers/python-future#76). There are also some warnings due to a bug in matplotlib (matplotlib/matplotlib#3271).

event.picks only exists if event is downloaded from neries. If event is
just a dictionary of time/text, then it shouldn't be accessed.
These don't currently work. The events are placed on the wrong line.
Also broken for same reasons as previous commit.
@QuLogic
Copy link
Member

QuLogic commented Jul 17, 2014

One more test for plotting events with a catalog. However, I'm pretty sure that plotting events is actually broken here. Things seem to end up on the wrong line at times. Edit: Never mind, was due to my workaround for the python-future bug. Will update reference images soon.

@QuLogic QuLogic added this to the 0.10.0 milestone Jul 18, 2014
@krischer
Copy link
Member

I'll merge this as soon as future 0.12.4 is released. Otherwise we would have a constantly failing build...

krischer added a commit that referenced this pull request Jul 18, 2014
Dayplot error when giving the events argument
@krischer krischer merged commit 26ca78c into obspy:master Jul 18, 2014
@QuLogic QuLogic deleted the dayplot-tests branch July 18, 2014 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed bug .imaging Issues with our plotting functionalities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants