yt.extensions Extensions API

There are some functions, routines and classes that utilize the yt API but aren’t necessarily a part of the core functionality. These live inside the yt/extensions/ subdirectory and are accessible by direct importation.

yt.extensions.coordinate_transforms Coordinate Transforms

This module allows the user to regrid existing data into an arbitrary coordinate system. It comes with the machinery to automatically regrid onto spherical coordinates.

Module author: Matthew Turk <matthewturk@gmail.com>

yt.extensions.coordinate_transforms.spherical_regrid(pf, nr, ntheta, nphi, rmax, fields, center=None, smoothed=True)
This function takes a parameter file (pf) along with the nr, ntheta and nphi points to generate out to rmax, and it grids fields onto those points and returns a dict. center if supplied will be the center, otherwise the most dense point will be chosen. smoothed governs whether regular covering grids or smoothed covering grids will be used.
yt.extensions.coordinate_transforms.arbitrary_regrid(new_grid, data_source, fields, smoothed=True)
This function accepts a dict of points ‘x’, ‘y’ and ‘z’ and a data source from which to interpolate new points, along with a list of fields it needs to regrid onto those xyz points. It then returns interpolated points. This has not been well-tested other than for regular spherical regridding.

Sample Usage

from yt.mods import *
from yt.extensions.coordinate_transforms import *

pf = load("galaxy1200.dir/galaxy1200")

nr, ntheta, nphi = 128, 180, 180
fields = ["Density", "Temperature"]
center = [0.5, 0.5, 0.5]

regrid = spherical_regrid(pf, nr, ntheta, nphi, fields, center)

yt.extensions.disk_analysis Disk Analysis

The disk stacker is a mechanism for taking many oblique slices (see cutting) and stacking them together. The mechanism here is rather simple – you feed in a normal angle, a disk height, a width, and it makes many slices through the domain and adds them all up. This enables a ‘stacked’ image of the disk to be produced.

Once the object has been instantiated, you can access any field as per normal and it will stack it as requested:

Module author: Matthew Turk <matthewturk@gmail.com>

class yt.extensions.disk_analysis.StackedDiskImage(pf, center, norm_vec, thickness, width, nslices=100, buff_size=(800, 800))
This class implements an AMR data object that will stack up oblique-slices to generate an image along an arbitrary axis.

Sample Usage

from yt.mods import *
from yt.extensions.disk_analysis import StackedDiskImage

pf = load("galaxy1200.dir/galaxy1200")
norm_vec = [0.2, 0.4, 0.1]
center = [0.8, 0.5, 0.3]
thickness = 5.0 / pf['kpc']
width = 100.0 / pf['kpc']
n_slices = 200
image_size = (800, 800)

disk = StackedDiskImage(pf, center, norm_vec,
                        thickness, width, nslices, image_size)
my_disk_image = disk["Density"]

yt.extensions.HaloProfiler Halo Profiler

This module allows for systematic analysis and imaging of halos found in a simulation.

Module author: Britton Smith <brittonsmith@gmail.com>

yt.extensions.HierarchySubset Hierarchy Subset

This module provides a mechanism for extracted a subset of a hierarchy. Typically this is used to export data to VTK or Amira format.

Module author: Matthew Turk <matthewturk@gmail.com>

class yt.extensions.HierarchySubset.ConstructedRootGrid(base_pf, pf, hierarchy, level, left_edge, right_edge)
This is a fake root grid, constructed by creating a yt.lagos.CoveringGridBase at a given level between left_edge and right_edge.
class yt.extensions.HierarchySubset.ExtractedHierarchy(pf, data_style)

yt.extensions.SpectralIntegrator Spectral Integrator

This module provides a mechanism for integrating emissivity output from CLOUDY and creating integrated X-ray emissivity fields.

Module author: Matthew Turk <matthewturk@gmail.com>

class yt.extensions.SpectralIntegrator.SpectralFrequencyIntegrator(table, field_names, bounds, ev_bounds)

From a table, interpolate over field_names to get resultant luminosity. Table must be of the style such that it is ordered by [field_names[0], field_names[1], ev]

add_frequency_bin_field(ev_min, ev_max)

Add a new field to the FieldInfoContainer, which is an integrated bin from ev_min to ev_max.

Returns the name of the new field.

yt.extensions.SpectralIntegrator.create_table_from_textfiles(pattern, rho_spec, e_spec, T_spec)
This accepts a CLOUDY text file of emissivities and constructs an interpolation table for spectral integration.

yt.extensions.lightcone Light Cone Generation

yt has the facility to create light cones, which are stacks of images generated from a series of simulations. The code to generate this is in the module lightcone.

Module author: Britton Smith <brittonsmith@gmail.com>

Comments

Feel free to leave comments! If you've got a GMail account, you can use https://www.google.com/accounts/o8/id as your OpenID URL.
comments powered by Disqus