コード例 #1
0
ファイル: data_objects.py プロジェクト: DeovratPrasad/yt_ap
class Suite:
    dsname = "HiresIsolatedGalaxy/DD0044/DD0044"

    def setup(self):
        if yt.__version__.startswith('3'):
            self.ds = yt.load(self.dsname)
            self.ad = self.ds.all_data()
            self.field_name = "density"
        else:
            self.ds = load(self.dsname)
            self.ad = self.ds.h.all_data()
            self.field_name = "Density"
        # Warmup hdd
        self.ad[self.field_name]
        if yt.__version__.startswith('3'):
            mi, ma = self.ad.quantities['Extrema'](self.field_name)
            self.tf = yt.ColorTransferFunction(
                (np.log10(mi) + 1, np.log10(ma)))
        else:
            mi, ma = self.ad.quantities['Extrema'](self.field_name)[0]
            self.tf = ColorTransferFunction((np.log10(mi) + 1, np.log10(ma)))
        self.tf.add_layers(5, w=0.02, colormap="spectral")
        self.c = [0.5, 0.5, 0.5]
        self.L = [0.5, 0.2, 0.7]
        self.W = 1.0
        self.Npixels = 512

    if yt.__version__.startswith('3'):

        def time_load_all_data(self):
            dd = self.ds.all_data()
            dd[self.field_name]
    else:

        def time_load_all_data(self):
            self.ds.h.all_data()
            dd[self.field_name]

    def time_extrema_quantities(self):
        self.ad.quantities['Extrema'](self.field_name)

    if yt.__version__.startswith('3'):

        def time_alldata_projection(self):
            self.ds.proj(self.field_name, 0)
    else:

        def time_alldata_projection(self):
            self.ds.h.proj(0, self.field_name)

    if yt.__version__.startswith('3'):

        def time_slice(self):
            slc = self.ds.slice(0, 0.5)
            slc[self.field_name]
    else:

        def time_slice(self):
            slc = self.ds.h.slice(0, 0.5, self.field_name)
            slc[self.field_name]
コード例 #2
0
class Suite:
    dsname = "HiresIsolatedGalaxy/DD0044/DD0044"
    def setup(self):
        if yt.__version__.startswith('3'):
            self.ds = yt.load(self.dsname)
            self.ad = self.ds.all_data()
            self.field_name = "density"
        else:
            self.ds = load(self.dsname)
            self.ad = self.ds.h.all_data()
            self.field_name = "Density"
        # Warmup hdd
        self.ad[self.field_name]
        if yt.__version__.startswith('3'):
            mi, ma = self.ad.quantities['Extrema'](self.field_name)
            self.tf = yt.ColorTransferFunction((np.log10(mi)+1, np.log10(ma)))
        else:
            mi, ma = self.ad.quantities['Extrema'](self.field_name)[0]
            self.tf = ColorTransferFunction((np.log10(mi)+1, np.log10(ma)))
        self.tf.add_layers(5, w=0.02, colormap="spectral")
        self.c = [0.5, 0.5, 0.5]
        self.L = [0.5, 0.2, 0.7]
        self.W = 1.0
        self.Npixels = 512

    if yt.__version__.startswith('3'):
        def time_load_all_data(self):
            dd = self.ds.all_data()
            dd[self.field_name]
    else:
        def time_load_all_data(self):
            self.ds.h.all_data()
            dd[self.field_name]

    def time_extrema_quantities(self):
        self.ad.quantities['Extrema'](self.field_name)

    if yt.__version__.startswith('3'):
        def time_alldata_projection(self):
            self.ds.proj(self.field_name, 0)
    else:
        def time_alldata_projection(self):
           self.ds.h.proj(0, self.field_name)

    if yt.__version__.startswith('3'):
        def time_slice(self):
            slc = self.ds.slice(0, 0.5)
            slc[self.field_name]
    else:
        def time_slice(self):
            slc = self.ds.h.slice(0, 0.5, self.field_name)
            slc[self.field_name]
コード例 #3
0
ファイル: yt_snapshot.py プロジェクト: hopehhchen/Per_B5
L = np.array([0.0, 0.0, -1.0])
W = 120
N = 1024


# Create camera objects
cam_c18o= pf.h.camera(c, L, W, N, tf_c18o,
                       fields=['temperature'], log_fields=[False],
                       no_ghost=True, north_vector = [0., 1., 0.])
cam_11 = pf.h.camera(c, L, W, N, tf_11,
                       fields=['temprature_1'], log_fields=[False],
                       no_ghost=True, north_vector = [0., 1., 0.])


# Set up layers
tf_c18o.add_layers(10, 0.003, colormap='RdBu_r')  #was 10, .0001
tf_11.add_layers(18, .003, colormap = 'Reds')


# Produce snapshot
N = 36*4

images_c18o = []
for i, snapshot in enumerate(cam_c18o.rotation(2*np.pi, N, clip_ratio = 8.0, rot_vector = [0., 1., 0.])):
	images_c18o.append(cam_c18o.snapshot())

images_11 = []
for i, snapshot in enumerate(cam_11.rotation(2*np.pi, N, clip_ratio = 8.0, rot_vecotr = [0., 1., 0.])):
	images_11.append(cam_11.snapshot())

for i in range(N):
コード例 #4
0
ファイル: scipy_2014_entry.py プロジェクト: NelleV/jhepc
L = np.array([1.0, 1.0, 1.0])
W = 0.7 / pf["unitary"]
N = 512

# Create camera objects

cam_temp = pf.h.camera(c, L, W, N, tf_temp,
                       fields=['temperature'], log_fields=[True],
                       no_ghost=False)

cam_dens = pf.h.camera(c, L, W, N, tf_dens,
                       fields=['density'], log_fields=[True],
                       no_ghost=False)

# Set up layers
tf_temp.add_layers(10, 0.0001, colormap='RdBu_r')
tf_dens.add_layers(10, 0.003, colormap='winter')

# Fly around

N = 36 * 4

images_temp = []

for i, snapshot in enumerate(cam_temp.rotation(2. * np.pi, N, clip_ratio=8.0)):
    images_temp.append(cam_temp.snapshot())

images_dens = []

for i, snapshot in enumerate(cam_dens.rotation(2. * np.pi, N, clip_ratio=8.0)):
    images_dens.append(cam_dens.snapshot())
コード例 #5
0
                       tf_temp,
                       fields=['temperature'],
                       log_fields=[True],
                       no_ghost=False)

cam_dens = pf.h.camera(c,
                       L,
                       W,
                       N,
                       tf_dens,
                       fields=['density'],
                       log_fields=[True],
                       no_ghost=False)

# Set up layers
tf_temp.add_layers(10, 0.0001, colormap='RdBu_r')
tf_dens.add_layers(10, 0.003, colormap='winter')

# Fly around

N = 36 * 4

images_temp = []

for i, snapshot in enumerate(cam_temp.rotation(2. * np.pi, N, clip_ratio=8.0)):
    images_temp.append(cam_temp.snapshot())

images_dens = []

for i, snapshot in enumerate(cam_dens.rotation(2. * np.pi, N, clip_ratio=8.0)):
    images_dens.append(cam_dens.snapshot())