[yt-users] find densest point in sphere?

Matthew Turk matthewturk at gmail.com
Mon Dec 6 15:31:52 PST 2010


Hi Mike,

I thought spheres and other data_containers implemented find_max, but
looking just now I see they definitely do not.  I'm adding this to my
todo list.

BUT!  You can still use the quantities interface to get this
information out.  If you want to know how to access the value, you can
do:

sphere.quantities["MaxLocation"]("Density")

Or, you can get the extrema:

sphere.quantities["Extrema"]("Density")

You can also calculate several extrema in a single pass:

sphere.quantities["Extrema"](["Density", "Temperature"])

Note that even if you only calculate one, it's returned as a list of
tuples, so you'd do:

rho_min, rho_max = sphere.quantities["Extrema"]("Density")[0]

-Matt

On Mon, Dec 6, 2010 at 3:28 PM, Michael Kuhlen <mqk at astro.berkeley.edu> wrote:
> Hi
>
> How would I go about finding the densest point in a region, say a sphere?
>
> I'd like something like AMRHierarchy.find_max, but for AMRSphereBase:
>
> pf = load(filename)
> sphere = pf.h.sphere(center, radius)
> v,c = sphere.find_max("Density")
>
>
> I guess I could retrieve all high resolution grids with select_grids()
> and then do a find_max() on each of those grids, but I'm hoping there's
> something nicer.
>
> Thanks,
>
> Mike
>
> --
> *********************************************************************
> *                                                                   *
> *  Dr. Michael Kuhlen              Theoretical Astrophysics Center  *
> *  email: mqk at astro.berkeley.edu   UC Berkeley                      *
> *  cell phone: (831) 588-1468      601 Campbell Hall                *
> *  skype username: mikekuhlen      Berkeley, CA 94720               *
> *                                                                   *
> *********************************************************************
>
>
> _______________________________________________
> 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