In [1]:
import yt
ds2 = yt.load("/home/lindsayad/data-yt/MultiRegion/two_region_example_out.e", step=-1)
ad2 = ds2.all_data()
print(ds2.field_list)
slice3 = yt.SlicePlot(ds2, 'z', [('all', 'elem_diffused')])
slice3.show()
slice2 = yt.SlicePlot(ds2, 'z', [('all', 'diffused')])
slice2.show()
In [ ]:
slice = yt.SlicePlot(ds2, 'z', [('connect1','diffused')])
slice.show()
In [5]:
string = "gadzooks"
i = 0
for char in string:
i+=1
print(i)
In [3]:
print([i+=1 for char in string])
In [1]:
pwd
Out[1]:
In [1]:
import yt
In [20]:
import pdb
In [3]:
ds = yt.load("coupled_value_coupled_flux_out.e", step=-1)
ad = ds.all_data()
print(ds.field_list)
In [4]:
print(ad[('connect1','v')])
In [6]:
print(ad[('connect2','v')])
In [19]:
print(ad[('connect1','v')].shape)
print(ad[('connect2','v')].shape)
In [9]:
cd /home/lindsayad/projects/moltres/problems
In [10]:
ds2 = yt.load("two-region-example_out.e", step=-1)
ad2 = ds2.all_data()
print(ds2.field_list)
In [17]:
print(ad2[('connect1','diffused')].shape)
print(ad2[('connect2','diffused')].shape)
In [1]:
cd /home/lindsayad/projects/moltres/problems
There's a fundamental problem with what I'm trying to do. It's that stupid connect1!!! What I should do is grep for all occurences of mesh_id = int(ftype[-1]) - 1 because any time that code occurs, it's going to disrupt what I'm trying to do. For now, I'm going to try this one more substituion in cartesian_coordinates.py and then it's time to call it a day.
In [ ]:
%debug
Ok, here is some stuff going down:
self.index._identify_base_chunk(self)_identify_base_chunk routine is implemented in the UnstructuredIndex classdobj._chunk_info = self.meshes. Recall that dobj refers to the YTSlice object and self currently is the UnstructuredIndex objectdobj._current_chunk = list(self._chunk_all(dobj))[0]_chunk_all method implemented in the UnstructuredIndex class_chunk_all method creates a generator. In this case list(self._chunk_all(dobj)) is a list of length 1, presumably because we're using an "all" method._chunk_all creates a a YTDataChunk instance through yield YTDataChunk(dobj, "all", oobjs, dobj.size, cache)oobjs were created like this: oobjs = getattr(dobj._current_chunk, "objs", dobj._chunk_info). So essentially oobjs = dobj._chunk_info = self.meshes__init__ routine looks like this:
def __init__(self, dobj, chunk_type, objs, data_size = None,
field_type = None, cache = False, fast_index = None):
self.dobj = dobj
self.chunk_type = chunk_type
self.objs = objs
self.data_size = data_size
self._field_type = field_type
self._cache = cache
self._fast_index = fast_index
chunk_type = "all" and the objs are equal to the list of UnstructuredMeshesTo summarize, the YTSlice _current_chunk attribute is equal to a YTDataChunk instance with attributes of self.dobj equal to the YTSlice instance and self.objs equal to the list of UnstructuredMeshes.
However, what we actually pass to the the all (or maybe) important io._read_fluid_selection routine is chunks created from the _chunk_io(dobj) routine.
_chunk_io function also creates a generator; this time a generator that if it was converted into a list would be of length equal to the number of meshes.UnstructuredIndex._chunk_io) passes (in list form): chunks = [YTDataChunk_0 with dobj = YTSlice and objs = [UnstructuredMesh0], YTDataChunk_1 with dobj = YTSlice and objs = [UnstructuredMesh1], ..., YTDataChunk_N-1 with dobj = YTSlice and objs = [UnstructuredMeshN-1]UnstructuredIndex._chunk_all passes (in list form): chunks = [YTDataChunk with dobj = YTSlice and objs = [UnstructuredMesh0, UnstructuredMesh1, ..., UnstructuredMeshN-1]]
In [3]:
def createGenerator():
mylist = range(3)
for i in mylist:
yield i*i
my_generator_function = createGenerator()
print(my_generator_function)
And here's a regular function:
In [5]:
def createFunction():
mylist = range(3)
for i in mylist:
return i*i
my_regular_function = createFunction()
print(my_regular_function)
Psych! A function with a regular return returns as soon it hits return the first time.
In [6]:
for i in my_generator_function:
print(i)
In [8]:
list_from_gen = list(createGenerator())
print(list_from_gen)
print(len(list_from_gen))
In [3]:
slice.show()
In [6]:
print(array1)
print(array2)
In [2]:
slice = yt.SlicePlot(ds2, 'z', [('all','diffused')])
In [4]:
array1 = ad2[('connect1','diffused')]
array2 = ad2[('connect2','diffused')]
print(array1.shape)
print(array2.shape)
In [7]:
my_io_handler = yt.frontends.exodus_ii.IOHandlerExodusII(ds2)
In [8]:
variables = my_io_handler.handler.variables
print(variables)
In [27]:
ci = variables['connect1'][:] - 1
ci2 = variables['connect2'][:] - 1
In [ ]:
print(ci)
In [28]:
print(ci.shape)
print(ci2.shape)
In [33]:
import numpy as np
In [36]:
all_array = np.concatenate((ci, ci2))
print(all_array.shape)
In [37]:
print(variables['vals_nod_var1'][-1][all_array])
In [35]:
print(all_array)
In [30]:
newarray = ci + ci2
print(newarray.shape)
In [31]:
type(ci)
Out[31]:
In [21]:
print(variables['vals_nod_var1'].shape)
In [23]:
print(variables['vals_nod_var1'][1])
In [19]:
print(variables['vals_nod_var1'][-1][:])
print(variables['vals_nod_var1'][-1][:].shape)
In [18]:
print(variables['vals_nod_var1'][-1])
print(variables['vals_nod_var1'][-1].shape)
In [ ]:
print(variables['vals_nod_var1'][-1][ci])
print(variables['vals_nod_var1'][-1][ci].shape)
In [17]:
print(variables['vals_nod_var1'][ci])
print(variables['vals_nod_var1'][ci].shape)
In [11]:
print(my_io_handler.ds.step)
In [ ]: