# Difference between revisions of "LineSampler Operator in VisIt"

## Line sampler Operator

The Line Sampler takes as input scalar data and samples it in a variety of different ways. The goal is to sample the data in much the same way one would sample experiments. The simplest is to take a sample along a 1D chord (a channel) and display it as 1D plot. However,

## Main Tab

• Mesh geometry - The mesh can be on several different geometries. Knowing the geometry is necessary to allow for properly interpreting the transforms need for the sampling but also for clipping the chords (channels) used for the sampling.
Cartesian coordinate system with a standard i, j, k indexing relating to cartesian coordinates.
Cylindrical coordinate system with a standard R, Phi, Z indexing relating to cylindrical coordinates (overlay directly to cartesian such that R->X, Phi->Y, Z->Z).
Toroidal coordinate system with a standard R, Phi, Z indexing relating to cartesian coordinates. Needed to insure that chords (channels) do not intrude past the central region of the torus.
• Array configuration - One can define a series of arrays either by the defining geometry or specifying individual channels.
Geometry - Define the array of channels using different geometries. Activates the Geometry Tab
Manual list - Define the array of channels via a start location and a rotation for individual channels, or read a series of individual channels from a file. Activates the List Tab
• Boundary - The sampling can be clipped at the boundaries of the data.
Data File - clip the last sample at the bounds of the data file extents.
Wall file - clip the first and last sample at the bounds based of the profile the experimental wall file extents.

• Read wall configuration file - Open an ascii file containing the 2D coordinates describing the "wall" profile of the experiment.

Example of a configuration file:

```[diiidSimpleWall]
machine="diii-d"
```
```nWall=89
```
```Rwall=1.016,1.016,1.018,1.018,1.018,1.018,1.018,1.018,1.018,1.018,1.016,1.012,1.001,1.029,1.042,1.046,1.056,1.097,1.108,1.116,1.134,1.148,1.162,1.181,1.182,1.185,1.19,1.195,1.201,1.209,1.215,1.222,1.228,1.234,1.239,1.242,1.248,1.258,1.263,1.28,1.28,1.28, 1.31, 1.328,1.361,1.38, 1.419,1.419,1.372,1.372,1.608,1.647,1.785,2.07,2.128,2.245,2.323,2.377,2.352,2.351,2.351,2.354,2.354,2.354,2.353,2.351,2.353,2.377,2.134,1.786,1.768,1.768,1.682,1.674,1.674,1.681,1.754,1.754,1.689,1.689,1.555,1.412,1.273,1.153,1.016,1.016,1.016,1.016,1.016
```
```Zwall=0., 0.964,0.968,1.001,1.019,1.077,1.07, 1.096,1.113,1.138,1.147,1.165,1.217,1.217,1.1624, 1.16238,1.1626, 1.1645, 1.16594,1.16591,1.16896,1.17175,1.17556,1.183,1.1835, 1.185,1.188,1.191,1.196,1.202,1.208,1.214,1.221,1.231,1.238,1.244,1.254,1.278,1.29, 1.331,1.347,1.348,1.348,1.348,1.348,1.348,1.348,1.31, 1.31,1.292,1.095,1.077,1.077,1.04, 0.993,0.709,0.519,0.389,0.4,0.337,0.205,0.068,0.,-0.068, -0.205,-0.337, -0.4, -0.389, -0.973, -1.174, -1.211, -1.254, -1.254,-1.262, -1.329, -1.339, -1.339, -1.368, -1.368, -1.366, -1.366,-1.366, -1.366, -1.366, -1.229, -0.8, -0.415, -0.4,0.
```

## Geometry Tab

### Array description

Describe the arrays via a series of geometric transforms. Depending on the mesh geometery the transforms may be either cartesian or cylindrical.

• Number of arrays – (Default 1) Number of arrays to create.
• Y Distance/Toroidal angle between arrays – (Default 5) Offset/Angle between each array

### Divergent Tab

Create a series of channels that all originate at a common starting point.

• Number of divergent channels - (Default 5) number of channels in each array.
• Relative angle between channels - (Default 5) angular offset between each channel.

### Parallel Tab

Create a series of channels that all parallel to one another and in a single plane.

• Number of parallel channels - (Default 5) number of channels in each array.
• Offset between channels - (Default 0.1) linear offset between each channel.

### Grid Tab

Create a series of channels that all parallel to one another and in a multiple planes.

• Number of channels per column - (Default 5) number of channels in each array.
• Offset between channels - (Default 0.1) linear offset between each channel.
• Number of rows - (Default 1) number of rows in each array.
• Offset between rows - (Default 0.1) linear offset between each row.

