Density/Column density along a ray
Hi I'm still relatively new to yt, and I'm trying to figure out a way to extract the density along a ray joining two points. I've managed to make a plot using PlotCollection.add_ray, but I can't figure out how to get the actual data as a Numpy array. Also, I'd ultimately like to compute the cumulative column density along the ray, so I'd like to ensure that the sampling of distances along the ray is very fine to get an accurate column density. Is there a way to do this? Thanks for any help! Cheers, Tom
Hi Thomas, Try doing something like ray = pf.h.ray(start_point,end_point) density = ray['Density'] t = ray['t'] where t is the distance along the ray of each sample. It will, by default, sample at the highest available resolution. If you need subsampling/interpolation, you'll have to wait for someone more knowledgeable that I am to jump in. j On Wed, Aug 8, 2012 at 8:56 AM, Thomas Robitaille <thomas.robitaille@gmail.com> wrote:
Hi
I'm still relatively new to yt, and I'm trying to figure out a way to extract the density along a ray joining two points. I've managed to make a plot using PlotCollection.add_ray, but I can't figure out how to get the actual data as a Numpy array. Also, I'd ultimately like to compute the cumulative column density along the ray, so I'd like to ensure that the sampling of distances along the ray is very fine to get an accurate column density. Is there a way to do this?
Thanks for any help!
Cheers, Tom _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Thomas, In addition to ray['t'], which will give you the cumulative distance traveled at that point in the ray, you can use ray['dts'] to get the just the distance through each individual cell. Both of these will be normalized to the total distance of the ray, but you can use ray['dx'] to get you the cell size for each cell intersected by the ray, which you can then use along with 'dts' to calculate the physical distance the ray travels through each cell. Britton On Wed, Aug 8, 2012 at 12:03 PM, j s oishi <jsoishi@gmail.com> wrote:
Hi Thomas,
Try doing something like
ray = pf.h.ray(start_point,end_point)
density = ray['Density'] t = ray['t']
where t is the distance along the ray of each sample. It will, by default, sample at the highest available resolution. If you need subsampling/interpolation, you'll have to wait for someone more knowledgeable that I am to jump in.
j On Wed, Aug 8, 2012 at 8:56 AM, Thomas Robitaille <thomas.robitaille@gmail.com> wrote:
Hi
I'm still relatively new to yt, and I'm trying to figure out a way to extract the density along a ray joining two points. I've managed to make a plot using PlotCollection.add_ray, but I can't figure out how to get the actual data as a Numpy array. Also, I'd ultimately like to compute the cumulative column density along the ray, so I'd like to ensure that the sampling of distances along the ray is very fine to get an accurate column density. Is there a way to do this?
Thanks for any help!
Cheers, Tom _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Britton, I think the easiest way to get out physical distance would be to do: distance = ((end_point - start_point)**2.0).sum()**0.5 distance *= pf['cm'] # or whatever unit you want ray['dts'] * distance should give the distance traveled inside each cell. On Wed, Aug 8, 2012 at 12:09 PM, Britton Smith <brittonsmith@gmail.com> wrote:
Hi Thomas,
In addition to ray['t'], which will give you the cumulative distance traveled at that point in the ray, you can use ray['dts'] to get the just the distance through each individual cell. Both of these will be normalized to the total distance of the ray, but you can use ray['dx'] to get you the cell size for each cell intersected by the ray, which you can then use along with 'dts' to calculate the physical distance the ray travels through each cell.
Britton
On Wed, Aug 8, 2012 at 12:03 PM, j s oishi <jsoishi@gmail.com> wrote:
Hi Thomas,
Try doing something like
ray = pf.h.ray(start_point,end_point)
density = ray['Density'] t = ray['t']
where t is the distance along the ray of each sample. It will, by default, sample at the highest available resolution. If you need subsampling/interpolation, you'll have to wait for someone more knowledgeable that I am to jump in.
j On Wed, Aug 8, 2012 at 8:56 AM, Thomas Robitaille <thomas.robitaille@gmail.com> wrote:
Hi
I'm still relatively new to yt, and I'm trying to figure out a way to extract the density along a ray joining two points. I've managed to make a plot using PlotCollection.add_ray, but I can't figure out how to get the actual data as a Numpy array. Also, I'd ultimately like to compute the cumulative column density along the ray, so I'd like to ensure that the sampling of distances along the ray is very fine to get an accurate column density. Is there a way to do this?
Thanks for any help!
Cheers, Tom _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Thanks everyone for your replies - this is all very helpful! Thomas On 8 August 2012 18:14, Matthew Turk <matthewturk@gmail.com> wrote:
Hi Britton,
I think the easiest way to get out physical distance would be to do:
distance = ((end_point - start_point)**2.0).sum()**0.5 distance *= pf['cm'] # or whatever unit you want ray['dts'] * distance
should give the distance traveled inside each cell.
On Wed, Aug 8, 2012 at 12:09 PM, Britton Smith <brittonsmith@gmail.com> wrote:
Hi Thomas,
In addition to ray['t'], which will give you the cumulative distance traveled at that point in the ray, you can use ray['dts'] to get the just the distance through each individual cell. Both of these will be normalized to the total distance of the ray, but you can use ray['dx'] to get you the cell size for each cell intersected by the ray, which you can then use along with 'dts' to calculate the physical distance the ray travels through each cell.
Britton
On Wed, Aug 8, 2012 at 12:03 PM, j s oishi <jsoishi@gmail.com> wrote:
Hi Thomas,
Try doing something like
ray = pf.h.ray(start_point,end_point)
density = ray['Density'] t = ray['t']
where t is the distance along the ray of each sample. It will, by default, sample at the highest available resolution. If you need subsampling/interpolation, you'll have to wait for someone more knowledgeable that I am to jump in.
j On Wed, Aug 8, 2012 at 8:56 AM, Thomas Robitaille <thomas.robitaille@gmail.com> wrote:
Hi
I'm still relatively new to yt, and I'm trying to figure out a way to extract the density along a ray joining two points. I've managed to make a plot using PlotCollection.add_ray, but I can't figure out how to get the actual data as a Numpy array. Also, I'd ultimately like to compute the cumulative column density along the ray, so I'd like to ensure that the sampling of distances along the ray is very fine to get an accurate column density. Is there a way to do this?
Thanks for any help!
Cheers, Tom _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Thomas, I made a slight mistake in telling you how one can get the physical distance through each cell. Instead of using the 'dx' field, you just want to multiply ray['dts'] by the total distance of the ray in physical units. Sorry about that! Thanks to Matt for correcting my mistake. Britton On Wed, Aug 8, 2012 at 12:09 PM, Britton Smith <brittonsmith@gmail.com>wrote:
Hi Thomas,
In addition to ray['t'], which will give you the cumulative distance traveled at that point in the ray, you can use ray['dts'] to get the just the distance through each individual cell. Both of these will be normalized to the total distance of the ray, but you can use ray['dx'] to get you the cell size for each cell intersected by the ray, which you can then use along with 'dts' to calculate the physical distance the ray travels through each cell.
Britton
On Wed, Aug 8, 2012 at 12:03 PM, j s oishi <jsoishi@gmail.com> wrote:
Hi Thomas,
Try doing something like
ray = pf.h.ray(start_point,end_point)
density = ray['Density'] t = ray['t']
where t is the distance along the ray of each sample. It will, by default, sample at the highest available resolution. If you need subsampling/interpolation, you'll have to wait for someone more knowledgeable that I am to jump in.
j On Wed, Aug 8, 2012 at 8:56 AM, Thomas Robitaille <thomas.robitaille@gmail.com> wrote:
Hi
I'm still relatively new to yt, and I'm trying to figure out a way to extract the density along a ray joining two points. I've managed to make a plot using PlotCollection.add_ray, but I can't figure out how to get the actual data as a Numpy array. Also, I'd ultimately like to compute the cumulative column density along the ray, so I'd like to ensure that the sampling of distances along the ray is very fine to get an accurate column density. Is there a way to do this?
Thanks for any help!
Cheers, Tom _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (4)
-
Britton Smith -
j s oishi -
Matthew Turk -
Thomas Robitaille