ReadValues

From SweepMe! Wiki
Revision as of 14:34, 22 January 2020 by Afischer (talk | contribs)
Jump to navigation Jump to search

This module can be used to read-in values from a tabular organized file.

Supported file formats

  • Text files with ending .txt
  • Text files with ending .csv
  • Excel files with ending .xls or .xlsx

Loading and reading a file

Files can be loaded using the button 'Load list'.

Procedure

  • Empty lines are automatically skipped.
  • Lines starting with a comment character are skipped as well.
  • An empty cell is represented by an empty string (""). However, in case the missing character is an empty string, a float('nan') will be generated shown as 'nan' in the table.
  • If desired, the name of the variable and the unit of each column are readin from the first available lines (rows).
  • If desired, a certain number of lines can be skipped, e.g. to remove a header.

Sweep value

The Sweep value of ReadValues is the value of the first column. As the Sweep value of each Module is used to generate the file names of the measured data by MakeFile, the first column of the read-in file is essential for the names of the measurement data files.

Applications

  • Load complex parameter variations that are stored in an external file
  • Load values from a file to hand them over to various Modules as Sweep value
  • Load previously measured data in order to evaluate it by using SweepMe! in combination with the module CustomFunction
  • Load files to create a template that can be modified by the user later on
  • In combination with Condition and Calc you can create conditions for which a measurment is done.
  • in progress: Read multiple files in combination with the module LoadFiles to evaluate a bunch of files with similar structure and content.

User interface

Sweep mode

  • Each line of file: A single file can be loaded into the module and for each line of your file, the ReadValues module will perform a variation of the modules in the sequencer that are hierarchically below.

has variable

Must be checked if the first non-empty, non-comment line of your file specifies the names of the variables related to each column.

has unit

Only available if 'has variable' is checked. Must be checked if the line after variables indicates the corresponding units.

Delimiter

The character that separates values of each column. It is not needed for excel files.

Comment

Character at the beginning of a line that indicates that this line should be skipped during read-in

Missing data

String that indicates missing data, so that SweepMe! can replace each occurence with a float of 'not-a-number' (nan). Important if data with missing values shall be plotted.

Skip lines

Number of lines that shall be skipped before data is read-in. Empty lines will be automatically skipped.

Preview [lines]

Loading large files can lead to delays that are prevented by showing a preview of the data. Enter the number of lines that you need to make sure that the correct file is loaded and which allows a proper performance.

recognize as GUI elements

If checked, the content of your file will displayed as CheckBox or ComboBox if certain patterns are matched:

  • CheckBox: The entry is 'False' or 'True'
  • ComboBox: The entry is separaed by '|'

use '^' to copy cell above

If checked, each cell containing a '^' character will get the value of the cell above. Thus, adjacent cell in vertical direction can be related to each other.

editable

If checked, loaded values can be usd as template to modify them before a measurement is done. Please read the section 'Editing values' for further information.

Preview mode

Large files can lead to delays in the program response. For that reason, a preview of typical 100 lines is shown. If your file has more than shown in the preview they will still be used during the measurement. Adjust the option 'Preview [lines]' if you need to see all lines of your file.

Editing values

Editing of values is possible if

  1. SweepMode is 'Each line of file'
  2. The entire file is shown, i.e. no preview mode is used
  3. The option 'editable' is checked.

Changed values will replace the value of the loaded file during a measurement. However, changed values will not permanently saved to the setting or to the selected file. Thus, the loaded file can be used as a template that can be modified each time before a measurement is done.

Disable lines

In case you would like to disable lines to not use them during the measurement, we recommend to use the option 'recognize as GUI elements' and add a column of bool values such as 'False' or 'True' to your file. A CheckBox will be displayed for each bool value that can be checked or unchecked. In combination with the module Condition, measurement points can be skipped that have the property 'False'

Loading SweepMe! data

Data that was previously been measured with SweepMe! can easily be loaded again with ReadValues. The preset options are already adjusted for that purpose.