[yt-users] Error loading data in ray

Sam Geen samgeen at astro.ox.ac.uk
Sun Feb 2 03:26:44 PST 2014


Hi Matt,

I've just had a chance to try out this PR. Out of interest, what's the 
best way to plot the ray as a profile (e.g. for Density, Temperature, 
etc)? I tried ray["t"] but the points aren't ordered* and sorting them 
(and the y-values with np.argsort) the result seems odd too (the values 
seem OK, but the values at each radius along the line seem unordered).

Also, in the docs (dev version), there seems to be a reference to a 
field "dts" that doesn't exist: 
http://yt-project.org/docs/dev/analyzing/generating_processed_data.html#line-queries-and-planar-integrals 
(I suspect it's a typo; "dt" works fine).

I can host up a snapshot from my simulation if you want to try it out.

Thanks,

Sam

*
For a ray running from (0.5,0.5,0.5) to (0,0,0) in a 128x128x128 box 
with no AMR:
In [7]: print ray["t"]
[ 0.984375  0.96875   0.734375  0.71875   0.859375  0.84375 0.609375
   0.59375   0.953125  0.9375    0.703125  0.6875    0.828125 0.8125
   0.578125  0.5625    0.921875  0.90625   0.671875  0.65625 0.890625
   0.875     0.640625  0.625     0.796875  0.78125   0.546875 0.53125
   0.765625  0.75      0.515625  0.5       0.484375  0.46875 0.234375
   0.21875   0.359375  0.34375   0.109375  0.09375   0.453125 0.4375
   0.203125  0.1875    0.328125  0.3125    0.078125  0.0625 0.421875
   0.40625   0.171875  0.15625   0.390625  0.375     0.140625 0.125
   0.296875  0.28125   0.046875  0.03125   0.265625  0.25 0.015625 
-0.      ]


On 31/01/14 19:11, Matthew Turk wrote:
> Hi Sam,
>
> Looks like rays weren't implemented for octrees.  I've issued a PR to
> implement them here:
>
> https://bitbucket.org/yt_analysis/yt/pull-request/697/enable-rays-to-be-traced-through-ramses/diff
>
> Once fido reports that the unit tests are all still correct, I will
> accept it.  I've verified it with this:
>
> http://paste.yt-project.org/show/4264/
>
> -Matt
>
> On Fri, Jan 31, 2014 at 11:54 AM, Sam Geen <samgeen at astro.ox.ac.uk> wrote:
>> Hi,
>>
>> I'm trying to read data from a RAMSES output using a ray (c.f.
>> http://yt-project.org/docs/dev/analyzing/generating_processed_data.html#line-queries-and-planar-integrals)
>> - I basically call:
>>
>> import yt.mods
>> pf = yt.mods.load("output_00007/info_00007.txt")
>> ray = pf.h.ray((0.5,0.5,0.5),(0,0,0))
>> ray["Density"] # <-- throws exception here
>>
>> It works fine up until when I try to query the density, whereupon it throws
>> a KeyError (ray.keys() is also empty). It seems to find all the fields fine
>> when creating the ray object. Error log at the bottom of the e-mail.
>>
>> I'm pretty sure I'm using the latest version of YT from the yt-3.0 branch of
>> the yt repository, but if I'm the only one getting this error I can
>> double-check.
>>
>> Anyone have any ideas? Failing that, if there's a better way to sample data
>> along a line in YT, let me know.
>>
>> Thanks!
>>
>> Sam
>>
>> ---
>> In [5]: print ray["Density"]
>> ---------------------------------------------------------------------------
>> KeyError                                  Traceback (most recent call last)
>> <ipython-input-5-dbeb4caf2ed1> in <module>()
>> ----> 1 print ray["Density"]
>>
>> /home/samgeen/.local/lib/python2.7/site-packages/yt-3.0dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.pyc
>> in __getitem__(self, key)
>>      189                 return self.field_data[f]
>>      190             else:
>> --> 191                 self.get_data(f)
>>      192         # Note that this is less succinct so that we can account for
>> the case
>>      193         # when there are, for example, no elements in the object.
>>
>> /home/samgeen/.local/lib/python2.7/site-packages/yt-3.0dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.pyc
>> in get_data(self, fields)
>>      573         # need to be generated.
>>      574         read_fluids, gen_fluids = self.hierarchy._read_fluid_fields(
>> --> 575                                         fluids, self,
>> self._current_chunk)
>>      576         self.field_data.update(read_fluids)
>>      577
>>
>> /home/samgeen/.local/lib/python2.7/site-packages/yt-3.0dev-py2.7-linux-x86_64.egg/yt/geometry/geometry_handler.pyc
>> in _read_fluid_fields(self, fields, dobj, chunk)
>>      533             selector,
>>      534             fields_to_read,
>> --> 535             chunk_size)
>>      536         for field in fields_to_read:
>>      537             ftype, fname = field
>>
>> /home/samgeen/.local/lib/python2.7/site-packages/yt-3.0dev-py2.7-linux-x86_64.egg/yt/frontends/ramses/io.pyc
>> in _read_fluid_selection(self, chunks, selector, fields, size)
>>       47         d = {}
>>       48         for field in fields:
>> ---> 49             d[field] = np.concatenate(tr.pop(field))
>>       50         return d
>>       51
>>
>> KeyError: ('gas', 'Density')
>> ---
>> _______________________________________________
>> 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