Geometric kernels¶
The way SOFT is constructed makes it possible to rewrite the “SOFT equation” on the form
where \(I_{ij}\) is the brightness of pixel \((i, j)\), and \(\hat{I}_{ij}\) denotes the geometric kernel function for a particular detector/tokamak combination, that connects the distribution of runaways of a particular velocity and initial position, with the image seen by a particular camera in a specific tokamak. The great benefit of this formulation is that only a set of multiplications are required to produce the synchrotron radiation image seen by a camera. A similar formulation for the synchrotron spectrum exists.
The format of the Green’s function is specified in the pi-file using
the dimensions option. The value of this option is a set of characters
denoting each of the variables that should appear in the Green’s function.
For example, dimensions = r12ij would generate a Green’s function containing
information about radius, velocity coordinate 1, velocity coordinate 2 as well
as both pixels of the image. The possible characters and their meaning are:
| Function | Description |
|---|---|
1 |
Velocity coordinate 1. Depends on which coordinates are used in the pi-file. |
2 |
Velocity coordinate 2. Depends on which coordinates are used in the pi-file. |
i |
The “y”-axis of the image. |
j |
The “x”-axis of the image. |
r |
Radial coordinate. |
w |
Spectrum wavelength. |
To generate a geometric kernel function with SOFT, create a new sycout
environment in your pi file with the format
sycout green {
format=mat
output=greenW.mat
function=r12ij
pixels=60
}
All options for the green sycout are documented in the Parameter reference.
Output file¶
The file generated by SOFT containing the geometric kernel function will
contain the variables listed in the table below. The actual geometric
kernel functions is found as a vector named func which can be
reshaped to be handled more easily.
| Variable | Type | Description |
func |
1-by-\(n_\rho n_1 n_2 n_\lambda n_i n_j\) vector | Geometric kernel function |
param1 |
1-by-\(n_1\) vector | Velocity parameter #1 |
param1name |
String | Name of velocity parameter #1. E.g. ppar. |
param2 |
1-by-\(n_2\) vector | Velocity parameter #2 |
param2name |
String | Name of velocity parameter #2. E.g. pperp. |
pixels |
Integer | Number of pixels |
r |
1-by-\(n_\rho\) vector | List of radial points |
stokesparams |
Integer | 1 if elements are Stokes parameters. 0 if only intensities are stored. |
type |
String | Type of geometric kernel. Either of the functions listed in the table above. |
wavelengths |
1-by-\(n_\lambda\) vector | List of wavelength points. |
Working with kernel function¶
To more easily work with the geometric kernel function it should be reshaped into an appropriately dimensioned array. In Matlab, this can be done through
load softOutput % Kernel function assumed to be located in 'softOutput.mat'
% Get number of elements in each dimension
nw = length(wavelengths);
n1 = length(param1);
n2 = length(param2);
nr = length(r);
% Reshape kernel function
Ihat = reshape(func, [pixels, pixels, nw, n2, n1, nr]);
% Access image at radius #1, param1 #2, param2 #3 and wavelength #4
I = squeeze(Ihat(:, :, 4, 3, 2, 1));
and similarly in Python
import numpy as np
import scipy.io
# Load mat-file
matfile = scipy.io.loadmat('softOutput.mat')
# Set variables
func = matfile['func'][0]
pixels = matfile['pixels'][0][0]
param1 = matfile['param1'][0]
param1name = matfile['param1name'][0]
# ...and the same for all other variables...
# Get number of elements in each dimension
nr = r.size
n1 = param1.size
n2 = param2.size
nw = wavelengths.size
# Reshape kernel function
Ihat = np.reshape(func, (nr, n1, n2, nw, pixels, pixels))
Note
The order in which the number of elements are given to reshape is very
significant!
The above examples are for a function of type r12ij.