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
ray path plotting routine #1236
Conversation
Perhaps you have missed it (likely because of our slow release rate), but there is already a plotting routine in Expanding the existing stuff to 3D and to handle an entire |
Looks great :-) In terms of code structure I think it would be much better to but all plotting code into class Inventory(...):
...
def plot_rays(self, *args, **kwargs):
from obspy.imaging.inventory import plot_rays
plot_rays(inventory=self, *args, **kwargs) The plot_rays(inventory, event=None, event_latitude=None,
event_longitude=None, event_depth_in_m=None):
... |
OK agree. I just don't see that these things are really 'imaging' in the sense of tomography. They are more visualization routines. That's why it seems strange to put them in this module. |
Haha...i did not realize that confusion. |
ok I'll try to see it as visualization then :) |
Bright color scheme is much better to see for me, at least in the examples above.. |
It looks like you're creating your own colour scheme by hand. That should not be necessary. Since we have a hard dependency on matplotlib, you can just pull the colour map from there. Even better would be to use the existing colour set. Also, it seems you have not configured your git client with your email address, is there a reason you have not done so? The first commit here is attributed to |
ok. I use the taup colors now but I have to change the lightness and saturation because it is essential to see something in the 3d plots. sorry about my email address, I'll try not to change it anymore! |
I pushed some small things to make it a bit easier to use. Looks really cool :-) A couple notes:
|
Considering that Mayavi is very unstable for me I played around a bit and maybe we can do this completely in WebGL. The nice thing is that the only dependency is a web browser which everyone has and it would even work in the notebooks. Also the render quality seems to be higher (I cannot get mayavi to render with antialiasing) and it is probably a bit easier to add interactivity. Super unpolished toy example (12 MB of data...so you might have to wait a second): http://www.geophysik.uni-muenchen.de/~krischer/raypaths/ |
@krischer Wow! That is impressive! (except for the earthquake at north pole :). Which tool do you use to generate WebGL? |
Yea...the coordinate system for the rays (or the textures) has to be rotated so its not fully correct as of now ;-) This uses three.js: http://threejs.org/ |
@krischer great thing!!! This will certainly attract some people to the lmu server :) |
also hopefully to obspy |
my mayavi is absolutely stable btw. Maybe it is an issue of your graphic cards driver? |
@MMesch WOOOOW amazing! |
Another though (sorry about all the mini posts): The Pdiff issue should be solved in the taup module directly in my opinion |
Great movie :-)
I'll give this a real shot then. I'll try to mimik your plot and the website will just be output of
Hmm...who knows :-( I have a macbook with the same graphic card as ten million other people and it usually works fine enough.
I'm not sure - it is not wrong in the spherical coordinate systems. The plotting just forces a cartesian interpolation which is wrong. But it has to happen before the geographical routines take over, otherwise we have to deal with circular longitudes and wrap around effects... |
The right thing would be to do a spherical interpolation in taup_geo before it is passed to geographiclib then. EDIT: should we open an issue for this? Also the complete mayavi scene can be composed as pure vtk files. It is then independent from any instabilities and can be displayed e.g. with paraview. I'm not sure what limitations you might encounter with pure OpenGL. I guess since we use very basic geometries only (lines, spheres, cones), it shouldn't be to difficult to rewrite it. It would probably be more stable but we wouldn't have lights or the whole graphical user interface of mayavi. webGL on the other hand really adds more fuctionality, so I think it is worth it! |
One more thing: the taup_geo routine seems to be somewhat inaccurate for PKIKP phases. E.g. in the video that I have posted, rays that arrive at stations that are close to the antipode do not exactly converge at the station longitude latitude. I am not sure why this is the case. Either a taup problem, or maybe the ellipticity is not treated correctly ? |
Hmm.. a general comment regarding the ray path plots: To me those plots seem incredibly overcrowded, I wouldn't know where to start trying to interpret those.. I am not a tomo-guy but I guess this is mostly about knowing where and which rays hit some zone of interest (e.g. CMB). Wouldn't it make more sense to do e.g. a 2D (or 3D) ortho map-plot and plot into it the pierce points (e.g. pierce points at CMB but plotting coastlines over it), labelled by e.g. "{event_id}:{station_code}", or do a heatmap/hexbin of pierce points (to visualize sensitivity of the data set regarding some region and layer of interest)? |
|
Yeah, that's absolutely right of course. |
I'm not saying it'll be any easier, but maybe you should try VisPy too? It supports many backends including WebGL and the notebook without need for any JS (hopefully). Unfortunately, it's not quite as mature as matplotlib, so you definitely need to use a git clone. |
I've added a small test for the path resampling, rebased and force pushed. I remove the vtk output, @MMesch if you offer to add a test for it I would consider keeping it. Otherwise I'll improve the test "test_compute_ray_paths" maybe in the evening because right now it's hardly testing anything, just asserting that a list with one item is returned. |
@MMesch next time please take some time to implement a real test. This is really not cutting it: |
Haha yes. The real test used to be an image comparison. But I agree that it
is better not to have any mayavi/vtk stuff on travis...
Am 11.10.2017 18:06 schrieb "Tobias Megies" <notifications@github.com>:
… @MMesch <https://github.com/mmesch> next time please take some time to
implement a real test. This is really not cutting it:
https://github.com/obspy/obspy/pull/1236/files#diff-
dd572eba2d259313f2468ec5ae6d42d9R56
[image: screenshot from 2017-10-11 18-06-14]
<https://user-images.githubusercontent.com/1842780/31452334-eba8a958-aeae-11e7-85b4-28bf77f8ac99.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1236 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACejq_wqCpTSOnf1Uhpo6P0QFwirL3OAks5srOebgaJpZM4HUuJw>
.
|
obspy/taup/ray_paths.py
Outdated
radii * np.sin(thetas) * np.sin(phis), | ||
radii * np.cos(thetas)]) | ||
|
||
value = 0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MMesch can you elaborate on the significance of always adding 0.0 to the output tuple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it seems like bad design to include spaces for padding in the textual headers of the paths.. this should be done in the plotting part.. (coordinates in data array for path omitted below)
[(array([[...]]), u'P', 0.0, u' NET.STA', u' 2017-10-12 | M7.0')]```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll also include the event id to the output tuple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the long run this routine could also use the information in the Event.arrivals
to figure out what rays really exist in the data set.. but I guess in many cases such detailed info is not included in the Event data..
agree that's better
originally, I wanted to leave the routine flexible to add a value such as the amplitude from the radiation pattern to the ray path. This can be removed or organized in a better way if you have a better idea! |
add event and origin id to output, remove leading spaces from labels of rays (station code and basic event info string)
I hope this should do it now.. added some proper tests and sanitized output of get_ray_paths some |
Great, thanks for your help @megies. The question is whether we put the
mayavi/vtk moment tensor also in a separate repository - to some kind of
vtk based visualisation library based on obspy..
Am 12.10.2017 18:01 schrieb "Tobias Megies" <notifications@github.com>:
… Looks like CI is gonna give the nod.. @krischer
<https://github.com/krischer> @MMesch <https://github.com/mmesch> I think
this is good to go when Travis completes.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1236 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACejq1bHVXJE8uJTzNqd9q2yAgJ-f3veks5srjfogaJpZM4HUuJw>
.
|
Sure, go ahead. |
string containing both
Gonna push one additional minor change and will merge this once CI goes green then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments. I can also do it if you are currently not working on it.
obspy/core/util/testing.py
Outdated
@@ -203,10 +203,21 @@ def compare_images(expected, actual, tol): | |||
"shape %s." % (str(actual_image.shape), | |||
str(expected_image.shape))) | |||
|
|||
if actual_image.shape[2] == 4: | |||
has_alpha_channel = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to keep this alpha channel handling? If it is not going to be used it might become stale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, guess you're right, I'll remove it.
@@ -0,0 +1,82 @@ | |||
#Network | Station | Latitude | Longitude | Elevation | SiteName | StartTime | EndTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file can also be removed I think
currently not used in any test
Should be ready now.. gonna merge when CI goes green. |
I'll merge this locally and squash everything into one commit, to avoid polluting our master history with all the binary stuff. The history and full diff across individual commits can then still be looked up here and at https://github.com/mmesch/obspy/tree/gc_paths |
(locally squashed into a single commit)
This was merged locally after squashing history, see 6b43db0. |
This is probably another longer duration pull request. It adds functions for greatcircle path plotting in 2D and 3D to obspy, based on geographiclib and taup. It is already working but needs to be structured nicely. Here is an example, plotted again with mayavi (green = P, blue = Pdiff, red = PKP), but plotting could be done with matplotlib and vtk file output again. Right now it works for one event and and inventory, but I think now it is easy to expand it to a catalog and an inventory together.
+DOCS