<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Thanks Matthew for your reply,<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">the general problem of doing that is that the 'data' structure can point to arrays of 1, 2 or 3 dimensions, so it's difficult to loop over it. I ended up solving the problem in a better way:<br></div><div class="gmail_default" style="font-family:monospace,monospace">I switched to a scipy RectBivariateSpline interpolator, rather than a simpler interp2d object.<br></div><div class="gmail_default" style="font-family:monospace,monospace">Now I no more need to loop on the single elements, and can pass the full arrays. <br>To get the numerical array, now I could simply use <br>data['mydata'].value<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">(I had to reshape it to a 1D array, but that was easy).<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">Thank you anyway!<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">Best,<br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 12, 2017 at 6:14 PM,  <span dir="ltr"><<a href="mailto:yt-users-request@lists.spacepope.org" target="_blank">yt-users-request@lists.spacepope.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send yt-users mailing list submissions to<br>
        <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:yt-users-request@lists.spacepope.org">yt-users-request@lists.<wbr>spacepope.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:yt-users-owner@lists.spacepope.org">yt-users-owner@lists.<wbr>spacepope.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of yt-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: accessing single elements of data when defining a     new<br>
      field (Matthew Turk)<br>
   2. Re: IO error (Britton Smith)<br>
   3. Re: Field extraction from arbitrary grids (Carla Bernhardt)<br>
   4. 3-D Mass power spectra (???)<br>
   5. Re: 3-D Mass power spectra (Nathan Goldbaum)<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
<br>
Message: 1<br>
Date: Tue, 11 Jul 2017 07:16:20 -0500<br>
From: Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>><br>
To: Discussion of the yt analysis package<br>
        <<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
Subject: Re: [yt-users] accessing single elements of data when<br>
        defining a      new field<br>
Message-ID:<br>
        <CALO3=<wbr>5GQeESENDeFQR70aeE9EtcNOcwUUrh<wbr>xJYN_9+PhyPz=<a href="mailto:oA@mail.gmail.com">oA@mail.gmail.com</a><wbr>><br>
Content-Type: text/plain; charset="UTF-8"<br>
<br>
Hi Salvatore,<br>
<br>
This is odd -- I believe that it should work as you have written it.<br>
Can you describe how it fails?  And, what happens if instead of doing<br>
<br>
for ii in range(0, len(t)):<br>
<br>
you did something like:<br>
<br>
for val in t:<br>
<br>
and then operated on val?<br>
<br>
On Tue, Jul 11, 2017 at 4:59 AM, sacielo <<a href="mailto:sacielo@gmail.com">sacielo@gmail.com</a>> wrote:<br>
> Hello<br>
><br>
> I am trying to define a new field for a grid simulation (using ramses, if it<br>
> matters), basically an estimate of radiative cooling in a simulation that<br>
> does not include that.<br>
><br>
> I find myself to perform a 2D interpolation in a table (cooling rate given<br>
> temperature and metal content), then I wish to save this as a new field. I<br>
> am using a scipy 2D interpolator in order to do so. The problem is that for<br>
> the interpolation I need to access the single elements in the temperature<br>
> and metal fields, within the function I use to define a new dataset<br>
> (unfortunately, I am forced to loop on the fields).<br>
><br>
> Now, I can't understand how to do that from the "data" and "field" arguments<br>
> of the functions.<br>
><br>
> Something like<br>
> t = data['temperature']<br>
> for ii in range(0, len(t)):<br>
>     print t[ii]<br>
><br>
> fails (t[ii] is a complex array itself)<br>
><br>
> t.base() and t.item() or t[ii].item()<br>
><br>
> fail as well....<br>
><br>
><br>
> Any idea?<br>
><br>
> Thank you!<br>
><br>
><br>
> --<br>
> Salvatore<br>
><br>
> ______________________________<wbr>_________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
><br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Tue, 11 Jul 2017 11:09:12 -0700<br>
From: Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>><br>
To: Discussion of the yt analysis package<br>
        <<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
Subject: Re: [yt-users] IO error<br>
Message-ID:<br>
        <<a href="mailto:CABfs61k3p07Yfcze8Jrf3-wjwfe38nWN5Yb1vv1cnWANi-m47Q@mail.gmail.com">CABfs61k3p07Yfcze8Jrf3-<wbr>wjwfe38nWN5Yb1vv1cnWANi-m47Q@<wbr>mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi everyone,<br>
