[yt-users] find densest point in sphere?

Michael Kuhlen mqk at astro.berkeley.edu
Mon Dec 6 15:47:25 PST 2010


Thanks Matt, works like a charm.

Note that quantities["MaxLocation"](field) returns a 6 element array:
[max_value, max_arrayindex, max_xpos, max_ypos, max_zpos, max_gridindex]

I had to dig this out of $YTDIR/yt/data_objects/derived_quantities.py,
as it's not well documented otherwise:

MaxLocation(field): (This is a proxy for yt.lagos._MaxLocation().) This
function returns the location of the maximum of a set of fields.

Cheers,

Mike


On 12/06/2010 03:31 PM, Matthew Turk wrote:
> 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
>>
>>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

-- 
*********************************************************************
*                                                                   *
*  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               *
*                                                                   *
*********************************************************************

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20101206/8616dba1/attachment.pgp>


More information about the yt-users mailing list