7. Log Viewer¶
The Log Viewer provides an environment for plotting and analyzing log files. The viewer is started by double-clicking a log in the Log Browser, which will bring up the main Log Viewer window (see Fig. LogViewer). The dialog contains a list with all entries in the log, a plot showing the currently selected entries, and a set of controls on the left for configuring the plot. The data can be plotted as individual Traces or as an Image, and the user can quickly switch between the two modes using the Traces/Image buttons in the tool bar. The Log Viewer also provide options for saving a View of the log data, which allows plot settings and analysis configurations to be easily restored.
7.1. Plot config¶
The plot configuration tools on the left-hand side of the dialog determines what is plotted in the graph. The controls are:
- The top-most control sets the channel to plot in the graph. If the channel contains complex values, the user can choose to plot the Real, Imaginary, Magnitude or Phase of the signal.
- The next control defines the x-axis in the plot.
- Rotation/x (complex only):
- This introduces a phase rotation per x-unit to a complex trace, which has the same effect has compensating for electrical delay when plotting signal transmission versus frequency. The “Calculate”-button next to the control estimates the rotation value that will best compensate such delays. The controls are only visible if the plotted quantity is complex.
- Fixed Rotation (complex only):
- This introduces a fixed phase rotation to a complex trace. The “Calculate”-button next to the control estimates the rotation value that will maximize the signal in the real component, while minimizing the signal in the imaginary one. The controls are only visible if the plotted quantity is complex.
- Plot in dB (complex only):
- If plotting magnitude, this converts the value to dB, using the formula . The control is only visible if the plotted quantity is complex.
- Unwrap angle (complex only):
- If plotting the phase, this will unwrap phase jumps around . The control is only visible if the plotted quantity is complex.
- Auto-rotate (complex only):
- If checked, the program will automatically rotate the phase of each trace to maximize the real part of the signal. This is the same as the the “Fixed Rotation/Calculate”-button, but the algorithm is applied for each trace individually, which means that the individual traces will generally be rotated by different amounts.
Applies an operation to each selected trace. The following operations are available:
: Subtract the average value from each trace.
Normalize: The traces are normalized using the formula .
: Calculate the numerical derivative.
FFT: Numerical Fourier transform. Only positive frequency are shown in the resulting plot.
Histogram: Bin the data into a histogram, the number of bins is set by the “Bins” control.
Histogram-2D: Bin complex data into a 2D histogram, with the x/y-axes given by the real and imaginary parts of the data. The function only works for complex values.
- Smooth the trace by taking a running average over the number of data points specified in the control.
Applies an operation to the collection of all selected traces. The following trace operations are available:
Show individual: Standard operation, plot the individual traces as they are.
Subtract first: Subtract the first selected trace from the following traces.
Subtract previous: Subtract the previous trace. The plot will contain N/2 elements, with data (Trace 2 - Trace 1), (Trace 4 - Trace 3), (Trace 6 - Trace 5), etc...
Average: Plots the average of all selected traces.
Standard deviation: Plots the standard deviation of all selected traces.
If the “Enable equations”-control is checked, the - and
-values in the plot are modified according to the equations
given in the two text controls. The equation supports most standard
mathematical functions like
exp(x), etc... Note that the raised operator () is
implemented as two multiplication signs (
In addition to the variables and that represents the input data, the following parameters can be used in the equations:
- Value of other channels in the measurement. The channels are
accessed by the parameter , where is a number
that represents the channel shown in the list below the equation
controls. Note that the value will be complex if the channel
represents a complex quantity; use
abs(p#)to get real, imaginary or the magnitude of the data.
- A vector with values , where is the number of elements in the trace.
- Trace number, starting with for the first measured trace, which is the same as the #-parameter in the log entry list.
- Trace number, starting with for the first selected trace.
7.1.2. Physical vs. Instrument units¶
Select “Tools/Plot Dat in Instrument Units” to show the data in instrument units instead of physical units. The default units (physical or instrument) can be set in the Preferences dialog, under “Measurements/Units”.
7.2. Entry list¶
The entry list shows the contest of the log file, with each entry representing a one-dimensional trace of data. For multi-dimensional logs, the Log Viewer supports two different modes, which are controlled by the “Table”-control to the right of the list. The two modes are:
- Log list:
- This is the default mode, where the list contains the entries in the order that they were measured, and where the selected entries are shown directly in the graph.
- In this mode, the list becomes multi-dimensional, with each column representing a step dimension in the Measurement configuration file. The mode supports data slicing along different dimensions. The slice directions is set by the “Slice parameter”-control directly above the log list.
7.3. Tool bar¶
The toolbar contains the following buttons:
- Open Log:
- Open another log file.
- Reload Log:
- Reload the current log file, which is useful if the measurement is ongoing and new data has been added to the log.
- Show the Export Figure dialog, for exporting the currently selected data to an image file.
- Views/Save View:
- Select/save the current view. See Section Views for more information.
- Switch between Trace and Image plot mode.
- Plot controls:
- The plot controls contains tools for zooming/panning the graph, and for enabling/disabling the cursors. If in Image mode, there are a few extra buttons for transposing the data and enabling cross-sections and contrast controls.
- Show config:
- The button will show/hide an additional side bar with all the instrument configurations in the currently selected log. Below the list of quantities, there is a checkbox “Show all quantities”; if checked, all instrument quantities and values are shown in the list, otherwise only the quantities present as channels in the Measurement configuration are displayed. The “Project” and “User” controls at the bottom of the dialog allow the Project and User tags to be modified.
7.4. Multi-panel graph mode¶
The multi-panel graph allows multiple channels from a single log entry to be plotted in one or multiple graphs, as shown in Fig. LogViewerMultiPanel. To enable multi-panel graph mode, select “Views/Show multiple Graphs” from the pull-down menu. The multi-panel mode is enabled by default if the log file contains more than one log channel. When the multi-panel graph mode is enabled, the toolbar at the top of the window contains an extra sub-menu for selecting number of figures to be shown, and for controlling whether the x- and y-axes of the figures should be synchronized or not.
In multi-panel graph mode, the Y-channel control in the Plot config group in the upper-left corner of the window is replaced by a list of all measured channels. The channels can be assigned to one or multiple graphs by right-clicking the channel name and selecting a graph, by right-clicking one of the graphs and selecting a channel, or by dragging a channel entry onto one of the graphs. The default multi-panel graph configuration can be set in the Preferences dialog.
7.5. Image mode¶
In Image mode, the graph with the individual traces is replaced by an image map, as depicted in Fig. LogViewerImage. The third dimension data is specified by the controls in the “Third dimension”-group in the left-hand side of the dialog. In addition to specifying the data source, there are controls for performing basic signal operations along the third dimension, similar to the trace operations described in Section PlotConfig. The “Third dimension”-group also contains the following buttons:
- Show trace list:
- If checked, a trace list is shown allowing the user to select which traces to include in the image map.
- Ignore x-data:
- If checked, the program will take the x-data from the first data trace and ignore the x-values of subsequent traces. This is useful for confining the representation to a square image plot for data where the x-values are changing from trace to trace.
If the log files contains more than two dimension, there will be a “Data selection”-list appearing under the group of “Third dimension” controls. The list allows the user to select which subset of data to show in the image plot. In image mode, there are a few extra buttons in the toolbar at the top of the window.
- Switch X- and Y-axes in the image map.
- Show the contrast controls, allowing the user to set the contrast range of the image. The range can be manually controlled by shifting the range cursors in the spectrum plot. The “Auto range”-button will optimize the contrast by removing outliers, while the “Full range”-button will return to full range.
- X/Y cross sections:
- Show the X/Y-cross sections. The position of the cross section is controlled by moving the cursors around.
Views provide a way to save the current plot settings and selection of log entries, so that the current view can be easily restored. The most recently defined View will also be the preview of the log that is shown in the preview graph of the Log browser.
To save the current view, click the “Save view”-button in the tool bar or select “Views/Save view...” in the menu, define a name of the View and click the “OK”-button.
To restore a previously saved view, select the View to show from the “View”-control in the toolbar. Views can be renamed or deleted from the Edit View-dialog, which is accessed by selecting “Views/Edit views...” in the menu bar.
7.7. Exporting data¶
Data can be exported to a text file, to a Matlab “.mat” file, or as an image. The export options are available from the “File”-menu.
7.7.1. Exporting to Image¶
The currently selected plot can be saved as an image file by either selecting “Tools/Save Screenshot”, or saved to the clipboard by selecting “Tools/Copy Graph”. To modify the labels and the style of the image, select “Export/Export as Image...” or click the Export button in the toolbar. This will open the Export Figure dialog, which makes it possible to modify the figure axes and labels to render publication-quality figures (see Fig. ExportImage). The resulting image can be copied to the clipboard or saved in JPEG, PNG, SVG or Adobe PDF format.
7.7.2. Exporting to Text¶
When exporting the text, a dialog will open allowing the user to define what to export. The following options are available:
- Data to export:
- Determines whether to export all or only the traces currently selected in the Log Viewer.
- Include header with log information:
- If checked, a header with log info will be included at the top of the text file.
- Include separate x-data with each trace:
- If checked, each data entry will contain two rows of data, one for and one for . If unchecked, the first row is -data, and all the following rows are -data.
- Include data for third dimension:
- If checked, data for a third dimension is added to the end of the text file. The channel for which the third dimension data is taken is defined in the control below the check box.
7.7.3. Exporting to Matlab¶
The Matlab export will export the selected traces to a single “.mat” file. The data is saved into a Matlab struct; the data structure is shown when opening the file in the Matlab workspace browser.
7.7.4. Custom Export¶
The Custom Export-function allows the user to export data into a custom format. Note that the custom export function always exports the raw data, without applying any operations such as smoothing, FFT, etc. The following options are available when exporting custom data:
- Data to export:
- Determines whether to export all or only the traces currently selected in the Log Viewer.
- Custom script:
- Path to python file containing the custom
The custom export functionality needs to be implemented in a python
exportData, which should be located in a separate
python file (.py). An example of a custom export script can be found
in the file ExportScript.py in the Script folder of the main program
directory (see Section Folders for an overview of folder
locations). The function definition of the
have the following format:
def exportData(file_name, step_data, log_data, step_name, log_name, step_unit, log_unit, comment='')
- Output path for the exported data.
- Data for stepped channels. The data is defined in a nested python
list of 1-d numpy arrays (one for each trace). The first index is
the step channel number as defined in the Measurement dialog step
list, the second index is the trace number. For example, to access
the data for the innermost step channel and the third trace, use
- Data for log channels, defined in the same way as the
- List of strings defining the step channel names.
- List of strings defining the log channel names.
- List of strings defining the step channel units.
- List of strings defining the log channel units.
- Log comment.