[yt-users] find densest point in sphere?

Matthew Turk matthewturk at gmail.com
Mon Dec 6 15:49:42 PST 2010


Thanks, Mike, you're completely right -- this can and should be better
described.  I'll ensure that the derived quantities have better
docstrings and comments in the documentation for the next release.

Speaking of which, the documentation is currently the major holdup on
moving the so-called stable branch to reflect the reorganized
codebase, with all the new bells and whistles that have since been
added.  Following that, Jeff's plot window will be added, I'll setup a
public-facing regression test server, and yt 2.0 will be released.

-Matt

On Mon, Dec 6, 2010 at 3:47 PM, Michael Kuhlen <mqk at astro.berkeley.edu> wrote:
> 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               *
> *                                                                   *
> *********************************************************************
>
>
> _______________________________________________
> 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