[yt-users] data along rays

Elizabeth Tasker taskere at mcmaster.ca
Tue Aug 9 12:13:42 PDT 2011


Actually, I think it's because my covering_grid has no ghost zones. I'll 
add some in.

E.

Elizabeth Tasker wrote:
> Hi Matt,
>
> Ah, great -- thank you. However, when I try to use it, the code chocks 
> on my 3d data. I have:
>
> add_field("Omega", function=_Omega, 
> validators=[ValidateParameter("height_vector"), 
> ValidateParameter("center"), ValidateSpatial(1, ["x-velocity", 
> "y-velocity", "z-velocity", "x", "y", "z"])])
>
> and I get
>
> /1/home/taskere/yt/yt/data_objects/field_info_container.py in 
> __call__(self, data)
>    411         if self.ghost_zones <= data._num_ghost_zones:
>    412             return True
> --> 413         raise NeedsGridType(self.ghost_zones,self.fields)
>    414
>    415 class ValidateGridType(FieldValidator):
>
> NeedsGridType: (1, ['x-velocity', 'y-velocity', 'z-velocity', 'x', 
> 'y', 'z'])
>
> Did I get the syntax wrong?
>
> Elizabeth
>
>
> Matthew Turk wrote:
>>
>> Hi Elizabeth,
>>
>> You have to use the ValidateSpatial validator to ensure that the data 
>> handed to te subroutine is 3D.
>>
>> -Matt
>>
>> On Aug 9, 2011 11:50 AM, "Elizabeth Tasker" <taskere at mcmaster.ca 
>> <mailto:taskere at mcmaster.ca>> wrote:
>> > Hi,
>> >
>> > I have a mystery:
>> >
>> > Creating a ray via:
>> >
>> > ray = pf.h.ray( com[c], com[nearestcore])
>> >
>> > and I want to get the effective potential along it, for which I have a
>> > subrountine for. However, yr gets stuck here:
>> >
>> > if data.pf <http://data.pf>["HydroMethod"] == 2:
>> > xvel[0:-1,0:-1,0:-1] =
>> > 
>> 0.5*(data["x-velocity"][slice(None,-1,None),0:-1,0:-1]+data["x-velocity"][slice(1,None,None),0:-1,0:-1]) 
>>
>> >
>> >
>> > I thought the problem was because a ray is a 1D data set and I was
>> > trying to treat it like a 3D array, but what confuses me is that:
>> >
>> > ray["DivV"]
>> >
>> > works just fine but as the same sort of line within its definition.
>> >
>> > http://yt.enzotools.org/doc/reference/field_list.html#divv
>> >
>> > To make matters more confusing, if I copy out the definition of DivV
>> > directly from universal_fields.py and implement it imaginatively as
>> > DivV2, the code doesn't work, giving me:
>> >
>> > /1/home/taskere/yt/scripts/iyt in _DivV2(field, data)
>> > 211 div_fac = 2.0
>> > 212 ds = div_fac * data['dx'].flat[0]
>> > --> 213 f = data["x-velocity"][sl_right,1:-1,1:-1]/ds
>> > 214 f -= data["x-velocity"][sl_left ,1:-1,1:-1]/ds
>> > 215 if data.pf.dimensionality > 1:
>> >
>> > IndexError: too many indices
>> >
>> >
>> > What magic line does yt have to allow DivV to work for a ray?
>> >
>> > Thanks,
>> >
>> > Elizabeth
>> >
>> > _______________________________________________
>> > yt-users mailing list
>> > yt-users at lists.spacepope.org <mailto: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




More information about the yt-users mailing list