[yt-users] cut_region index error with Tipsy

Samantha Benincasa benincsm at mcmaster.ca
Wed Jul 16 13:37:23 PDT 2014


Hi Nathan, Cameron and John,

Thanks for the quick replies.

Nathan:

Thanks for distinguishing between the two, I wasn't aware of that
difference!  I've tried making the cut with 'gas','temperature', and then
doing the projection with 'gas','density' and that works.

Thank you for the help,
Sam


On Wed, Jul 16, 2014 at 3:17 PM, Cameron Hummels <chummels at gmail.com> wrote:

> John is correct.  I just tested this with an enzo dataset, and it works
> fine.  In fact, I just tested it with a sample Gasoline dataset, and I got
> cut_regions working OK in ProjectionPlots.
>
>
> On Wed, Jul 16, 2014 at 1:06 PM, John ZuHone <jzuhone at gmail.com> wrote:
>
>> I've successfully used cut regions in projections before, so this isn't
>> it, I don't think.
>>
>> On Jul 16, 2014, at 4:04 PM, Cameron Hummels <chummels at gmail.com> wrote:
>>
>> Hi Samantha,
>>
>> I think that data_source expects geometrical objects as opposed to cut
>> regions.  So you can use ds.sphere or ds.region to pass into the
>> ProjectionPlot, but I don't think a cut_region will work, regardless of the
>> frontend (gadget, enzo, etc.).  But I may be wrong here.
>>
>> Cameron
>>
>>
>> On Wed, Jul 16, 2014 at 12:57 PM, Samantha Benincasa <
>> benincsm at mcmaster.ca> wrote:
>>
>>> Hi everyone,
>>>
>>> I'm working with a Gasoline dataset.  I'm trying to create a cut region
>>> and then image/analyze just the particles in that set.  I'm able to
>>> successfully create the region using:
>>>
>>> cr = ad.cut_region(["obj['Gas','Temperature'] < 1000"])
>>>
>>> However, when I try to image that region:
>>>
>>> proj = ProjectionPlot(pf, "z",
>>> ('Gas','Density'),weight_field=('Gas','Density'),data_source=cr)
>>>
>>> I get the following error:
>>>
>>>
>>> ---------------------------------------------------------------------------
>>> IndexError                                Traceback (most recent call
>>> last)
>>> <ipython-input-14-4d67ba49bdf1> in <module>()
>>> ----> 1 proj = ProjectionPlot(pf, "z",
>>> ('Gas','Density'),weight_field=('Gas','Density'),data_source=cr)
>>>
>>> /1/home/benincsm/yt/yt-3.0-test/yt/yt/visualization/plot_window.pyc in
>>> __init__(self, pf, axis, fields, center, width, axes_unit, weight_field,
>>> max_level, origin, fontsize, field_parameters, data_source, proj_style,
>>> window_size, aspect)
>>>    1217         proj = pf.proj(fields, axis, weight_field=weight_field,
>>>    1218                        center=center, data_source=data_source,
>>> -> 1219                        field_parameters = field_parameters,
>>> style = proj_style)
>>>    1220         PWViewerMPL.__init__(self, proj, bounds, fields=fields,
>>> origin=origin,
>>>    1221                              fontsize=fontsize,
>>> window_size=window_size, aspect=aspect)
>>>
>>> /1/home/benincsm/yt/yt-3.0-test/yt/yt/data_objects/construction_data_containers.pyc
>>> in __init__(self, field, axis, weight_field, center, pf, data_source,
>>> style, field_parameters)
>>>     226         self.data_source = data_source
>>>     227         self.weight_field = weight_field
>>> --> 228         self.get_data(field)
>>>     229
>>>     230     @property
>>>
>>> /1/home/benincsm/yt/yt-3.0-test/yt/yt/data_objects/construction_data_containers.pyc
>>> in get_data(self, fields)
>>>     266         # We do this once
>>>     267         for chunk in self.data_source.chunks([], "io",
>>> local_only = False):
>>> --> 268             self._initialize_chunk(chunk, tree)
>>>     269         # This needs to be parallel_objects-ified
>>>     270         with
>>> self.data_source._field_parameter_state(self.field_parameters):
>>>
>>> /1/home/benincsm/yt/yt-3.0-test/yt/yt/data_objects/construction_data_containers.pyc
>>> in _initialize_chunk(self, chunk, tree)
>>>     342
>>>     343     def _initialize_chunk(self, chunk, tree):
>>> --> 344         icoords = chunk.icoords
>>>     345         xax = self.pf.coordinates.x_axis[self.axis]
>>>     346         yax = self.pf.coordinates.y_axis[self.axis]
>>>
>>> /1/home/benincsm/yt/yt-3.0-test/yt/yt/data_objects/selection_data_containers.pyc
>>> in icoords(self)
>>>     733     @property
>>>     734     def icoords(self):
>>> --> 735         return self.base_object.icoords[self._cond_ind,:]
>>>     736
>>>     737     @property
>>>
>>> IndexError: index 9025361 is out of bounds for axis 0 with size 9025360
>>>
>>> Is the imaging step not yet supported in yt-3.0?
>>>
>>> Thanks,
>>> Sam
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>
>>
>> --
>> Cameron Hummels
>> Postdoctoral Researcher
>> Steward Observatory
>> University of Arizona
>> http://chummels.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
>>
>>
>
>
> --
> Cameron Hummels
> Postdoctoral Researcher
> Steward Observatory
> University of Arizona
> http://chummels.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/20140716/2ba48802/attachment.html>


More information about the yt-users mailing list