[yt-users] Off Axis Projection Box size error

Stephanie Tonnesen stonnes at gmail.com
Thu Jun 2 11:58:10 PDT 2016


setting ds.periodicity worked like a charm!  Thanks!

-Stephanie

--
Dr. Stephanie Tonnesen
Alvin E. Nashman Postdoctoral Fellow
Carnegie Observatories, Pasadena, CA
stonnes at gmail.com

On Wed, Jun 1, 2016 at 7:11 PM, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:

> The easiest way to workaround this issue is to do:
>
> ds.periodicity = (True, True, True)
>
> The issue you're running into always happens no matter what you choose for
> the width because of the use of an all_data() data object internally, which
> means that no matter what you set for the plot width, the plot will always
> try to select data at the edge of the domain. If you wanted to avoid this,
> you'd need to modify yt so that ds.all_data() is not assigned to `dd`, here:
>
>
> https://bitbucket.org/yt_analysis/yt/src/yt/yt/visualization/plot_window.py?at=yt&fileviewer=file-view-default#plot_window.py-1528
>
> The underlying issue is that yt is not very friendly when you try to
> select data outside of the simulation domain. If your data has periodic
> boundary conditions, everything works fine, but no other boundary
> conditions has been implemented. Doing a proper job of generating ghost
> zones at domain boundary requires some care, though, and no one has wanted
> to add this feature.
>
> -Nathan
>
> On Wed, Jun 1, 2016 at 6:56 PM, Stephanie Tonnesen <stonnes at gmail.com>
> wrote:
>
>> Hi all,
>>
>> I am trying my hand at off axis projections, and having some trouble
>> setting the width of the projection.  Specifically, unless I make the width
>> much too small to be useful to me, I get an error that my region is outside
>> of the box boundaries.
>>
>>
>> Here is the bit of code I have written:
>>
>>     L = [0.0,0.93969,-0.342]
>>     c = [0.5,0.5,0.5]
>>     N = 1028
>>     north_vector = [0,-0.342,0.93969]
>>     plot12 =
>> yt.OffAxisProjectionPlot(ds,L,'density',width=(80,'kpc'),north_vector=north_vector)
>>     plot12.save()
>>
>> My whole box is about 215 kpc wide, but unless I set my width to be 35
>> kpc I get this error (or something like it with the edge values listed at
>> the end varying).  When I use 35 kpc it looks probably right, although it
>> is just the center of a galaxy so a bit hard to say.
>>
>> Traceback (most recent call last):
>>   File "yt_yslices_allout.py", line 57, in <module>
>>     plot12 =
>> yt.OffAxisProjectionPlot(ds,L,'density',width=(80,'kpc'),north_vector=north_vector)
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line
>> 1650, in __init__
>>     periodic=False, oblique=True, fontsize=fontsize)
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line
>> 625, in __init__
>>     PlotWindow.__init__(self, *args, **kwargs)
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line
>> 205, in __init__
>>     self._setup_plots()
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line
>> 693, in _setup_plots
>>     self._recreate_frb()
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line
>> 1656, in _recreate_frb
>>     super(OffAxisProjectionPlot, self)._recreate_frb()
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line
>> 265, in _recreate_frb
>>     self._frb._get_data_source_fields()
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/visualization/fixed_resolution.py",
>> line 164, in _get_data_source_fields
>>     self[f]
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/visualization/fixed_resolution.py",
>> line 577, in __getitem__
>>     north_vector=dd.north_vector, method=dd.method)
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/off_axis_projection.py",
>> line 194, in off_axis_projection
>>     for i, (grid, mask) in enumerate(data_source.blocks):
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
>> line 1022, in blocks
>>     for io_chunk in self.chunks([], "io"):
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
>> line 1076, in chunks
>>     self.get_data() # Ensure we have built ourselves
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
>> line 1110, in get_data
>>     self.index._identify_base_chunk(self)
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/geometry/grid_geometry_handler.py",
>> line 283, in _identify_base_chunk
>>     gi = dobj.selector.select_grids(self.grid_left_edge,
>>   File
>> "/home/stonnes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
>> line 1071, in selector
>>     self._selector = sclass(self)
>>   File "yt/geometry/selection_routines.pyx", line 848, in
>> yt.geometry.selection_routines.RegionSelector.__init__
>> (yt/geometry/selection_routines.c:15619)
>> RuntimeError: Error: yt attempted to read outside the boundaries of a
>> non-periodic domain along dimension 1.
>> Region left edge = -0.0320252970485 code_length, Region right edge =
>> 1.03202529705 code_length
>> Dataset left edge = 0.0 code_length, Dataset right edge = 1.0 code_length
>>
>> This commonly happens when trying to compute ghost cells up to the domain
>> boundary. Two possible solutions are to load a smaller region that does not
>> border the edge or override the periodicity for this dataset.
>>
>>
>> Can anyone help me?  Thanks,
>> Stephanie
>>
>> --
>> Dr. Stephanie Tonnesen
>> Alvin E. Nashman Postdoctoral Fellow
>> Carnegie Observatories, Pasadena, CA
>> stonnes at gmail.com
>>
>> _______________________________________________
>> 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/20160602/182f89cf/attachment.htm>


More information about the yt-users mailing list