[Yt-dev] Proposed Halo Profiler Change

Matthew Turk matthewturk at gmail.com
Fri Apr 8 08:32:27 PDT 2011


Hi Stephen,

I would propose it accept either a string that identifies an existing
recipe or a callable.

For identifying with strings, since we don't have *that* many, I would
suggest something very simple in a new file in the halo_profiling
directory:

centering_registry = {}

def add_function(name)
    def wrapper(func):
        centering_registry[name] = func
        return func
    return wrapper

@add_function("minimum_temperature")
def find_minimum_temperature ...

and then do "from centering_methods import centering_registry" in the
main .py file for halo profiling.  You could then do key lookups or
checking for callables on the centering argument.

-Matt

On Fri, Apr 8, 2011 at 11:28 AM, Stephen Skory <s at skory.us> wrote:
> Hi All,
>
> I am thinking of making a modification to how the halo profiler works,
> which I think will be an improvement. I wanted to pass this idea by
> you all (especially Britton) just to make surre I'm not stepping on
> any toes or there's some problem with this I haven't thought of.
>
> Currently, if you want to adjust the center of a halo for the purposes
> of making the profile, such as to the point of maximum gas density in
> the sphere defined by the halo, you'd call the HaloProfiler with
> ``use_density_center=True``. But if instead you want to use some other
> fields maximum point, you specify it using the
> ``use_field_max_center`` keyword. There is no functionality for
> specifying that the center should be moved to the minimum of some
> quantity, like the temperature for a cool-core cluster. I could easily
> add a parameter like that ``use_field_min_center``, but I think that
> this is quickly becoming unwieldy and inelegant.
>
> I propose that these two extant parameters, and any future ones like
> the example above, be replaced by a simple function that can be passed
> to the HaloProfiler object. For example, if you'd want to recenter on
> the maximum density point, it might look something like this:
>
> def _recenter_on_dens(sphere):
>    ma, maxi, mx, my, mz, mg = sphere.quantities['MaxLocation']('Density')
>    return [mx,my,mz]
>
> hp = HP.halo_profiler("DD0242/DD0242", recenter=_recenter_on_dens)
>
> The function can do whatever the user wants, unlike the limitations of
> the specific parameters currently in the HaloProfiler. I'd of course
> add some useful examples to the documentation. Let me know what you
> think, thanks!
>
>
> --
> Stephen Skory
> s at skory.us
> http://stephenskory.com/
> 510.621.3687 (google voice)
> _______________________________________________
> Yt-dev mailing list
> Yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>



More information about the yt-dev mailing list