[yt-users] Integration of a field along line of sight

Slavin, Jonathan jslavin at cfa.harvard.edu
Wed Nov 1 05:53:30 PDT 2017


Hi Tazkera,

You can always get rays and do the integration yourself:

ray = ds.ray(p1,p2)
dens = ray['density']

where p1 and p2 are tuples of the end points of the ray.  If you're using
cartesian coordinates then you can also get x, y and z along the ray:
x = ray['x']
etc.
then the position is just
r = np.sqrt(x**2 + y**2 + z**2)
and you can use a numpy or scipy integration method.
If you're using data from an AMR run you may need to sort the data:
tord = ray['t'])
dens = ray['dens'][tord]
and similarly for other data from the ray.

Regards,
Jon

On Wed, Nov 1, 2017 at 1:17 AM, <yt-users-request at lists.spacepope.org>
wrote:
>
> Date: Tue, 31 Oct 2017 17:56:39 -0400
> From: tazkera haque <h.tazkera at gmail.com>
> To: Discussion of the yt analysis package
>         <yt-users at lists.spacepope.org>
> Subject: [yt-users] Integration of a field along line of sight
> Message-ID:
>         <CAFj_7zy_P2FrQSf9DMi0-DkXZOOSvdW=poWO_JzZ_cgQD+aCYQ@
> mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Dear YT people,
>
> I need to do integration of density field along line of sight. I know the
> ProjectionPlot function plots the integration of a field along line of
> sight.
>
> yt.ProjectionPlot(ds, 'z', 'density, center= 'm')
>
> However, I was wondering if it is possible to get the projection as an
> array (or new field) , so that I can make a ProfilePlot  of the integrated
> field along line of sight and another field ('Mass')
>
> In other words, I want to do the following:
>
> sp = ds.sphere("max", (200, "kpc"))
> proj = yt.ProfilePlot(sp, 'Integrated_Density_along_Line_Of_Sight', 'Mass)
>
> Thanks
> Tazkera
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.
> org/attachments/20171031/038832cb/attachment-0001.html>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
> ------------------------------
>
> End of yt-users Digest, Vol 116, Issue 34
> *****************************************
>



-- 
________________________________________________________
Jonathan D. Slavin                 Harvard-Smithsonian CfA
jslavin at cfa.harvard.edu       60 Garden Street, MS 83
phone: (617) 496-7981       Cambridge, MA 02138-1516
cell: (781) 363-0035             USA
________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20171101/4ee22b8f/attachment.html>


More information about the yt-users mailing list