HDF5

[4]:
import CactusTool

name = 'GW150914_test10'
sim = CactusTool.load(name, '/Volumes/simulations/HUST_error')
# dim include ['x', 'y', 'z', 'xy', 'xz', 'yz', 'xyz']
dim = 'xy'
ftype = 'h5'
print(sim.GF(dim, ftype).fname)
{'alpha', 'Psi4i', 'Psi4r', 'phi', 'r', 'y', 'z', 'x', 'trK'}
[5]:
GF = sim.GF(dim, ftype)['alpha']
print("Var:\n", GF.vars)
print("iteration:\n", GF.it)
print("hierarchy:\n", GF.hierarchy)
Var:
 {'alpha'}
iteration:
 {0, 1024, 12288, 10240, 11264, 13312, 14336, 15360, 16384, 17408, 20480, 4096, 8192, 24576, 21504, 25600, 28672, 29696, 33792, 32768, 37888, 41984, 46080, 36864, 5120, 40960, 9216, 45056, 18432, 2048, 22528, 26624, 30720, 34816, 38912, 43008, 47104, 6144, 19456, 23552, 27648, 3072, 31744, 35840, 39936, 44032, 7168}
hierarchy:
 {0: set(), 1: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, 2: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, 3: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, 4: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, 5: {0, 2, 3, 4, 5, 7, 8, 9, 11, 12}, 6: {0, 2, 3, 4, 5, 7, 8, 9, 11, 12}, 7: {0, 2, 3, 4, 5, 7, 8, 9, 11, 12}, 8: {0, 2, 3, 4, 5, 7, 8, 9, 11, 12}}
[14]:
from CactusTool.Visualize import pcolormesh
import matplotlib.pyplot as plt

p = GF.dsets('alpha', 44032, 3, -1)
time = list(p.keys())
fig, ax = plt.subplots()
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_title("Time: {}".format(time[0]))
im = pcolormesh(ax, p[time[0]])
fig.colorbar(im, ax=ax)
[14]:
<matplotlib.colorbar.Colorbar at 0x1229221f0>
../_images/Tutorial_GF_3_1.png

ASCII

[4]:
import CactusTool

name = 'nsnstohmns'
sim = CactusTool.load(name, '/Volumes/simulations/')
# dim include ['x', 'y', 'z', 'xy', 'xz', 'yz', 'xyz']
dim = 'x'
ftype = 'asc'
print(sim.GF(dim, ftype).fname)
# GF = sim.GF(dim, ftype)['rho']
# print(GF.vars)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-4-c1330f8b7712> in <module>
      6 dim = 'x'
      7 ftype = 'asc'
----> 8 print(sim.GF(dim, ftype).fname)
      9 # GF = sim.GF(dim, ftype)['rho']
     10 # print(GF.vars)

~/Desktop/CactusTool/CactusTool/main.py in GF(self, dim, ftype)
     77         else:
     78             fileList = glob.glob(self.simpath+os.path.sep+'*.{}.*{}'.format(dim, ftype))
---> 79         assert bool(fileList), "{} don't have '{}' dim in '.{}' ftype".format(self.simname, dim, ftype)
     80         return CarpetGF(fileList, dim, ftype)
     81

AssertionError: nsnstohmns don't have 'x' dim in '.asc' ftype
[ ]: