[yt-users] dynamic derived fields

Charles Hansen chansen at astro.berkeley.edu
Wed May 12 00:24:58 PDT 2010


Hi all,

Is it possible to make something like a derived field in yt that takes 
passed variables?  A simple example would be extracting gas density 
above a certain temperature, but changing that temperature threshold on 
the fly

def _hotgas(field, data, temperature_threshold):
    reutrn data["density"]*(data["Temperature"] > temperature_threshold)
add_field("hotgas", function=_hotgas, Something else goes here?)

In this particular case I only need a few temperatures and can make a 
new derived quantity each time, but it seems like a generally useful 
ability.

Thanks,
Charles



More information about the yt-users mailing list