[yt-users] How to find densest point in subvolume of Gadget data

Nathan Goldbaum nathan12343 at gmail.com
Sat May 2 16:35:49 PDT 2015


Ah yes, the "ds" attribute of a data object is a reference to the dataset
itself.  Sorry that wasn't clear initially.

On Saturday, May 2, 2015, Aaron Smith <asmith at astro.as.utexas.edu> wrote:

>  Hi all,
>
> Joe decided (offlist) to directly access the region object itself. Because
> re.ds references the dataset that the region came from, instead of using
>
>    1. ds = load('myfile.hdf5',over_refine_factor=1)
>     2. re = ds.region(center=[750]*3, left_edge=[700]*3, right_edge=[800]*
>    3)
>     3. ad = re.ds.all_data()
>     4. density = ad[("PartType0","density")]
>     5. wdens = np.where(density == np.max(density))
>     6. coordinates = ad[("PartType0","Coordinates")]
>     7. cen = coordinates[wdens][0]
>
> the question can be resolved with
>
>    1. ds = load('myfile.hdf5',over_refine_factor=1)
>     2. re = ds.region(center=[750]*3, left_edge=[700]*3, right_edge=[800]*
>    3)
>     3. density = re[("PartType0","density")]
>     4. wdens = np.where(density == np.max(density))
>     5. coordinates = re[("PartType0","Coordinates")]
>     6. cen = coordinates[wdens][0]
>
>
> Cheers,
> Aaron
>
> --
> Aaron Smith
> NSF Graduate Research Fellow
> Department of Astronomy
> University of Texas at Austinwww.as.utexas.edu/~asmith
>
>
> On 5/2/15 5:27 PM, Joseph Smidt wrote:
>
> Hey everyone,
>
>     I am trying to find the densest point in Gadget data in the
> subvolume with left edge [700]*3 and right edge [800]*3 where 700 and
> 800 are in code units.
>
>      This is what I do [1],  which was inspired by this page [2],
> except I try and take the all_data confined to a region.  The output
> [3] says however where you will note the center is not inside the
> region. It found the densest point in the whole data set, not the
> region.
>
>     So how would I do this instead for a subvolume of Gadget data?  Thanks.
>
>
> [1] http://pastebin.com/kyUgEi3a
>
> [2] http://yt-project.org/doc/cookbook/gadget_notebook.html
>
> [3]  http://pastebin.com/E4aLb5VC
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150502/e6d94a64/attachment.html>
-------------- next part --------------
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org


More information about the yt-users mailing list