[yt-users] question about derived fields that require field_parameters

Hilary Egan hilaryye at gmail.com
Wed Jun 17 09:22:34 PDT 2015


This doesn't quite answer your question, but to get the max val/location of
the baryon overdensity I generally just do

ad = ds.all_data()
ad.set_field_parameter('omega_baryon', 0.44)

max_loc = ad.quantities.max_location('baryon_overdensity')
extrema  = ad.quantities.extrema('baryon_overdensity')

-Hilary


On Wed, Jun 17, 2015 at 6:24 AM, Brian O'Shea <bwoshea at gmail.com> wrote:

> Hi folks,
>
> I'm doing some analysis on an Enzo simulation using the tip of yt-3, and
> would like to find the maximum and minimum of the field
> "baryon_overdensity", which is a derived field.  If I were to make a
> projection or slice of this field, I'd have to feed in omega_baryon so that
> baryon_overdensity can be created on the fly, e.g.,
>
> plot1 =
> yt.ProjectionPlot(ds,'z',"baryon_overdensity",weight_field="baryon_overdensity",
>                               center=c,data_source=my_region,
> field_parameters = {'omega_baryon': 0.046})
>
> However, if I try to run find_max("baryon_overdensity") on my dataset, it
> complains that the derived field needs omega_baryon, with an error message
> ending in this:
>
> /Users/bwoshea/Desktop/yt-3/src/yt-hg/yt/fields/derived_field.pyc in
> __call__(self, data)
>     237                 doesnt_have.append(p)
>     238         if len(doesnt_have) > 0:
> --> 239             raise NeedsParameter(doesnt_have)
>     240         return True
>     241
>
> NeedsParameter: (['omega_baryon'])
>
>
> This makes sense; however, I can't feed omega_baryon to find_max() in the
> same way that I can feed field_parameters into ProjectionPlot.  Is there a
> way to either (1) force yt to generate the baryon_overdensity field prior
> to calling find_max(), or (2) feed omega_baryon into find_max()?  I think
> that option #2 is not trivial, since the source code for find_max (in
> src/yt-hg/yt/data_objects/static_objects.py) only takes the name of the
> field.  I suspect that #1 is possible, though I can't find anything in the
> documentation about it.
>
> Any suggestions would be greatly appreciated.  Thanks!
>
> --Brian
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150617/9acd4232/attachment.html>


More information about the yt-users mailing list