<br>
I just wanted to provide some resolution to this issue.  The issue had to<br>
do with some problems that have cropped up when trying to read hdf5 string<br>
attributes in Python 3.  You wouldn't see this if you were still using<br>
Python 2.  This has been resolved with the following pull request, which<br>
has already been accepted:<br>
<a href="https://github.com/yt-project/yt/pull/1487" rel="noreferrer" target="_blank">https://github.com/yt-project/<wbr>yt/pull/1487</a><br>
<br>
Britton<br>
<br>
On Mon, Jul 10, 2017 at 1:13 PM, Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>><br>
wrote:<br>
<br>
> Hi Nick,<br>
><br>
> This is a bit puzzling since I think there have been relatively few<br>
> changes to the halo catalog frontend responsible for loading that data.<br>
> That said, I would be more than happy to take a look as I am responsible<br>
> for much of this code.  Would you be able to share either 1) this dataset<br>
> that is failing to load or 2) a script that uses example data that I can<br>
> run to reproduce this?<br>
><br>
> Britton<br>
><br>
> On Mon, Jul 10, 2017 at 8:53 AM, Nick Gnedin <<a href="mailto:ngnedin@gmail.com">ngnedin@gmail.com</a>> wrote:<br>
><br>
>><br>
>> Folks,<br>
>><br>
>> I have encountered a bizarre IO error. I am reading a file previously<br>
>> created by yt HOP halo finder on two separate machines. The file reads<br>
>> correctly on the machine it was created on, but on another machine with the<br>
>> most recent anaconda install (yt 3.3.5) the format is not recognized. Both<br>
>> machines are little endian. Is there any way to get more info on what yt<br>
>> does not like about that file?<br>
>><br>
>> yt : [ERROR    ] 2017-07-10 10:46:00,454 Couldn't figure out output type<br>
>> for hop.0.h5<br>
>> Traceback (most recent call last):<br>
>>   File "hmf.py", line 14, in <module><br>
>>     Plot("hop.0.h5",color="b")<br>
>>   File "hmf.py", line 8, in Plot<br>
>>     my_halos = load(file)<br>
>>   File "/ext/anaconda3/lib/python3.6/<wbr>site-packages/yt/convenience.<wbr>py",<br>
>> line 98, in load<br>
>>     raise YTOutputNotIdentified(args, kwargs)<br>
>> yt.utilities.exceptions.<wbr>YTOutputNotIdentified: Supplied ('hop.0.h5',)<br>
>> {}, but could not load!<br>
>><br>
>> Here is the script (taken form your examples):<br>
>><br>
>><br>
>> import yt<br>
>> from yt.mods import *<br>
>> from yt.analysis_modules.halo_mass_<wbr>function.api import *<br>
>> import matplotlib.pyplot as plt<br>
>><br>
>> def Plot(file,color="r"):<br>
>>     my_halos = load(file)<br>
>>     hmf = HaloMassFcn(halos_ds=my_halos)<br>
>>     plt.loglog(hmf.masses_<wbr>analytic, hmf.n_cumulative_analytic,colo<br>
>> r="orange",linewidth=3)<br>
>>     plt.loglog(hmf.masses_sim, hmf.n_cumulative_sim,color=col<br>
>> or,linewidth=3)<br>
>><br>
>> Plot("hop.0.h5",color="b")<br>
>><br>
>><br>
>> Thank you for your advice,<br>
>><br>
>> Nick Gnedin<br>
>> ______________________________<wbr>_________________<br>
>> yt-users mailing list<br>
>> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
>><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170711/19feaa01/attachment-0001.htm" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>pipermail/yt-users-spacepope.<wbr>org/attachments/20170711/<wbr>19feaa01/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Wed, 12 Jul 2017 12:35:14 +0200<br>
From: Carla Bernhardt <<a href="mailto:carla.j.bernhardt@gmail.com">carla.j.bernhardt@gmail.com</a>><br>
To: Discussion of the yt analysis package<br>
        <<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
Subject: Re: [yt-users] Field extraction from arbitrary grids<br>
Message-ID:<br>
        <<a href="mailto:CAKQMXAWJWUANaiSVaMBoBMEcPKST%2BUUN--4QLj_nLwEDKV7q2Q@mail.gmail.com">CAKQMXAWJWUANaiSVaMBoBMEcPKST<wbr>+UUN--4QLj_nLwEDKV7q2Q@mail.<wbr>gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi Matthew,<br>
