[yt-users] Images of extracted regions

Matthew Turk matthewturk at gmail.com
Thu Aug 18 13:33:12 PDT 2011


Hi Elizabeth,

It probably won't work, it looks like.  I'm not sure why you want to
slice through a cube of fixed resolution, but you can do it just as
easily by manually plotting with pylab.imshow the output of something
like:

extractCube[:,:,some_index]

to slice along the third axis.

If you stop by IRC maybe we can help out a bit more.  There are
usually a bunch of people in the channel, happy to help out.  (This
goes for everyone else reading this, too!)  You can use the web client
here:

http://yt.enzotools.org/irc.html

Or just use Adium or some other IRC client and go to #yt on irc.freenode.org .

-Matt

On Thu, Aug 18, 2011 at 4:29 PM, Elizabeth Tasker <taskere at mcmaster.ca> wrote:
> Hi Britton,
>
> Sorry, could you give me an example of how the call should look?
>
> I tried:
>
> p = pc.add_slice("NegEscapeVelocity", 2, field_parameters =
> {'disk_radius':profile["DiskRadius"],
> 'potential':profile["PotentialField"]}, data_source=extractCube)
>
> which fails because data_source is unrecognised (and indeed, isn't in the
> function description:
> http://yt.enzotools.org/doc/reference/api/generated/yt.visualization.plot_collection.PlotCollection.add_slice.html?highlight=add_slice#yt.visualization.plot_collection.PlotCollection.add_slice)
>
> And I tried:
>
> p = pc.add_slice(extractCube, "NegEscapeVelocity", 2)
>
>
> which also failed with:
>
>
> ValueError                                Traceback (most recent call last)
>
> /1/home/taskere/yt/scripts/iyt in <module>()
> ----> 1                                         2
>               3                                         4
>                       5
> /1/home/taskere/yt/yt/visualization/plot_collection.py in add_slice(self,
> field, axis, coord, center, use_colorbar, figure, axes, fig_size, periodic,
> obj, field_parameters)
>      402             if field_parameters == None: field_parameters = {}
>                                           403             obj =
> self.pf.hierarchy.slice(axis, coord, field,
>             --> 404                             center=center,
> **field_parameters)                                               405
>   p = self._add_plot(SlicePlot(
>
>   406                          obj, field, use_colorbar=use_colorbar,
>
> /1/home/taskere/yt/yt/data_objects/data_containers.py in __init__(self,
> axis, coord, fields, center, pf, node_name, **kwargs)
>   935         self.coord = coord
>   936         if node_name is False:
> --> 937             self._refresh_data()
>   938         else:
>   939             if node_name is True: self._deserialize()
>
> /1/home/taskere/yt/yt/data_objects/data_containers.py in _refresh_data(self)
>   273         """
>   274         self.clear_data()
> --> 275         self.get_data()
>   276
>   277     def keys(self):
>
> /1/home/taskere/yt/yt/data_objects/data_containers.py in get_data(self,
> fields)
>   780         # We take a 3-tuple of the coordinate we want to slice
> through, as well
>
>   781         # as the axis we're slicing along
>
> --> 782         self._get_list_of_grids()
>   783         if not self.has_key('pdx'):
>   784             self._generate_coords()
>
> /1/home/taskere/yt/yt/data_objects/data_containers.py in
> _get_list_of_grids(self)
>   994
>   995     def _get_list_of_grids(self):
> --> 996         goodI = ((self.pf.h.grid_right_edge[:,self.axis] >
> self.coord)
>   997               &  (self.pf.h.grid_left_edge[:,self.axis] <= self.coord
> ))
>   998         self._grids = self.pf.h.grids[goodI] # Using sources not
> hierarchy
>
> ValueError: setting an array element with a sequence.
>
>
>
> Elizabeth
>
>
>
>
>
> Britton Smith wrote:
>>
>> The first is definitely possible.  Just add data_source=extractCube to
>> your call to add_projection or add_slice or whatever.  The second probably
>> won't work because the projection or slice routine will look for other
>> things like cell dxs that won't be present from just a similarly sized
>> array.  If you want to do something like that, you're probably better off
>> making a new field and then projecting that with the above data_source
>> keyword argument in there.
>>
>> Britton
>>
>> On Thu, Aug 18, 2011 at 10:59 AM, Elizabeth Tasker <taskere at mcmaster.ca
>> <mailto:taskere at mcmaster.ca>> wrote:
>>
>>    Hi,
>>
>>    Is it possible to make a slice or projection of a extracted, fixed
>>    resolution region? i.e. the resultant object of:
>>
>>    extractCube = pf.h.covering_grid(extract_level,
>>                                           left_edge=extractLE,
>>                                           right_edge=extractRE,
>>                                           # How many dimensions along
>>    each axis
>>                                           dims=extractDims,
>>                                           # And any fields to preload
>>    (this is optional!)
>>                                           fields=["PotentialField"],
>>                                           num_ghost_zones = 3)
>>
>>
>>    Or of an array later made to the same size? e.g.
>>
>>    cloud = na.zeros(extractCube["x-velocity"].shape, dtype='float64')
>>
>>
>>    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