Command Line Tool

yt comes with a command-line tool, known as yt, that exposes much of the functionality that would normally be accessible through a scripts. This is designed to make the process of making immediate plots much easier. All of the functionality is described in the help strings:

$ yt help

and then the subcommands all have help options as well:

$ yt plot --help

In order to actually run the command, you’ll need to tell it which outputs to operate on. The yt command-line tool has three mechanisms for specifying outputs. It will do its best to guess based on the information its provided.

You can specify a base name for a parameter file and then a start and stop number (and optionally a skip parameter):

$ yt plot --basename=RedshiftOutput --skip 5 10 50

This will run your plot command on RedshiftOutput 10 through 50, but only on multiples of five. (And if your output is in a subdirectory, yt will check there too, don’t worry!)

You can specify a single parameter file:

$ yt plot RedshiftOutput0010

This will run your plot command on RedshiftOutput0010.

Alternatively, you can specify multiple parameter files on the command line:

$ yt plot RedshiftOutput0010 RedshiftOutput0020 RedshiftOutput0030

This will plot RedshiftOutput0010, RedshiftOutput0020, and RedshiftOutput0030.

Simple Statistics

To get information about a given parameter file, including the maximum density, the level information, the smallest cell size and some timing information, use the stats command:

$ yt stats RedshiftOutput0005
  0	     4	      32768
  1	    34	     253496
  2	   304	     525784
----------------------------
   	   342	     812048


z = 0.00000000
t = 6.46750660e+02 = 4.57786981e+17 s = 1.45163299e+10 years

Smallest Cell:
	Width: 7.812e-03 1
	Width: 7.812e-03 unitary
	Width: 3.906e-02 mpch
	Width: 3.906e-02 mpchcm
	Width: 6.010e-02 mpc
	Width: 7.812e-01 aye
	Width: 3.906e+01 kpch
	Width: 3.906e+01 kpchcm
	Width: 6.010e+01 kpc
	Width: 3.906e+04 pch
	Width: 3.906e+04 pchcm
	Width: 6.010e+04 pc
	Width: 8.059e+09 auh
	Width: 8.059e+09 auhcm
	Width: 1.240e+10 au
	Width: 8.659e+11 rsunh
	Width: 8.659e+11 rsunhcm
	Width: 1.332e+12 rsun
	Width: 7.488e+17 milesh
	Width: 7.488e+17 mileshcm
	Width: 1.152e+18 miles
	Width: 1.205e+23 cmh
	Width: 1.205e+23 cmhcm
	Width: 1.854e+23 cm
Maximum density: 4.43898e-27 at (0.94921875, 0.80078125, 0.61328125)

Plots

The command line tool can make either projections or slices. To make a projection, supply it with the -p option:

$ yt plot -p RedshiftOutput0005

If you don’t supply the -p option, it will only slice rather than project through the object. Weights can also be supplied for an average along the line of sight. This command defaults to the full width, centered on the most dense point, and outputting along all three axes. The help command has more information:

Create a set of images

Usage:
    yt plot [ARGS...]

Options:
    -h, --help          show this help message and exit
    -w WIDTH, --width=WIDTH
                        Width in specified units
    -u UNIT, --unit=UNIT
                        Desired units
    -b BASENAME, --basename=BASENAME
                        Basename of parameter files
    -p, --projection    Use a projection rather than a slice
    -c CENTER, --center=CENTER
                        Center (-1,-1,-1 for max)
    -z ZLIM, --zlim=ZLIM
                        Color limits (min, max)
    -a AXIS, --axis=AXIS
                        Axis (4 for all three)
    -f FIELD, --field=FIELD
                        Field to color by
    -g WEIGHT, --weight=WEIGHT
                        Field to weight projections with
    -s SKIP, --skip=SKIP
                        Skip factor for outputs
    --colormap=CMAP     Colormap name
    -o OUTPUT, --output=OUTPUT
                        Folder in which to place output images
    --show-grids        Show the grid boundaries

Zoomin Movies

The command line tool also has facilities for outputting a set of frames that zoom in on a central position. This works on a single dataset and can zoom in on projections or slices:

$ yt zoomin RedshiftOutput0005

However, as with the other commands, you will likely want to specify your own options.

Create a set of zoomin frames

Options:
    -h, --help          show this help message and exit
    --max-width=MAX_WIDTH
                        Maximum width in code units
    --min-width=MIN_WIDTH
                        Minimum width in units of smallest dx (default: 50)
    -p, --projection    Use a projection rather than a slice
    -a AXIS, --axis=AXIS
                        Axis (4 for all three)
    -f FIELD, --field=FIELD
                        Field to color by
    -g WEIGHT, --weight=WEIGHT
                        Field to weight projections with
    -z ZLIM, --zlim=ZLIM
                        Color limits (min, max)
    -n NFRAMES, --nframes=NFRAMES
                        Number of frames to generate
    -o OUTPUT, --output=OUTPUT
                        Folder in which to place output images
    --colormap=CMAP     Colormap name
    --unit-boxes        Display helpful unit boxes
    --dex=DEX           Number of dex above min to display
    -t TEXT, --text=TEXT
                        Textual annotation

Halo Profiler

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

Table Of Contents

Previous topic

A Slightly Longer Introduction

Next topic

Using and Manipulating Objects and Fields

This Page