[yt-users] Problem with covering grid
Elizabeth Tasker
tasker at astro1.sci.hokudai.ac.jp
Fri Apr 25 02:01:55 PDT 2014
> Ahh, I think I see the issue. hg has very strong backward
> compatibility; however, if a higher versioned hg operates on a repo,
> it can up-convert it. So what I think is happening is that you're
> using an old hg on a repo that's been updated by a newer hg. Any
> chance you've switched to, say, the system mercurial after using a
> personally-installed one?
Not intentionally: I normally opt for the install script. But I may have done it under careful direction at some point. Is the best thing to do a refresh install from the repo?
Elizabeth
> Also, I think this is what's preventing "yt update" from working!
>
> -Matt
>
>>
>> E.
>>
>>
>> On 25 April 2014 17:44, Matthew Turk <matthewturk at gmail.com> wrote:
>>>
>>> Hi Elizabeth,
>>>
>>> On Fri, Apr 25, 2014 at 4:38 AM, Elizabeth Tasker
>>> <tasker at astro1.sci.hokudai.ac.jp> wrote:
>>>> Hi Matt,
>>>>
>>>> Thanks! This is:
>>>>
>>>> yt module located at:
>>>> /home/tasker/yt-new2/src/yt-hg
>>>>
>>>> The current version of the code is:
>>>>
>>>> ---
>>>> 81c2f6f5f983
>>>> ---
>>>>
>>>>
>>>> Elizabeth
>>>
>>> I've just checked, and I am able to replicate the error with this
>>> changeset using this script:
>>>
>>> from yt.mods import *
>>> pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
>>> level = 0
>>> left = [0.0, 0.0, 0.0]
>>> dims = [16, 16, 16]
>>> cgrid = pf.h.covering_grid(level, left_edge = left, dims=dims,
>>> num_ghost_zones=2)
>>>
>>> However, when I update to the current tip of the yt branch,
>>> 1a67d558b51c, it works. :)
>>>
>>> -Matt
>>>
>>>>
>>>>
>>>> On 25 April 2014 17:34, Matthew Turk <matthewturk at gmail.com> wrote:
>>>>>
>>>>> Hi Elizabeth,
>>>>>
>>>>> On Fri, Apr 25, 2014 at 3:40 AM, Elizabeth Tasker
>>>>> <tasker at astro1.sci.hokudai.ac.jp> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I've hit a problem with the latest version of yt and covering grid
>>>>>> that
>>>>>> is
>>>>>> linked with the number of ghostzones. My code looked like:
>>>>>>
>>>>>> for dim in range(3):
>>>>>>
>>>>>> left.append(cloud_position[c][dim] - 0.5*width[dim])
>>>>>> right.append(cloud_position[c][dim] + 0.5*width[dim])
>>>>>> dims.append(int(round((right[dim]-left[dim])/cellsize)))
>>>>>>
>>>>>> cgrid = pf.h.covering_grid(level,
>>>>>> left_edge = left,
>>>>>> dims=dims,
>>>>>> num_ghost_zones=2)
>>>>>>
>>>>>>
>>>>>> but gives me:
>>>>>>
>>>>>> TypeError Traceback (most recent call
>>>>>> last)
>>>>>> /home/tasker/yt-new2/src/yt-hg/scripts/iyt in <module>()
>>>>>> ----> 1 execfile("export_hdf5_cube.py")
>>>>>>
>>>>>> /home/tasker/yt-new2/src/yt-hg/scripts/iyt in <module>()
>>>>>> 51 left_edge = left,
>>>>>> 52 dims=dims,
>>>>>> ---> 53 num_ghost_zones=2)
>>>>>> 54
>>>>>> 55
>>>>>>
>>>>>> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/data_containers.pyc in
>>>>>> __init__(self, level, left_edge, dims, fields, pf, num_ghost_zones,
>>>>>> use_pbar, **kwargs)
>>>>>> 3689 self.level = level
>>>>>> 3690 rdx =
>>>>>> self.pf.domain_dimensions*self.pf.refine_by**level
>>>>>> -> 3691 rdx[np.where(dims - 2 * num_ghost_zones <= 1)] = 1
>>>>>> #
>>>>>> issue
>>>>>> 602
>>>>>> 3692 self.dds = self.pf.domain_width /
>>>>>> rdx.astype("float64")
>>>>>> 3693 self.ActiveDimensions = np.array(dims, dtype='int32')
>>>>>>
>>>>>> TypeError: unsupported operand type(s) for -: 'list' and 'int'
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> This happens regardless of whether I use num_ghost_zones or not. If I
>>>>>> don't
>>>>>> have ghost_zones set, the error occurs at line 52, but still points
>>>>>> to
>>>>>> line
>>>>>> 3691. Dims and left look fine:
>>>>>>
>>>>>> In [9]: dims
>>>>>> Out[9]: [64, 64, 64]
>>>>>>
>>>>>> In [10]: left
>>>>>> Out[10]: [20.424700000000001, 11.512700000000001, 15.7158]
>>>>>>
>>>>>> In [11]: level
>>>>>> Out[11]: 5
>>>>>>
>>>>>> In [14]: rdx = pf.domain_dimensions*pf.refine_by**level
>>>>>> In [15]: rdx
>>>>>> Out[15]: array([4096, 4096, 4096])
>>>>>>
>>>>>>
>>>>>> If I set num_ghost_zones = na.array([0,0,0]) then it runs. However,
>>>>>> if I
>>>>>> then try
>>>>>>
>>>>>> cgrid["x"]
>>>>>>
>>>>>> I hit more problems circulating around the same area:
>>>>>>
>>>>>> ValueError Traceback (most recent call
>>>>>> last)
>>>>>> /home/tasker/yt-new2/src/yt-hg/scripts/iyt in <module>()
>>>>>> ----> 1 cgrid["y"]
>>>>>>
>>>>>> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/data_containers.pyc in
>>>>>> __getitem__(self, key)
>>>>>> 316 if key not in self.fields:
>>>>>> 317 self.fields.append(key)
>>>>>> --> 318 self.get_data(key)
>>>>>> 319 return self.field_data[key]
>>>>>> 320
>>>>>>
>>>>>> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/data_containers.pyc in
>>>>>> get_data(self, fields)
>>>>>> 3733 try:
>>>>>> 3734 #print "Generating", field
>>>>>> -> 3735 self._generate_field(field)
>>>>>> 3736 continue
>>>>>> 3737 except NeedsOriginalGrid, ngt_exception:
>>>>>>
>>>>>> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/data_containers.pyc in
>>>>>> _generate_field(self, field)
>>>>>> 3764 if self.pf.field_info.has_key(field):
>>>>>> 3765 # First we check the validator; this might even
>>>>>> raise!
>>>>>> -> 3766 self.pf.field_info[field].check_available(self)
>>>>>> 3767 self[field] = self.pf.field_info[field](self)
>>>>>> 3768 else: # Can't find the field, try as it might
>>>>>>
>>>>>>
>>>>>> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/field_info_container.pyc
>>>>>> in
>>>>>> check_available(self, data)
>>>>>> 354 """
>>>>>> 355 for validator in self.validators:
>>>>>> --> 356 validator(data)
>>>>>> 357 # If we don't get an exception, we're good to go
>>>>>> 358 return True
>>>>>>
>>>>>>
>>>>>> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/field_info_container.pyc
>>>>>> in
>>>>>> __call__(self, data)
>>>>>> 482 if not data._spatial:
>>>>>> 483 raise NeedsGridType(self.ghost_zones,self.fields)
>>>>>> --> 484 if self.ghost_zones <= data._num_ghost_zones:
>>>>>> 485 return True
>>>>>> 486 raise NeedsGridType(self.ghost_zones,self.fields)
>>>>>>
>>>>>> ValueError: The truth value of an array with more than one element is
>>>>>> ambiguous. Use a.any() or a.all()
>>>>>>
>>>>>>
>>>>>> cgrid["Density"] and the velocities are fine.
>>>>>>
>>>>>> I'm suspecting this is because the position calculation in the code
>>>>>> is
>>>>>> not
>>>>>> expecting an array for the ghost zone number?
>>>>>>
>>>>>> Oddly, I see from the mailing list is this reminiscent of a problem
>>>>>> nyx
>>>>>> was
>>>>>> having.
>>>>>
>>>>> Yes, and it feels like this exact issue -- where dims are lists, not
>>>>> arrays -- gets fixed over and over and over again. :( Can you report
>>>>> which changeset you're on, and I'll push a fix?
>>>>>
>>>>> -Matt
>>>>>
>>>>>>
>>>>>> Elizabeth
>>>>>>
>>>>>> _______________________________________________
>>>>>> yt-users mailing list
>>>>>> yt-users at lists.spacepope.org
>>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>>
>>>>> _______________________________________________
>>>>> yt-users mailing list
>>>>> yt-users at lists.spacepope.org
>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> yt-users mailing list
>>>> yt-users at lists.spacepope.org
>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
> _______________________________________________
> 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/20140425/83480ba0/attachment.htm>
More information about the yt-users
mailing list