[yt-users] problem with covering_grid for Nyx data sets

Nathan Goldbaum nathan12343 at gmail.com
Tue Aug 6 08:17:40 PDT 2013


Hi Wolfram,

I have two suggestions.  First, my line numbers don't match yours for
yt/data_objects/data_containers.py. This means that you're not on the
latest development version of yt.  I would first try updating to the latest
development version:

$ cd $YT_HG
$ hg pull
$ hg up yt
$ python setup.py build_ext -i

and then try your script again. If the issue isn't fixed by updating, I
would then try applying the following diff to the nyx frontend:

diff -r f936432ed45d yt/frontends/nyx/data_structures.py
--- a/yt/frontends/nyx/data_structures.py       Tue Jul 30 10:08:24 2013
-0700
+++ b/yt/frontends/nyx/data_structures.py       Tue Aug 06 08:10:25 2013
-0700
@@ -611,7 +611,7 @@
         # aliases we need
         self.parameters["TopGridRank"] =
len(self.parameters["TopGridDimensions"]
         self.dimensionality = self.parameters["TopGridRank"]
-        self.domain_dimensions = self.parameters["TopGridDimensions"]
+        self.domain_dimensions =
np.array(self.parameters["TopGridDimensions"])
         self.refine_by = self.parameters.get("RefineBy", 2)  # 2 is silent
defaul

         # Nyx is always cosmological.

If you take a look at the enzo frontend, EnzoStaticOutput.domain_dimensions
will always be a numpy array, for which an astype method is well defined.
 If that fixes your issue, would you mind submitting the patch as a pull
request?  There's more information about submitting changes in the yt docs:
http://yt-project.org/docs/2.5/advanced/developing.html#making-and-sharing-changes

Cheers,

Nathan


On Tue, Aug 6, 2013 at 2:29 AM, Wolfram Schmidt <
schmidt at astro.physik.uni-goettingen.de> wrote:

> Hi,
>
> I have got problem that concerns Nyx users and/or yt developers.
>
> I want to read the root-grid level from AMR data sets with the following
> piece of code:
>
>
> num_ghost_zones=2
> left=na.amin(pf.h.grid_left_**edge,axis=0)
> right=na.amax(pf.h.grid_right_**edge,axis=0)
> resolution = (right-left)/pf.h.grids[0]['**dx']+2*num_ghost_zones
> cg = pf.h.covering_grid(0,left,**resolution,num_ghost_zones=**
> num_ghost_zones)
>
>
> This works for Enzo data sets, but it fails for Nyx data sets. The error
> message is
>
>
> Traceback (most recent call last):
>   File "/home/h/nipiagws/scripts/**spect_sb.py", line 52, in <module>
>     cg = pf.h.covering_grid(0,left,**resolution,num_ghost_zones=**
> num_ghost_zones)
>   File "/home/h/nipschul/yt-x86_64/**src/yt-hg/yt/data_objects/**data_containers.py",
> line 3727, in __init__
>     self.dds = self.pf.domain_width/rdx.**astype("float64")
> AttributeError: 'list' object has no attribute 'astype'
>
>
> The script used to work also for Nyx data sets, with an older version of
> yt (about a year ago).
>
> How can this be fixed?
>
> Thanks a lot,
> Wolfram
> ______________________________**_________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/**listinfo.cgi/yt-users-**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/20130806/48efc1de/attachment.htm>


More information about the yt-users mailing list