-
Notifications
You must be signed in to change notification settings - Fork 1
Trace File Output Format
In addition to images, ipole can output full source information on the local fluid state along geodesics used to generate the pixels of an image. This is usually called a "trace" file, and defaults to the name trace.h5
.
This file contains exactly the same header
and fluid_header
groups as an image file, as well as some standard base variables (Mdot, MdotEdd) -- their documentation can be found here.
The trace file outputs a number of variables interpolated/evaluated locally at each point which ipole uses for ray-tracing. The exact number of steps is recorded in a 2D array nstep, with one value for each traced pixel (for a single-pixel trace, 1x1. For traces ever N pixels, NX/N x NY/N).
The rest of the arrays have the same first 2 dimensions as nstep, but an additional dimension of MAXNSTEP (usually 10000). Of this, only the first few values are populated, and the rest are left 0 (that is, var[i,j,:nstep[i,j]] will return all interesting values for a scalar variable var).
By far the most useful output is the emission, absorption, and rotation coefficients j_inv, alpha_inv, rho_inv. Note that these are the invariant versions, i.e. j_nu/nu^2, and are output in CGS. The coefficients are structured in 3 arrays, each with a final dimension of 4 corresponding to the Stokes variable I,Q,U,V. For example, since there is no rho_I, rho[:, :, :, 0] = 0. Since in fluid frame rho_U is 0, rho[:, :, :, 2] =0.
ipole
also records the values used to compute these coefficients:
- thetae: Electron temperature in units of electron mass
- ne: Electron number density in CGS
- b: magnetic field in CGS
- b_k_angle: angle between magnetic field and wavevector in radians
- nu: fluid-frame frequency in Hz
- r, th, phi: Spherical KS coordinates of the step location along the geodesic. Steps progress from camera -> origin
- X: Code coordinates of the location, usually "Funky" MKS see Coordinates
Spherical KS coordinates are included, but if desired, one can reconstruct coordinates from X
using pyHARM:
from pyHARM.coordinates import MKS, FMKS
from pyHARM.h5io import read_hdr
trace_file = h5py.File("trace.h5", "r")
hdr = read_hdr(trace_file['/fluid_header'])
coords = FMKS(hdr)
X = trace_file['X'][()]
r, th, phi = coords.ks_coord(X.transpose(3,0,1,2))
x, y, z = coords.cart_coord(X.transpose(3,0,1,2))