Hi my name is Daniel, I was trying to figure 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
Hi Daniel, I can see two possible reasons for this. The first is that you're only touching a single cell -- this is often the case if you're using normalized unit coordinates inside a non-normalized dataset. So for instance if you're using (0.5, 0.6, 0) in a simulation that runs over many parsecs but is in units of cm, this would only touch one cell. You can see that by looking at `ds.domain_width` and seeing what it looks like. You might also be able to see how long the path length is in fractions of the domain by doing: (ds.arr([0.5, 0.8, 0.0]) - ds.arr([0.5, 0.6, 0.0])).in_units("unitary") That will take both values and then show them in a fraction of the domain. The other thing that could be happening is that you may need to offset from the edge of the domain. Try setting your two 0's to different but very very small values. (Alternately, use the ortho_ray if you have an orthogonal ray.) On Thu, Apr 25, 2024 at 12:06 PM Daniel <danruval0@gmail.com> wrote:
Hi my name is Daniel, I was trying to figure 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 _______________________________________________ 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
participants (2)
-
Daniel -
Matthew Turk