[yt-users] accessing single elements of data when defining a new field

sacielo sacielo at gmail.com
Tue Jul 11 02:59:35 PDT 2017


Hello

I am trying to define a new field for a grid simulation (using ramses, if
it matters), basically an estimate of radiative cooling in a simulation
that does not include that.

I find myself to perform a 2D interpolation in a table (cooling rate given
temperature and metal content), then I wish to save this as a new field. I
am using a scipy 2D interpolator in order to do so. The problem is that for
the interpolation I need to access the single elements in the temperature
and metal fields, within the function I use to define a new dataset
(unfortunately, I am forced to loop on the fields).

Now, I can't understand how to do that from the "data" and "field"
arguments of the functions.

Something like
t = data['temperature']
for ii in range(0, len(t)):
    print t[ii]

fails (t[ii] is a complex array itself)

t.base() and t.item() or t[ii].item()

fail as well....


Any idea?

Thank you!


-- 
Salvatore
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170711/5a25b1e8/attachment.htm>


More information about the yt-users mailing list