[yt-users] Projection issue
Elizabeth Tasker
tasker at astro1.sci.hokudai.ac.jp
Thu Apr 4 04:58:08 PDT 2013
Hello,
I have 2 problems, but possibly I only need the solution to one :)
(1) If I calculate the total mass in a simulation via the projection:
projection = pf.h.proj(2, 'CellMass')
sum(projection["CellMass"]/projection["pdx"]/2.0/3.08568025e18)
(i.e. sum(sum(m_i*dl)/dl) )
I get: 1.4855032022312827e+43
However, if I just sum it directly:
dd = pf.h.all_data()
sum(dd["CellMass"])
I get: 6.3279045575257765e+42
I was expecting those two numbers to be approximately the same. Why are
they very different? Have I misunderstood the value of pdx? I think it
should be equal to half the integration step.
(2) The second problem occurred when I tried to fix this by using a fixed
resolution projection (in case a variable dl was the issue).
I tried:
proj = pf.h.fixed_res_proj(2, 0, [0, 0, 0], [128,128,128])
(My root grid is 128^3)
but I get:
ValueError Traceback (most recent call last)
/home/tasker/yt-new/src/yt-hg/scripts/iyt in <module>()
----> 1 proj = pf.h.fixed_res_proj(2, 0, [0, 0, 0], [128,128,128])
/home/tasker/yt-new/src/yt-hg/yt/data_objects/data_containers.pyc in
__init__(self, axis, level, left_edge, dims, fields, pf, **kwargs)
2460 self.domain_width = np.rint((self.pf.domain_right_edge -
2461
self.pf.domain_left_edge)/self.dds).astype('int64')
-> 2462 self._refresh_data()
2463
2464 def _get_list_of_grids(self):
/home/tasker/yt-new/src/yt-hg/yt/data_objects/data_containers.pyc in
_refresh_data(self)
318 """
319 self.clear_data()
--> 320 self.get_data()
321
322 def keys(self):
/home/tasker/yt-new/src/yt-hg/yt/data_objects/data_containers.pyc in
get_data(self, fields)
2494 Iterates over the list of fields and generates/reads them
all.
2495 """
-> 2496 self._get_list_of_grids()
2497 if not self.has_key('pdx'):
2498 self._generate_coords()
/home/tasker/yt-new/src/yt-hg/yt/data_objects/data_containers.pyc in
_get_list_of_grids(self)
2470 else:
2471 grids,ind = self.pf.hierarchy.get_box_grids(
-> 2472 self.left_edge, self.right_edge)
2473 level_ind = (self.pf.hierarchy.grid_levels.ravel()[ind] <=
self.level)
2474 sort_ind =
np.argsort(self.pf.h.grid_levels.ravel()[ind][level_ind])
/home/tasker/yt-new/src/yt-hg/yt/data_objects/object_finding_mixin.pyc in
get_box_grids(self, left_edge, right_edge)
201 eps = np.finfo(np.float64).eps
202 grid_i = np.where((np.all((self.grid_right_edge -
left_edge) > eps, axis=1)
--> 203 & np.all((right_edge -
self.grid_left_edge) > eps, axis=1)) == True)
204
205 return self.grids[grid_i], grid_i
ValueError: operands could not be broadcast together with shapes (3,3)
(7100,3)
What did I do wrong?
Thank you!
Elizabeth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130404/43944d64/attachment.htm>
More information about the yt-users
mailing list