<br>
Thank you for your reply. I was using yt Version 3.2.3 and am working out<br>
some installation issues on our server with version 3.3.5. As for the type<br>
of data, I have an enzo simulation with static nested grids as well as up<br>
to 6 levels AMR grids. I will have to get back to you once I get past the<br>
issues with the newest installation of yt.... Thanks for the initial<br>
pointers.<br>
<br>
Cheers,<br>
Carla<br>
<br>
2017-07-11 14:15 GMT+02:00 Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>>:<br>
<br>
> Hi Carla,<br>
><br>
> Interesting.  It's possible, for the call to "temperature" (which<br>
> raises NotImplementedError) that the version of yt you're on doesn't<br>
> yet support mesh fields in arbitrary grids; that was added reasonably<br>
> recently.  For the others, I'm not totally sure why it's breaking --<br>
> which version of yt are you using, and what type of data?  It may just<br>
> be that they aren't deposit fields.  In that case, try explicitly<br>
> stating obj["gas","temperature"] or obj["gas","HI_Density"].  It may<br>
> also be that the aliasing is getting in the way, in which case instead<br>
> of "HI_Density" you might need to try "Hp0_density".<br>
><br>
> On Tue, Jul 11, 2017 at 5:42 AM, Carla Bernhardt<br>
> <<a href="mailto:carla.j.bernhardt@gmail.com">carla.j.bernhardt@gmail.com</a>> wrote:<br>
> > Dear yt-users,<br>
> ><br>
> > I am trying to extract a unigrid data cube within a specific region and<br>
> > specified dimensions, thus I am using arbitrary_grid(), however, beyond<br>
> the<br>
> > example given in the docs, my field extractions all fail. I would like to<br>
> > extract temperature, HI_Density and HII_Density. Here is a snippet from<br>
> my<br>
> > code:<br>
> ><br>
> > obj = ds.arbitrary_grid(left_edge, right_edge, dims=[256, 256, 256])<br>
> > print(obj["deposit", "all_density"])<br>
> > print(obj["temperature"])<br>
> > print(obj["HI_Density"])<br>
> ><br>
> > The line print(obj["deposit", "all_density"]) works, but the two lines<br>
> after<br>
> > both fail. Here is the traceback from the temperature, and I even tried<br>
> out<br>
> > deposited temperature and deposited HI_Density. Am I formatting this<br>
> > incorrectly, or is there a different way to extract the fields?<br>
> ><br>
> > Kind regards,<br>
> > Carla Bernhardt<br>
> > PhD Student<br>
> > ZAH Institut f?r Theoretische Astrophysik<br>
> > Universit?t Heidelberg<br>
> ><br>
> > ______________________________<wbr>_________________<br>
> > yt-users mailing list<br>
> > <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> > <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
> ><br>
> ______________________________<wbr>_________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170712/a46e0643/attachment-0001.htm" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>pipermail/yt-users-spacepope.<wbr>org/attachments/20170712/<wbr>a46e0643/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Thu, 13 Jul 2017 00:10:02 +0800<br>
From: ??? <<a href="mailto:setsuna@phys.tw">setsuna@phys.tw</a>><br>
To: Discussion of the yt analysis package<br>
        <<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
Subject: [yt-users] 3-D Mass power spectra<br>
Message-ID:<br>
        <<a href="mailto:CAEtGJOz5LssuwrWmuXSYO%2Bu77DPaW2v5yPM2TGFg%2BCYP2AV%2B7A@mail.gmail.com">CAEtGJOz5LssuwrWmuXSYO+<wbr>u77DPaW2v5yPM2TGFg+CYP2AV+7A@<wbr>mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Dear yt<br>
<br>
Can current yt calculate 3-D Mass power spectra? I checked the website but<br>
I didn't find any information. I think calculating 3-D Mass power<br>
spectra is a very useful for cosmological simulations. So I guess maybe yt<br>
supports this function now....?<br>
<br>
Thanks in advance<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170713/a3c9b005/attachment-0001.htm" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>pipermail/yt-users-spacepope.<wbr>org/attachments/20170713/<wbr>a3c9b005/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Wed, 12 Jul 2017 11:13:50 -0500<br>
From: Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com">nathan12343@gmail.com</a>><br>
To: Discussion of the yt analysis package<br>
        <<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
Subject: Re: [yt-users] 3-D Mass power spectra<br>
Message-ID:<br>
        <CAJXewO=<a href="mailto:CQ3%2BPKt_jL9QBPvYd4g7hc7VrKLBD01W33u9jXvg7gw@mail.gmail.com">CQ3+PKt_<wbr>jL9QBPvYd4g7hc7VrKLBD01W33u9jX<wbr>vg7gw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
We have an example in our docs that shows how to create a kinetic energy<br>
power spectrum with the numpy FFT:<br>
<br>
<a href="http://yt-project.org/doc/cookbook/calculating_information.html#making-a-turbulent-kinetic-energy-power-spectrum" rel="noreferrer" target="_blank">http://yt-project.org/doc/<wbr>cookbook/calculating_<wbr>information.html#making-a-<wbr>turbulent-kinetic-energy-<wbr>power-spectrum</a><br>
<br>
I think this could be adapted for your needs.<br>
<br>
Right now there isn't an analysis routine explicitly for computing power<br>
spectra in yt. If someone wanted to add it (or just wanted to add more<br>
examples to the docs of how to compute power spectra using e.g. pyfftw) I<br>
think that would be a very welcome contribution.<br>
<br>
-Nathan<br>
<br>
On Wed, Jul 12, 2017 at 11:10 AM, ??? <<a href="mailto:setsuna@phys.tw">setsuna@phys.tw</a>> wrote:<br>
<br>
> Dear yt<br>
><br>
> Can current yt calculate 3-D Mass power spectra? I checked the website but<br>
> I didn't find any information. I think calculating 3-D Mass power<br>
> spectra is a very useful for cosmological simulations. So I guess maybe yt<br>
> supports this function now....?<br>
><br>
> Thanks in advance<br>
><br>
> ______________________________<wbr>_________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170712/c8e1fe3f/attachment.htm" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>pipermail/yt-users-spacepope.<wbr>org/attachments/20170712/<wbr>c8e1fe3f/attachment.htm</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
<br>
<br>
------------------------------<br>
<br>
End of yt-users Digest, Vol 113, Issue 17<br>
******************************<wbr>***********<br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="font-family:monospace,monospace">Salvatore</span></div></div></div></div>
</div></div>