| 1 |
.. _sig-menu-file: |
| 2 |
|
| 3 |
Open and save Signals |
| 4 |
===================== |
| 5 |
|
| 6 |
This section describes how to open and save signals (and workspaces). |
| 7 |
|
| 8 |
.. note:: |
| 9 |
|
| 10 |
For creating new signals from mathematical models, see :ref:`sig-menu-create`. |
| 11 |
|
| 12 |
.. figure:: /images/shots/s_file.png |
| 13 |
|
| 14 |
Screenshot of the "File" menu. |
| 15 |
|
| 16 |
When the "Signal Panel" is selected, the menus and toolbars are updated to |
| 17 |
provide signal-related actions. |
| 18 |
|
| 19 |
The "File" menu allows you to: |
| 20 |
|
| 21 |
- Open, save and close signals (see below). |
| 22 |
|
| 23 |
- Save and restore the current workspace or browse HDF5 files (see :ref:`overview`). |
| 24 |
|
| 25 |
- Edit DataLab preferences (see :ref:`settings`). |
| 26 |
|
| 27 |
.. _open_signal: |
| 28 |
|
| 29 |
Open signal |
| 30 |
^^^^^^^^^^^ |
| 31 |
|
| 32 |
Create a new signal from the following supported filetypes: |
| 33 |
|
| 34 |
.. list-table:: |
| 35 |
:header-rows: 1 |
| 36 |
|
| 37 |
* - File type |
| 38 |
- Extensions |
| 39 |
* - Text files |
| 40 |
- .txt, .csv |
| 41 |
* - NumPy arrays |
| 42 |
- .npy |
| 43 |
* - MAT-Files |
| 44 |
- .mat |
| 45 |
* - FT-Lab files |
| 46 |
- .sig |
| 47 |
|
| 48 |
Open from directory |
| 49 |
^^^^^^^^^^^^^^^^^^^ |
| 50 |
|
| 51 |
Open multiple signals from a specified directory. |
| 52 |
|
| 53 |
Save signal |
| 54 |
^^^^^^^^^^^ |
| 55 |
|
| 56 |
Save current signal to the following supported filetypes: |
| 57 |
|
| 58 |
.. list-table:: |
| 59 |
:header-rows: 1 |
| 60 |
|
| 61 |
* - File type |
| 62 |
- Extensions |
| 63 |
* - Text files |
| 64 |
- .csv |
| 65 |
|
| 66 |
Save signals to directory |
| 67 |
^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 68 |
|
| 69 |
Save all selected signals to a specified directory, with configurable filename pattern |
| 70 |
and signal format. |
| 71 |
|
| 72 |
.. figure:: /images/shots/s_save_to_directory.png |
| 73 |
|
| 74 |
Save signals to directory dialog. |
| 75 |
|
| 76 |
When you select "Save to directory..." from the File menu, a dialog appears where you can: |
| 77 |
|
| 78 |
- **Directory**: Choose the target directory where signals will be saved |
| 79 |
- **Filename pattern**: Define a pattern for the filenames using Python format strings |
| 80 |
- **File extension**: Select the output format (.csv, .txt, etc.) |
| 81 |
- **Overwrite**: Choose whether to overwrite existing files |
| 82 |
- **Preview**: See the list of files that will be created (with object IDs) |
| 83 |
|
| 84 |
The filename pattern supports the following placeholders: |
| 85 |
|
| 86 |
- ``{title}``: Signal title |
| 87 |
- ``{index}``: 1-based index of the signal in the selection (with zero-padding) |
| 88 |
- ``{count}``: Total number of selected signals |
| 89 |
- ``{xlabel}``, ``{xunit}``, ``{ylabel}``, ``{yunit}``: Axis labels and units |
| 90 |
- ``{metadata[key]}``: Access metadata values |
| 91 |
|
| 92 |
You can also use format modifiers, for example ``{index:03d}`` will format the index |
| 93 |
with 3 digits zero-padding (001, 002, 003, etc.). |
| 94 |
|
| 95 |
Import text file |
| 96 |
^^^^^^^^^^^^^^^^ |
| 97 |
|
| 98 |
DataLab can natively import signal files (e.g. CSV, NPY, etc.). However some specific |
| 99 |
text file formats may not be supported. In this case, you can use the `Import text file` |
| 100 |
feature, which allows you to import a text file and convert it to a signal. |
| 101 |
|
| 102 |
This feature is accessible from the `File` menu, under the `Import text file` option. |
| 103 |
|
| 104 |
It opens an import wizard that guides you through the process of importing the text |
| 105 |
file. |
| 106 |
|
| 107 |
Step 1: Select the source |
| 108 |
------------------------- |
| 109 |
|
| 110 |
The first step is to select the source of the text file. You can either select a file |
| 111 |
from your computer or the clipboard if you have copied the text from another |
| 112 |
application. |
| 113 |
|
| 114 |
.. figure:: ../../images/import_text_file/s_01.png |
| 115 |
:alt: Step 1: Select the source |
| 116 |
:align: center |
| 117 |
|
| 118 |
Step 1: Select the source |
| 119 |
|
| 120 |
Step 2: Preview and configure the import |
| 121 |
----------------------------------------- |
| 122 |
|
| 123 |
The second step consists of configuring the import and previewing the result. You can |
| 124 |
configure the following options: |
| 125 |
|
| 126 |
- **Delimiter**: The character used to separate the values in the text file. |
| 127 |
- **Comments**: The character used to indicate that the line is a comment and should be |
| 128 |
ignored. |
| 129 |
- **Rows to Skip**: The number of rows to skip at the beginning of the file. |
| 130 |
- **Maximum Number of Rows**: The maximum number of rows to import. If the file contains |
| 131 |
more rows, they will be ignored. |
| 132 |
- **Transpose**: If checked, the rows and columns will be transposed. |
| 133 |
- **Data type**: The destination data type of the imported data. |
| 134 |
- **First Column is X**: If checked, the first column will be used as the X axis. |
| 135 |
|
| 136 |
When you are done configuring the import, click the `Apply` button to see the result. |
| 137 |
|
| 138 |
.. figure:: ../../images/import_text_file/s_02.png |
| 139 |
:alt: Step 2: Configure the import |
| 140 |
:align: center |
| 141 |
|
| 142 |
Step 2: Configure the import |
| 143 |
|
| 144 |
.. figure:: ../../images/import_text_file/s_03.png |
| 145 |
:alt: Step 2: Preview the result |
| 146 |
:align: center |
| 147 |
|
| 148 |
Step 2: Preview the result |
| 149 |
|
| 150 |
Step 3: Show graphical representation |
| 151 |
------------------------------------- |
| 152 |
|
| 153 |
The third step shows a graphical representation of the imported data. You can use the |
| 154 |
`Finish` button to import the data into DataLab workspace. |
| 155 |
|
| 156 |
.. figure:: ../../images/import_text_file/s_04.png |
| 157 |
:alt: Step 3: Show graphical representation |
| 158 |
:align: center |
| 159 |
|
| 160 |
Step 3: Show graphical representation |