### Array/Channel geometry

• Array origin – (Default 0,0,0) Origin of the center of the array. Note for parallel and grid arrays the origin is the centroid of the array. Note: typically Y/Phi=0 and that value is set as the Y axis offset/Toroidal Angle. The origin must be outside of the sample volume.
• Array axis direction:
X/R – from the origin cast the channel in the -X direction.
Z (Default) - from the origin cast the channel in the -X direction.
• Y axis rotation/Poloidal Angle - (Default 0) rotate the each channel about the Y/Poloidal axis with the rotation centered about the origin.
• Y plane X tilt/Poloidal plane X tilt - (Default 0) tilt the array plane about the X/R axis with the rotation centered about the origin.
• Y plane Z tilt/Poloidal plane Z tilt - (Default 0) tilt the array plane about the Z axis with the rotation centered about the origin.
• Y axis offset/Toroidal Angle - (Default 0) translate the array plane along the Y axis or rotate the array plane about the Z axis with the rotation centered about 0,0,0.

## List Tab

Describe the arrays via a direct description of the origin and Y Axis/Poloidal rotation. Depending on the mesh geometery the transforms may be either cartesian or cylindrical.

### Array description

• Number of arrays – (Default 1) Number of arrays to create.
• Y Distance/Toroidal angle between arrays – (Default 5) Offset/Angle between each array

### Channel configuration

• Read channel configuration file - Read an ascii configuration file containing X,Y,Z, and a Y axis rotation or R,Z, Phi, and Poloidal Angle. Reading in a list will automatically delete all current channels.
• Add Channel - Add a new channel to the list
• Delete Channel - Delete a channel from the list
• Delete all channels - Delete all channels from the list

Example of a configuration file:

```[diiidSoftXray]
machine="diii-d"
```
```nChannels=60
```
```Rsxr= 2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,2.489,1.976,1.976,1.976,1.976,1.976,1.976,1.976,1.976,1.976,1.976,1.976,1.976,1.976,1.976,1.976,1.976,1.945,1.945,1.945,1.945,1.945,1.945,1.945,1.945,1.945,1.945,1.945,1.945
```
```Zsxr= -.107,-.107,-.107,-.107,-.107,-.107,-.107,-.107,-.107,-.107,-.107,-.107,-.107,-.107,-.107,-.107,-.147,-.147,-.147,-.147,-.147,-.147,-.147,-.147,-.147,-.147,-.147,-.147,-.147,-.147,-.147,-147,1.301,1.301,1.301,1.301,1.301,1.301,1.301,1.301,1.301,1.301,1.301,1.301,1.301,1.301,1.301,1.301,1.326,1.326,1.326,1.326,1.326,1.326,1.326,1.326,1.326,1.326,1.326,1.326
```
```PhiSxr= 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.
```
```AngSxr=120.,124.,128.,132.,136.,140.,144.,148.,152.,156.,160.,164.,168.,172.,176.,180.,180.,184.,188.,192.,196.,200.,204.,208.,212.,216.,220.,224.,228.,232.,236.,240.,294.5,290.5,286.5,282.5,278.5,274.5,270.5,266.5,262.5,258.5,254.5,250.5,246.5,242.5,238.5,234.5,234.5,230.5,226.5,222.5,218.5,214.5,210.5,206.5,202.5,198.5,194.5,190.5
```

### Array geometry

• Y axis offset/Toroidal Offset Angle - (Default 0) translate the array plane along the Y axis or rotate the array plane about the Z axis with the rotation centered about 0,0,0.

## Sampling Tab

### Geometry

• Channel Geometry - the channel can be a point sample, sampled along a line, or as a cylinder with volume.
Point - sample as a point. The sample location is the origin plus the linear sample distance.
Line - (Default) sample along a line with the sampling distance being the linear sample distance.
Cylinder - sample along a cylinder with the sampling distance along the axis and radius being the linear sample distance. If the radius is .1 and the linear sample distance 0.05, samples will be taken at r=0, 0.05, and 0.1. The samples from each radial disk will be summed together with each each sample multiplied by the sample volume.
• Linear sample distance - linear distance between samples.
• Sample volume - volume of the sample.
• Cylinder radius - radius of the cylinder.
• Cylinder sample profile
TopHat - (Default) Use a flat profile weighting for the sampling as the samples move out radially.
Gaussian - (Default) Use a Gaussian profile weighting for the sampling as the samples move out radially.
• Standard deviation - standard deviation for the Gaussian profile.

