[yt-users] yt.extensions.EnzoSimulation gorne
Matthew Turk
matthewturk at gmail.com
Wed Nov 3 10:35:04 PDT 2010
Hi Elizabeth,
Looks like an oddity of how it's masking child cells. These show up
from time to time and are usually because of a combination of domain
size, refinement parameter, and grid index placement. If you don't
mind, could you (off list) send me a link to the dataset (we can't use
drop.io anymore -- they got bought by facebook and shut down!) and
I'll see if I can fix it up tonight.
-Matt
On Wed, Nov 3, 2010 at 1:31 PM, Elizabeth Tasker <taskere at mcmaster.ca> wrote:
> Hi Britton,
>
> It just fails in the same way. The entire output in all it's glory is:
>
>
> [taskere at saw377 sedov]$ /work/taskere/yt-2/yt/bin/iyt total_energy.py
> yt INFO 2010-11-03 13:29:08,135 Loaded 11 total data outputs.
> yt INFO 2010-11-03 13:29:08,414 Getting the binary hierarchy
> yt INFO 2010-11-03 13:29:08,418 Finished with binary hierarchy
> reading
> Warning: divide by zero encountered in divide
> Warning: divide by zero encountered in divide
> Warning: invalid value encountered in sqrt
> Warning: invalid value encountered in divide
> Warning: invalid value encountered in divide
> Warning: invalid value encountered in sqrt
> ---------------------------------------------------------------------------
> IndexError Traceback (most recent call last)
>
> /saw_sfs/work/taskere/yt-2/scripts/iyt in <module>()
> 15 # calculate total energy for the simulation volume
> 16 data = pf.h.all_data()
> ---> 17 print data.quantities["TotalQuantity"]("TotalEnergy")[0]
> 18 # ETot.append(data.quantities["TotalQuantity"]("TotalEnergy")[0])
> 19
>
> /saw_sfs/work/taskere/yt-2/yt/data_objects/derived_quantities.pyc in
> __call__(self, *args, **kwargs)
> 88 self._data_source.pf.h.io)
> 89 if lazy_reader and not self.force_unlazy:
> ---> 90 return self._call_func_lazy(args, kwargs)
> 91 else:
> 92 return self._call_func_unlazy(args, kwargs)
>
> /saw_sfs/work/taskere/yt-2/yt/data_objects/derived_quantities.pyc in
> _call_func_lazy(self, args, kwargs)
> 95 self.retvals = [ [] for i in range(self.n_ret)]
> 96 for gi,g in enumerate(self._get_grids()):
> ---> 97 rv = self.func(GridChildMaskWrapper(g,
> self._data_source), *args, **kwargs)
> 98 for i in range(self.n_ret): self.retvals[i].append(rv[i])
> 99 g.clear_data()
> /saw_sfs/work/taskere/yt-2/yt/data_objects/derived_quantities.pyc in
> _TotalQuantity(data, fields)
> 493 totals = []
> 494 for field in fields:
> --> 495 if data[field].size < 1:
> 496 totals.append(0)
> 497 continue
>
> /saw_sfs/work/taskere/yt-2/yt/data_objects/derived_quantities.pyc in
> __getitem__(self, item)
> 57 def __getitem__(self, item):
> 58 if item not in self.local_cache:
> ---> 59 data = self.data_source._get_data_from_grid(self.grid,
> item)
> 60 self.local_cache[item] = data
> 61 return self.local_cache[item]
>
> /saw_sfs/work/taskere/yt-2/yt/data_objects/data_containers.pyc in
> save_state(self, grid, field)
> 68 old_keys = grid.data.keys()
> 69 grid.field_parameters = self.field_parameters
> ---> 70 tr = func(self, grid, field)
> 71 grid.field_parameters = old_params
> 72 grid.data = dict( [(k, grid.data[k]) for k in old_keys] )
>
> /saw_sfs/work/taskere/yt-2/yt/data_objects/data_containers.pyc in
> _get_data_from_grid(self, grid, field)
> 1939 t = grid[field] * na.ones(grid.ActiveDimensions,
> dtype='float64')
> 1940 return t[pointI].ravel()
> -> 1941 return grid[field][pointI].ravel()
> 1942
> 1943 def _flush_data_to_grids(self, field, default_val,
> dtype='float32'):
>
> IndexError: index (100) out of range (0<=index<99) in dimension 0
> WARNING: Failure executing file: <total_energy.py>
>
> Welcome to yt!
>
>
> (I find that last line amusing in such circumstances :) )
>
>
> Also, my total script is:
>
> from yt.mods import *
> from yt.analysis_modules.api import EnzoSimulation
>
> ETot = []
> time = []
> i=0
>
> es = EnzoSimulation("SedovBlastAMR.enzo", initial_time=0.0, final_time=0.1)
>
> for output in es.allOutputs:
> # load up a dataset
> pf = load(output['filename'])
>
> # calculate total energy for the simulation volume
> data = pf.h.all_data()
> print data.quantities["TotalQuantity"]("TotalEnergy")[0]
> # ETot.append(data.quantities["TotalQuantity"]("TotalEnergy")[0])
>
>
> # calculate the time of output
> time.append(0.01*i)
> i = i + 1
>
> pylab.xlabel("Time")
> pylab.ylabel("Total Energy")
> pylab.plot(time, ETot, 'b')
> pylab.savefig('TotEnergy.png')
> pylab.show()
>
>
>
> Thank you~
>
>
> Britton Smith wrote:
>>
>> Hi Elizabeth,
>>
>> It's not totally clear to me what's failing. Can you change that line to
>> just
>> print data.quantities["TotalQuantity"]("TotalEnergy")[0]
>> just to see what's coming out of that.
>>
>> Britton
>>
>> On Wed, Nov 3, 2010 at 1:10 PM, Elizabeth Tasker <taskere at mcmaster.ca
>> <mailto:taskere at mcmaster.ca>> wrote:
>>
>> Actually, it turns out this is still giving me problems. I'm now
>> using yt 2.0 and have:
>>
>>
>> from yt.analysis_modules.api import EnzoSimulation
>> es = EnzoSimulation("SedovBlastAMR.enzo", initial_time=0.0,
>> final_time=0.1)
>>
>> ETot = []
>>
>> for output in es.allOutputs:
>> pf = load(output['filename'])
>> data = pf.h.all_data()
>> ETot.append(data.quantities["TotalQuantity"]("TotalEnergy")[0])
>> .
>> .
>> .
>>
>> But I get:
>>
>> IndexError Traceback (most recent
>> call last)
>>
>> /saw_sfs/work/taskere/yt-2/scripts/iyt in <module>()
>> 15 # calculate total energy for the simulation volume
>> 16 data = pf.h.all_data()
>> ---> 17
>> ETot.append(data.quantities["TotalQuantity"]("TotalEnergy")[0])
>> 18
>> 19 # calculate the time of output
>> .
>> .
>> .
>> IndexError: index (100) out of range (0<=index<99) in dimension 0
>> WARNING: Failure executing file: <total_energy.py>
>>
>>
>>
>> What did I do wrong?
>>
>> Elizabeth
>>
>>
>>
>>
>>
>>
>> Elizabeth Tasker wrote:
>>
>> Hi Jeff,
>>
>> I think it might be enzo 1.7, but inspired by your comment I
>> controversially checked the code and found
>>
>> import yt.extensions.enzo_simulation as ES
>>
>> works.
>>
>> Thanks, Elizabeth
>>
>>
>> j s oishi wrote:
>>
>> Hi Elizabeth,
>>
>> Are you on yt-2.0? If so, then it should be
>>
>> from yt.analysis_modules.api import EnzoSimulation as ES
>>
>> j
>>
>>
>> _______________________________________________
>> 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