Hello I am a new user to yt and am also new to python as a coding language. I do have past coding experiences but that is not important. I have been making graphs based on the files given on yt_data and am now trying to see if I can grab specific data from points within the graph. I saw that yt can do that with a sphere and its radius but I would like to see if there was a way to do the same with projection plots (other graphs as well). Specifically what I want to ask is if I can grab data from a graph at specific points within it or if I can draw a line within the graph and grab the data from those lines, and how I would be able to do that. I would be really grateful if someone could help, but if not it is okay. Thank you, Daniel56
Hi Daniel, There are a couple ways to do this, but the first thing to check -- do you want the data from the simulation, or do you want it from the output image? For instance, with a slice these two things are basically the same. But for a projection, they'll be different, as the projection is the integration along a sight line. To query along a line, you can either use a data object like ds.ray , which accepts a 3D starting point and ending point, and accessing those values, or you can try using matplotlib's built-in methods for accessing it. You can also access the data buffer by accessing the slice plot's sub-objects. This is described a bit in this document: https://yt-project.org/doc/visualizing/manual_plotting.html There are also methods to export to, for instance, ds9 and glue which you can access on the underlying data_source object. I hope that helps -- and if not, let us know! -Matt On Tue, Mar 12, 2024 at 9:32 PM Daniel Ruvalcaba <danruval0@gmail.com> wrote:
Hello I am a new user to yt and am also new to python as a coding language. I do have past coding experiences but that is not important. I have been making graphs based on the files given on yt_data and am now trying to see if I can grab specific data from points within the graph. I saw that yt can do that with a sphere and its radius but I would like to see if there was a way to do the same with projection plots (other graphs as well). Specifically what I want to ask is if I can grab data from a graph at specific points within it or if I can draw a line within the graph and grab the data from those lines, and how I would be able to do that. I would be really grateful if someone could help, but if not it is okay.
Thank you, Daniel56 _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: matthewturk@gmail.com
Hi I was figuring out the ray functions and seeing how they worked but I have run into the issue of the regular ray function not seeming to work how I thought it would. I have tried using the example programs that are listed in the Overplot the Path of a Ray and it seems the ray is not printing and only printing a singular value. This is my most recent efforts: my_ray = ds.ray((0.5, 0.6, 0), (0.5, 0.8, 0)) ray_sort = np.argsort(my_ray["t"]) density = my_ray[("gas", "density")][ray_sort] p = yt.ProjectionPlot(ds, "z", ("gas", "density")) p.annotate_ray(my_ray) p.show() print(density) I have also tried to do a for loop trying to go through the ray but for this and the for loop all it seems to print is [2.57707049e-27] g/cm**3. No matter what starting point or ending point I give it. I would very much appreciate some help with this if possible because I have no idea why this is doing what it is doing. Thank you, Daniel Ruvalcaba
I would also add that the ortho ray in that example seems to working like it should (it prints but I do not know the values it would give)
participants (3)
-
Daniel -
Daniel Ruvalcaba -
Matthew Turk