### Integration

• Channel Integration
None - (Default)
Integrate along the channel - sum the sample values along the channel, multiplying each by the sample volume.
• Y Axis/Toroidal Integration
None - (Default)
Sample Y axis/toroidally as time - sample at each Y location/toroidal angle as if it where like sampling in time (i.e. the Y location/toroidal angle is the chord).

### Y Axis/Toroidal Sampling

• Sample
Absolute - (Default) sample based on the start and increment.
Relative - Sample relative to the based location/angle and increment.
• Start - first offset/angle step to sample
• Stop - last offset/angle step to sample
• Stride - interval between samples.

### Time Sampling

• Sample
Current Time Step - (Default) Sample only the current time step
Multiple Time Steps - Sample multiple times steps as defined below.
• Start - first time step to sample
• Stop - last time step to sample
• Stride - interval between time steps.

## View Tab

• View Dimension - the channels are constructed and sampled in 3D but can be displayed in a 1D ,2D, or 3D window.
One - display the resulting sampling as a 1D height plot
Two - Remove all Y translations/Poloidal Rotations and display the arrays in a 2D plane
Three - display the channels as they are constructed

### 1D plot viewing parameters

Rather than seeing overlapping plots is it possible to offset the plots. The values help do that by offsetting the each channel and each array of channels.

• 1D plot height scale - (Default 1) scale the sampled value
• 1D plot channel offset - (Default 0) Offset in the Y direction each channel.
• 1D plot array offset - (Default 0) Offset in the X direction each array of channel.
• Display time using
Step - (Default) use the step value along the X axis with sampling over multiple time steps
Time - use the time value along the X axis with sampling over multiple time steps
Cycle use the cycle value along the X axis with sampling over multiple time steps

### Misc viewing parameters

• View geometry - change the default drawing.
Points - display the geometry as points. (i.e. shows the sample locations as points).
Lines - display the geometry as lines (i.e. displays cylinders as a line)
Surfaces - (Default) display the geometry as surfaces, lines, or points as applicable.

## How to use

In the first window start with a pseudo color plot. If needed, transform your data into cartesian coordinates. Make sure that is all like you want it. All you should see is the outer shell of the data. In pseudo color plot adjust the transparency to 20-25% so you can see through the volume. THat gives you a reference volume.

Clone that plot, then add the Slice->Linesampler. For this plot change the transparency back to 100% and turn off lighting.

In the Line sampler GUI:

Main Tab

Mesh Geometry -> Torus

Array Config -> Geometry

Boundary -> Data File

Geometry Tab

No. Arrays -> 1

Select Diverget Tab

No Channels -> 5

Angle between -> 5

Array Origin -> 2 0 2 (or whatever is a point OUTSIDE the volume)

The coordinates are the same coordinates as the data. Though the data is in cartesian think in terms of R-Phi-Z. So the origin should be R=2, Phi=0, Z=2 for D3D. It is important that the origin be outside the sample volume (which it should be as that defines the location of the "detector".

Note Phi should be zero as you can specify a toroidal angle

Array Axis direction Z (i.e. the base channel is parallel to Z)

Poloidal angle -> rotation of poloidal plane 0 for now

Poloidal angle -> rotation of poloidal plane 0 for now

R tilt -> R tilt of the poloidal plane 0 for now

Z tilt -> Z tilt of the poloidal plane 0 for now

Toroidal angle -> rotation of poloidal plane to a specific toroidal angle 0 for now

List Tab -> ignore for now

Sampling Tab

Geometry:

Channel Geometry -> Line

Sample dist. .1

Leave everything else

View Tab:

View Dimension -> 3

Now apply and draw the plot. You should see the array with 5 channels. Adjust some of the geometry parameters to see how they affect the array.

Now let see what the sampled looks like as a 1D plot.

Clone the window (not the plot).

Delete the pseudo color plot of the volume but keep the plot with the line sampler.

Go to the Line Sampler GUI

View Tab

View Dim -> 1D

Now apply and draw the plot. You should see the array with 5 channels, with the data drawn as overlapping 1D height plots.

In the plot window right click and set the View -> Full Frame

View Tab

The 1D plot viewing parameters can be used to change the drawing from over lapping plots to a series of plots

1d height scale -> 1e-4 (something to make the range 0 -> 1)

1d channel offset -> 1 (separate the plots by 1 - which is why the scale should make everything 0->1)

Now apply and draw the plot. You should see the array with 5 channels, with the data drawn as 2D height plots but each one is separated.