Warning, /graphics/kst-plot/docbook/kst/tutorial.docbook is written in an unsupported language. File is not indexed.
0001 <chapter id="tutorial"> 0002 0003 <title>The &kst; Tutorial</title> 0004 0005 0006 <sect1 id="Welcome"> 0007 <title>Welcome</title> 0008 <para> 0009 Welcome to &kst;! In a few minutes, you will be on your way to 0010 exploring the rich features of this plotting and data manipulation 0011 package. Here are just some of the tasks you can accomplish using 0012 &kst;: 0013 </para> 0014 0015 <itemizedlist> 0016 <listitem> 0017 <para> 0018 Quickly plot multiple graphs using only the command-line. 0019 </para> 0020 </listitem> 0021 <listitem> 0022 <para> 0023 Analyze data using an extensive set of tools including histograms, 0024 power spectra, and custom equations. 0025 </para> 0026 </listitem> 0027 <listitem> 0028 <para> 0029 Effortlessly zoom in and out of interesting areas of plots using 0030 either the mouse or keyboard 0031 </para> 0032 </listitem> 0033 <listitem> 0034 <para> 0035 Monitor live streaming data using &kst;'s real-time plotting capabilities. 0036 </para> 0037 </listitem> 0038 </itemizedlist> 0039 <para> 0040 This tutorial covers the basics of installing, running, and working 0041 with &kst;. You are invited to further investigate any features at 0042 any time. All features are documented in the rest of this 0043 Handbook.</para> 0044 0045 </sect1> 0046 0047 <sect1 id="commandline"> 0048 <title>Creating plots from the Command-line</title> 0049 <para> 0050 A common use of &kst; is to quickly produce plots of data from the 0051 command-line. This method of producing plots requires almost no 0052 knowledge of &kst;'s graphical user interface, yet produces immediate, 0053 useful results. 0054 </para> 0055 0056 <para> 0057 The following instructions assume you are working in a broadly bash-compatible shell, such as you would in linux or MacOS. 0058 </para> 0059 0060 <para> 0061 To obtain an overview of all available &kst; command-line options, type: 0062 <screen><userinput><command>kst2 --help</command></userinput></screen> 0063 </para> 0064 <para> 0065 A syntax description and list of commands similar to the following will be displayed: 0066 <screen> 0067 KST Command Line Usage 0068 ************************ 0069 *** Load a kst file: *** 0070 kst [OPTIONS] kstfile 0071 0072 [OPTIONS] will override the datasource parameters for all data sources in the kst file: 0073 -F <datasource> 0074 -f <startframe> 0075 -n <numframes> 0076 -s <frames per sample> 0077 -a (apply averaging filter: requires -s) 0078 0079 ************************ 0080 *** Read a data file *** 0081 kst datasource OPTIONS [datasource OPTIONS []] 0082 0083 OPTIONS are read and interpreted in order. Except for data object options, all are applied to all future data objects, unless later overridden. 0084 Output Options: 0085 --print <filename> Print to file and exit. 0086 --landscape Print in landscape mode. 0087 --portrait Print in portrait mode. 0088 --Letter Print to Letter sized paper. 0089 --A4 Print to A4 sized paper. 0090 --png <filename> Render to a png image, and exit. 0091 --pngHeight <height> Height of png image (pixels) 0092 --pngWidth <width> Width of png image (pixels) 0093 File Options: 0094 -f <startframe> default: 'end' counts from end. 0095 -n <numframes> default: 'end' reads to end of file 0096 -s <frames per sample> default: 0 (read every sample) 0097 -a apply averaging filter: requires -s 0098 0099 Ascii File Options - for ascii files only: these are all sticky 0100 --asciiDataStart <Line> Data starts here. Files start at line 1. 0101 --asciiFieldNames <Line> Field names are in this row. 0102 --asciiNoFieldNames Fields are named for their data column 0103 --asciiReadUnits <Line> Read units from line <Line> 0104 --asciiNoUnits Do not read units 0105 --asciiSpaceDelim Columns are Space/tab delimited 0106 --asciiDelim <char> Columns are delimited with <char> 0107 --asciiFixedWidth <w> Columns have width <w> 0108 --asciiNoFixedWidth Columns are delimited, not fixed width 0109 --asciiDecimalDot Use a . as a decimal separator (ie, 10.1) 0110 --asciiDecimalComma Use a , as a decimal separator (ie, 10,1) 0111 Position: 0112 -P <plot name>: Place curves in one plot. 0113 -A Place future curves in individual plots. 0114 -m <columns> Layout plots in columns 0115 -T <tab name> Place future curves a new tab. 0116 Appearance 0117 -d: use points for the next curve 0118 -l: use lines for the next curve 0119 -b: use bargraph for the next curve 0120 --xlabel <X Label> Set X label of all future plots. 0121 --ylabel <Y Label> Set Y label of all future plots. 0122 --xlabelauto AutoSet X label of all future plots. 0123 --ylabelauto AutoSet Y label of all future plots. 0124 Data Object Modifiers 0125 -x <field>: Create vector and use as X vector for curves. 0126 -e <field>: Create vector and use as Y-error vector for next -y. 0127 -r <rate>: sample rate (spectra and spectograms). 0128 Data Objects: 0129 -y <field> plot an XY curve of field. 0130 -p <field> plot the spectrum of field. 0131 -h <field> plot a histogram of field. 0132 -z <field> plot an image of matrix field. 0133 0134 **************** 0135 *** Examples *** 0136 0137 Data sources and fields: 0138 Plot all data in column 2 from data.dat. 0139 kst data.dat -y 2 0140 0141 Same as above, except only read 20 lines, starting at line 10. 0142 kst data.dat -f 10 -n 20 -y 2 0143 0144 ... also read col 1. One plot per curve. 0145 kst data.dat -f 10 -n 20 -y 1 -y 2 0146 0147 Read col 1 from data2.dat and col 1 from data.dat 0148 kst data.dat -f 10 -n 20 -y 2 data2.dat -y 1 0149 0150 Same as above, except read 40 lines starting at 30 in data2.dat 0151 kst data.dat -f 10 -n 20 -y 2 data2.dat -f 30 -n 40 -y 1 0152 0153 Specify the X vector and error bars: 0154 Plot x = col 1 and Y = col 2 and error flags = col 3 from data.dat 0155 kst data.dat -x 1 -e 3 -y 2 0156 0157 Get the X vector from data1.dat, and the Y vector from data2.dat. 0158 kst data1.dat -x 1 data2.dat -y 1 0159 0160 Placement: 0161 Plot column 2 and column 3 in plot P1 and column 4 in plot P2 0162 kst data.dat -P P1 -y 2 -y 3 -P P2 -y 4 0163 0164 0165 </screen> 0166 </para> 0167 0168 <para> 0169 0170 This tutorial uses a demo ascii data file which is available at <ulink 0171 url="gyrodata.dat.gz">gyrodata.dat.gz</ulink>. 0172 Download the file with your browser, and gunzip it. 0173 0174 <screen><userinput><command>gunzip gyrodata.dat.gz</command></userinput></screen> 0175 </para> 0176 0177 <para> 0178 We will first take a look at reading the ASCII file 0179 <filename>gyrodata.dat</filename> that we just downloaded. 0180 ASCII files are one of the many file types &kst; is capable of 0181 reading. In ASCII files, data is arranged in columns, with each 0182 column corresponding to a field, and the column numbers (beginning 0183 with 1 from left to right) corresponding to field names. This 0184 particular ASCII file contains 3 columns, and thus has field names 1, 0185 2, and 3. To produce a plot of the first column, simply type: 0186 0187 <screen><userinput><command>kst2 gyrodata.dat -y 1</command></userinput></screen> 0188 0189 </para> 0190 <para> 0191 All the data in the first column will be plotted: 0192 </para> 0193 <screenshot> 0194 <mediaobject> 0195 <imageobject> 0196 <imagedata fileref="Screenshot-kst-tutorial-gyro1.png" format="PNG"/> 0197 </imageobject> 0198 </mediaobject> 0199 </screenshot> 0200 <para> 0201 Note that no field was specified for the X axis of the plot, so &kst; 0202 used the default INDEX vector. The INDEX vector is a 0203 special vector in &kst; that contains integers from 0 to N-1, where N 0204 is the number of frames read in the corresponding Y axis vector. 0205 Close &kst; by selecting <guimenuitem>Quit</guimenuitem> from the 0206 <guimenu>File</guimenu> menu, or by typing <keycombo 0207 action="simul">&Ctrl;<keycap>Q</keycap></keycombo>. 0208 </para> 0209 0210 <para> 0211 <filename>gyrodata.dat</filename> contains 20000 frames, so you may 0212 wish to only look at a portion of the data. To only plot 10000 frames 0213 starting from frame 7000, type: 0214 0215 <screen><userinput><command>kst2 gyrodata.dat -f 7000 -n 10000 -y 1</command></userinput></screen> 0216 0217 </para> 0218 0219 <para> 0220 One of &kst;'s strengths is its ability to plot real-time data. 0221 Imagine that new data was being continually added to the end of 0222 <filename>gyrodata.dat</filename>. In such a scenario, it would be 0223 useful to only plot the most recent portion of the data. To plot only 0224 the last 1000 frames of <filename>gyrodata.dat</filename>, enter the 0225 following: 0226 0227 <screen><userinput><command>kst2 gyrodata.dat -n 1000 -y 1</command></userinput></screen> 0228 </para> 0229 <para> 0230 If <filename>gyrodata.dat</filename> was being updated, the plot would 0231 continuously scroll to display only the last 1000 frames. 0232 </para> 0233 0234 <para> 0235 Note that the description of the <option>y</option> option states that 0236 Multiple instances of the <option>y</option> option are allowed. This allows quick 0237 plotting of more than one curve. To plot 0238 all three fields in <filename>gyrodata.dat</filename> in separate 0239 plots, arranged in one column, enter the following: 0240 0241 <screen><userinput><command>kst2 gyrodata.dat -m 1 -y 1 -y 2 -y 3 </command></userinput></screen> 0242 0243 </para> 0244 <para> 0245 The <option>m</option> option specifies that the plots should be in a single column. 0246 </para> 0247 0248 <screenshot> 0249 <mediaobject> 0250 <imageobject> 0251 <imagedata fileref="Screenshot-kst-tutorial-gyro-multiple.png" format="PNG"/> 0252 </imageobject> 0253 </mediaobject> 0254 </screenshot> 0255 0256 <para> 0257 To plot column 1 in one plot, and columns 2 and three in a second plot, displayed side by side enter: 0258 0259 <screen><userinput><command>kst2 gyrodata.dat -m 2 -P 1 -y 1 -P 2 -y 2 -y 3 </command></userinput></screen> 0260 0261 </para> 0262 0263 <screenshot> 0264 <mediaobject> 0265 <imageobject> 0266 <imagedata fileref="Screenshot-kst-tutorial-gyro-multiple2.png" format="PNG"/> 0267 </imageobject> 0268 </mediaobject> 0269 </screenshot> 0270 0271 </sect1> 0272 0273 <sect1 id="datawizard-tour"> 0274 <title>Creating plots with the Data Wizard</title> 0275 <para> 0276 &kst; can also be completely controlled through the graphical user interface, 0277 without ever using the command line. In this section, we will look at 0278 the Data Wizard, which a quick and easy way of creating vectors, 0279 curves, and plots in &kst; from data files. To launch the wizard, 0280 select <guimenuitem>Data Wizard...</guimenuitem> from the 0281 <guimenu>Data</guimenu> menu or click the 0282 0283 <inlinemediaobject> 0284 <imageobject> 0285 <imagedata fileref="Icon-kst-datawizard.png" format="PNG"/> 0286 </imageobject> 0287 </inlinemediaobject> 0288 0289 button on the toolbar. You will be prompted to select a data source by the 0290 following dialog: 0291 0292 <screenshot> 0293 <screeninfo>Data Wizard Screen 1</screeninfo> 0294 <mediaobject> 0295 <imageobject> 0296 <imagedata fileref="Screenshot-kst-datawizard1.png" format="PNG" /> 0297 </imageobject> 0298 <textobject> 0299 <phrase>Data Wizard Screen 2</phrase> 0300 </textobject> 0301 </mediaobject> 0302 </screenshot> 0303 0304 Select the <filename>gyrodata.dat</filename> file used in the 0305 command-line examples. If you have completed the command-line exercises 0306 in the previous sections, then the file should be listed in the recent 0307 files list, as shown. Simply click on it to select it. Otherwise, 0308 enter the full path in the top text entry box (or click on the 0309 0310 <inlinemediaobject> 0311 <imageobject> 0312 <imagedata fileref="Icon-kst-fileselect.png" format="PNG"/> 0313 </imageobject> 0314 </inlinemediaobject> 0315 0316 icon and browse to the file). Once you have selected the file, the <guibutton>Next</guibutton> 0317 button will be enabled. Click on it to proceed to the next page. 0318 0319 The following window will be displayed: 0320 </para> 0321 0322 <screenshot> 0323 <screeninfo>Data Wizard Screen 2</screeninfo> 0324 <mediaobject> 0325 <imageobject> 0326 <imagedata fileref="Screenshot-kst-datawizard2.png" format="PNG" /> 0327 </imageobject> 0328 <textobject> 0329 <phrase>Data Wizard Screen 2</phrase> 0330 </textobject> 0331 </mediaobject> 0332 </screenshot> 0333 0334 <para> 0335 Fields in <filename>gyrodata.dat</filename> available to be plotted are 0336 listed in the <guilabel>Available data</guilabel> box on the left. Fields 0337 that have been selected for plotting are listed in the <guilabel>Selected data</guilabel> 0338 box on the right. In the image shown, <guilabel>Column 1</guilabel> has been 0339 selected for plotting. 0340 </para> 0341 0342 <para> 0343 Select <guilabel>Column 1</guilabel>, <guilabel>Column 2</guilabel>, and 0344 <guilabel>Column 3</guilabel> for plotting by moving them to the 0345 <guilabel>Selected data</guilabel> box. 0346 </para> 0347 0348 <para> 0349 To move a field from <guilabel>Available data</guilabel> to 0350 <guilabel>Selected data</guilabel>, double click on it, or 0351 highlight it (with mouse or keyboard) and click on the 0352 0353 <inlinemediaobject> 0354 <imageobject> 0355 <imagedata fileref="Icon-kst-right-arrow.png" format="PNG"/> 0356 </imageobject> 0357 </inlinemediaobject> 0358 0359 icon. As well as using the mouse or keyboard, you may highlight fields by 0360 entering a string to match into the text box above the list. Wildcards such as <literal>*</literal>, 0361 <literal>?</literal> and <literal>[ ]</literal> are 0362 supported. 0363 </para> 0364 0365 <para> 0366 Click <guibutton>Next</guibutton> once you have selected the three columns of data. 0367 </para> 0368 0369 0370 <screenshot> 0371 <screeninfo>Data Wizard Screen 3</screeninfo> 0372 <mediaobject> 0373 <imageobject> 0374 <imagedata fileref="Screenshot-kst-datawizard3.png" format="PNG" /> 0375 </imageobject> 0376 <textobject> 0377 <phrase>Data Wizard Screen 2</phrase> 0378 </textobject> 0379 </mediaobject> 0380 </screenshot> 0381 0382 <para> 0383 The next tab is used to select the data range to be plotted, and whether to 0384 create XY plots, spectrum plots, or both. 0385 </para> 0386 0387 0388 <para> 0389 The <guilabel>Data Range</guilabel> section is used to specify the 0390 range of data to read from the selected vectors in the input file. The 0391 following discussion assumes knowledge of <quote>frames</quote>. For ASCII 0392 files such as <filename>gyrodata.dat</filename>, a frame is simply a row of 0393 data, though for other formats this can be more complicated. 0394 </para> 0395 0396 <variablelist> 0397 <varlistentry> 0398 <term> 0399 <guilabel>Start</guilabel>, <guilabel>End</guilabel>, <guilabel>Count from end</guilabel>, 0400 <guilabel>Range</guilabel>, and <guilabel>Read to end</guilabel> 0401 </term> 0402 <listitem> 0403 <para> 0404 Using these five settings, the lower and upper boundaries of the data 0405 range can be set. The settings in the above image are set to read the 0406 entire data file (starting at frame 0, and reading to the end). 0407 </para> 0408 0409 <para> 0410 If new data were being appended to the end of the file in real time, then the range 0411 would be continuously increasing and &kst; would update to reflect this. If instead 0412 one wanted to only display the last 1000 frames of the file, one would instead select 0413 <guilabel>Count from end</guilabel> and enter 1000 in <guilabel>Range</guilabel>. 0414 &kst; would scroll the data along as new data were appended to the data file. 0415 </para> 0416 0417 </listitem> 0418 </varlistentry> 0419 0420 <varlistentry> 0421 <term> 0422 <guilabel>Read 1 sample per N frames</guilabel> and <guilabel>Boxcar 0423 filter first</guilabel> 0424 </term> 0425 <listitem> 0426 <para> 0427 The number of data points plotted can be reduced using this option. 0428 If <guilabel>Read 1 sample 0429 per N frames</guilabel> is not selected, all samples in the selected 0430 range will be read. Alternatively, frames in the data file can be 0431 skipped by selecting <guilabel>Read 1 sample per N frames</guilabel>. 0432 For now, read all of the data by deselecting <guilabel>Read 1 sample 0433 per N frames</guilabel>, as shown. 0434 </para> 0435 </listitem> 0436 </varlistentry> 0437 </variablelist> 0438 0439 0440 0441 <para> 0442 In this tutorial, we are only going to plot the gyroscope time series, and not spectra. 0443 To do this, select <guilabel>Create XY plots</guilabel> and deselect 0444 <guilabel>Create Spectra Plots</guilabel> as shown. 0445 </para> 0446 0447 <para> 0448 Set the X axis vectors for the curves to be The vector to be <guilabel>INDEX</guilabel> 0449 by selecting <guilabel>Create from field</guilabel> and selecting INDEX in 0450 vector selector, as shown. 0451 </para> 0452 0453 <para> 0454 The <guilabel>FFT Options</guilabel> subsection in the <guilabel>Plot 0455 Types</guilabel> section is available only if a power spectrum is to 0456 be plotted. This tutorial will not deal with the details of power 0457 spectra. 0458 </para> 0459 0460 <para> 0461 Once you are satisfied with all the settings, click 0462 <guibutton>Next</guibutton> to advance to the next window. 0463 </para> 0464 0465 <screenshot> 0466 <screeninfo>Data Wizard Screen 4</screeninfo> 0467 <mediaobject> 0468 <imageobject> 0469 <imagedata fileref="Screenshot-kst-datawizard4.png" format="PNG" /> 0470 </imageobject> 0471 <textobject> 0472 <phrase>Data Wizard Screen 3</phrase> 0473 </textobject> 0474 </mediaobject> 0475 </screenshot> 0476 0477 <para> 0478 From here, you can change general plotting settings. Most of the 0479 settings are self-explanatory. Select <guilabel>1 new plot per 0480 curve</guilabel> for <guilabel>Curve Placement</guilabel>. 0481 </para> 0482 0483 0484 <para> 0485 Once you are satisfied with all the settings, click <guibutton>Finish</guibutton> and the plots will be generated: 0486 </para> 0487 <screenshot> 0488 <screeninfo>The Generated Plots</screeninfo> 0489 <mediaobject> 0490 <imageobject> 0491 <imagedata fileref="Screenshot-kst-tutorial-datawizard-done.png" format="PNG" /> 0492 </imageobject> 0493 <textobject> 0494 <phrase>The Generated Plots</phrase> 0495 </textobject> 0496 </mediaobject> 0497 </screenshot> 0498 0499 <para> 0500 Generating these plots took a bit of effort, so we should save the 0501 current &kst; session (it will be used in the next section of this 0502 tutorial). Select <guimenuitem>Save As...</guimenuitem> from the 0503 <guimenu>File</guimenu> menu, and save the session as 0504 <filename>mykstsession.kst</filename>: 0505 </para> 0506 0507 <para> 0508 Saving a &kst; session saves all the plots, data objects (you will learn about these later), and layouts that exist 0509 at the time of saving. 0510 </para> 0511 <para> 0512 Once the file has been saved, you can exit &kst;. 0513 </para> 0514 </sect1> 0515 0516 <sect1 id="mousezooming"> 0517 <title>The Basics of Plot Manipulation</title> 0518 <para> 0519 Now that you are comfortable with creating plots in &kst;, we can explore some of the plot manipulation features 0520 available through the &kst; graphical user interface. 0521 Start &kst; and load the <filename>mykstsession.kst</filename> file you saved earlier. 0522 This can be done one of three ways: 0523 </para> 0524 <itemizedlist> 0525 <listitem> 0526 <para> 0527 From the command line: <userinput><command>kst mykstsession.kst</command></userinput> 0528 </para> 0529 </listitem> 0530 <listitem> 0531 <para> 0532 Selecting <guimenuitem>Open</guimenuitem> from the toolbar or from the 0533 <guimenuitem>File</guimenuitem> menu and selecting <filename>mykstsession.kst</filename> 0534 from wherever you saved it. 0535 </para> 0536 </listitem> 0537 <listitem> 0538 <para> 0539 Selecting <filename>mykstsession.kst</filename> from 0540 <guimenuitem>Recent Files</guimenuitem> in the <guimenuitem>File</guimenuitem> menu. 0541 </para> 0542 </listitem> 0543 </itemizedlist> 0544 0545 <para> 0546 All the plots you created earlier should now be loaded in &kst;. 0547 Consider the plot of Column 1. 0548 To take a closer look at that plot, right 0549 click in it and select the <guimenuitem>Maximize</guimenuitem> menu 0550 item (see below). Notice that the menu item shows that <guimenuitem>Z</guimenuitem> 0551 is a shortcut for this, so you could also just type <keycap>Z</keycap> in the plot rather than 0552 using the context menu for this. Selecting <guimenuitem>Maximize</guimenuitem> (either with <keycap>Z</keycap> or with the menu) will cause the selected plot to fill the entire kst window. 0553 </para> 0554 <screenshot> 0555 <screeninfo>Maximizing a plot</screeninfo> 0556 <mediaobject> 0557 <imageobject> 0558 <imagedata fileref="Screenshot-kst-zoom.png" format="PNG" /> 0559 </imageobject> 0560 <textobject> 0561 <phrase>Maximizing a plot</phrase> 0562 </textobject> 0563 </mediaobject> 0564 </screenshot> 0565 0566 <screenshot> 0567 <screeninfo>A plot after Maximizing</screeninfo> 0568 <mediaobject> 0569 <imageobject> 0570 <imagedata fileref="Screenshot-kst-zoomed.png" format="PNG" /> 0571 </imageobject> 0572 <textobject> 0573 <phrase>Maximizing a plot</phrase> 0574 </textobject> 0575 </mediaobject> 0576 </screenshot> 0577 <para> 0578 Selecting <guimenuitem>Maximize</guimenuitem> (or typing <keycap>Z</keycap> in the plot) again will restore it the plots to their previous 0579 arrangement. This is especially valuable if you have a grid of many small plots 0580 and want to temporarily look at just one of them. Obviously typing <keycap>Z</keycap> is going to be the most convenient way 0581 to do this, but the context menu is there in case you forget. 0582 </para> 0583 0584 <para> 0585 In &kst;, it is very easy to zoom and scroll the data, using either the 0586 mouse or the keyboard. To do this you should be in <guimenuitem>XY Zoom/Scroll</guimenuitem> 0587 mode, selected by selecting the 0588 0589 <inlinemediaobject> 0590 <imageobject> 0591 <imagedata fileref="Icon-kst-xymousezoom.png" format="PNG"/> 0592 </imageobject> 0593 </inlinemediaobject> 0594 0595 icon in the tool bar. This is the default mode. 0596 </para> 0597 <para> 0598 To zoom into a region of interest, left-click drag a box in the window with the mouse. 0599 When you release the mouse, the window will zoom in X and Y into the region you selected. 0600 Holding &Shift; when you do this will cause the plot to zoom only in Y. 0601 Holding &Ctrl; when you do this will cause the plot to zoom only in X. 0602 </para> 0603 <para> 0604 Arrow keys scroll the plot. Arrow keys with &Shift; held down will change the scale. 0605 The <keycap>M</keycap> key auto-zooms the plots to view all of the data. Play around with these 0606 options to become familiar with the various options. 0607 </para> 0608 0609 <para> 0610 Now look at the plots with y axes labeled <literal>Column 2</literal> 0611 and <literal>Column 3</literal>. These are plots of the pitch gyro 0612 and roll gyro, respectively, from an instrument. Since 0613 these two plots are related, it can be useful to zoom and scroll them 0614 simultaneously. Click on the circles located at the top right corners 0615 of the two plots. They should turn dark in color to indicate that 0616 the two plots are now tied together: 0617 </para> 0618 0619 <screenshot> 0620 <screeninfo>Tied Zoom</screeninfo> 0621 <mediaobject> 0622 <imageobject> 0623 <imagedata fileref="Screenshot-kst-tiedzoom.png" format="PNG" /> 0624 </imageobject> 0625 <textobject> 0626 <phrase>Tied Zoom</phrase> 0627 </textobject> 0628 </mediaobject> 0629 </screenshot> 0630 0631 <para> 0632 Now try zooming in with the mouse on a portion of the green curve in 0633 the middle plot. You will find 0634 that the lower plot will become blank. This is because the lower plot 0635 axes have changed to match the upper plot axes, and there is no data 0636 in that particular region of the lower plot. Type <keycap>M</keycap> 0637 while the mouse cursor is over either plot to return to maximum zoom 0638 on both plots. Now hold down &Ctrl; (this is 0639 equivalent to selecting <guimenu>X Mouse Zoom Mode</guimenu> from the 0640 <guimenu>Mode</guimenu> menu or clicking the 0641 <inlinemediaobject><imageobject><imagedata 0642 fileref="Icon-kst-xmousezoom.png" 0643 format="PNG"/></imageobject></inlinemediaobject> toolbar button). If you 0644 then move the mouse, you will see that it is now dragging a vertical line 0645 the height of the plots in both of the plots that are tied together. 0646 While keeping 0647 &Ctrl; held down, drag a rectangle in the middle plot. 0648 While dragging, the region you are selecting will be displayed in both 0649 tied plots. Both plots will rescale to the region you have selected. 0650 </para> 0651 0652 <screenshot> 0653 <screeninfo>Tied Zoom</screeninfo> 0654 <mediaobject> 0655 <imageobject> 0656 <imagedata fileref="Screenshot-kst-tiedzooming.png" format="PNG" /> 0657 </imageobject> 0658 <textobject> 0659 <phrase>Tied Zoom</phrase> 0660 </textobject> 0661 </mediaobject> 0662 </screenshot> 0663 0664 0665 <para> 0666 As with the mouse actions, the keyboard based zoom/scrolling actions 0667 described earlier will now be applied to both plots. 0668 </para> 0669 <tip> 0670 <para> 0671 You can quickly tie or untie all the plots in the window by selecting 0672 <guimenuitem>Toggle Tied Zoom</guimenuitem> from the <guimenu>Mode</guimenu> 0673 menu or by clicking the <inlinemediaobject><imageobject><imagedata 0674 fileref="Icon-kst-tiedzoom.png" 0675 format="PNG"/></imageobject></inlinemediaobject> toolbar button. 0676 </para> 0677 </tip> 0678 <para> 0679 When you are finished experimenting with the zooming features, you can 0680 close &kst;. There is no need to save the plots this time (unless you 0681 wish to). 0682 </para> 0683 0684 </sect1> 0685 0686 0687 0688 <sect1 id="overviewdataobjects"> 0689 <title>A Brief Overview of Data Objects</title> 0690 <para> 0691 In addition to simple plotting, &kst; has the ability to do real time analysis of 0692 data using a number of <quote>Data Objects</quote>, which include spectra, equations, 0693 histograms, fits, and filters. 0694 </para> 0695 0696 <para> 0697 As a quick demo of Data Objects, lets create a spectrum. Start &kst; and re-load 0698 <filename>mykstsession.kst</filename> that you created in previous sections. 0699 Then, from the <guimenu>Create</guimenu> menu select 0700 <guimenuitem>Power Spectrum</guimenuitem>. The New Power Spectrum menu will appear. 0701 </para> 0702 0703 <screenshot> 0704 <screeninfo>New Spectrum Dialog</screeninfo> 0705 <mediaobject> 0706 <imageobject> 0707 <imagedata fileref="Screenshot-kst-new-spectrum.png" format="PNG" /> 0708 </imageobject> 0709 <textobject> 0710 <phrase>The New Spectrum Dialog</phrase> 0711 </textobject> 0712 </mediaobject> 0713 </screenshot> 0714 0715 <para>Fill out the dialog as shown. Make sure you select <quote>Column 3 (V4)</quote> 0716 as the Data vector, set the FFT length to <quote>2^13</quote>, Sample rate to 0717 <quote>60</quote> and select <quote>In new tab</quote> under Placement. Then select 0718 <guibutton>OK</guibutton>. A plot of the spectrum of <quote>Column 3 (V4)</quote> 0719 will appear in a new tab. 0720 </para> 0721 0722 <screenshot> 0723 <screeninfo>Spectrum</screeninfo> 0724 <mediaobject> 0725 <imageobject> 0726 <imagedata fileref="Screenshot-kst-spectrum_linear.png" format="PNG" /> 0727 </imageobject> 0728 <textobject> 0729 <phrase>Spectrum</phrase> 0730 </textobject> 0731 </mediaobject> 0732 </screenshot> 0733 0734 <para> 0735 It is hard to see any details in this plot - a log-log plot would be 0736 much easier. To toggle the Y axis to log press <keycap>l</keycap> (that is, small <keycap>L</keycap>) and 0737 to toggle the X axis to log press <keycap>g</keycap>. (These options 0738 are also available in the context menu under the 0739 <guimenuitem>Zoom</guimenuitem> submenu in case you forget the keyboard 0740 commands). The plot will now be log-log, as shown: 0741 </para> 0742 0743 <screenshot> 0744 <screeninfo>Spectrum</screeninfo> 0745 <mediaobject> 0746 <imageobject> 0747 <imagedata fileref="Screenshot-kst-spectrum_log.png" format="PNG" /> 0748 </imageobject> 0749 <textobject> 0750 <phrase>Spectrum</phrase> 0751 </textobject> 0752 </mediaobject> 0753 </screenshot> 0754 0755 <para> 0756 Hitting <keycap>l</keycap> (small <keycap>L</keycap>) and <keycap>g</keycap> will toggle back to linear axis. 0757 </para> 0758 0759 <para> 0760 From the <guimenu>Create</guimenu> you can similarly create histograms, spectrograms and equations 0761 of fields you have loaded. 0762 </para> 0763 </sect1> 0764 0765 <sect1 id="tutorial-filters"> 0766 <title>Filters</title> 0767 <para> 0768 With &kst;, we can apply a variety of fits and filters to vectors in kst. 0769 The results of these will be updated in real time as new data comes in. 0770 To demonstrate this, load in the first 1000 samples of second column of 0771 <filename>gyrodata.dat</filename> 0772 using either the Data Wizard, as demonstrated earlier, or from the command line: 0773 0774 <screen><userinput><command>kst2 gyrodata.dat -f 0 -n 1000 -y 2</command></userinput></screen> 0775 0776 </para> 0777 <para> 0778 Once it is loaded, right click in the plot and select <guimenuitem>Column 1 vs INDEX (C1)</guimenuitem> 0779 from the <guimenu>Filter</guimenu> menu, as shown: 0780 </para> 0781 0782 <screenshot> 0783 <screeninfo>Spectrum</screeninfo> 0784 <mediaobject> 0785 <imageobject> 0786 <imagedata fileref="Screenshot-kst-filter-menu.png" format="PNG" /> 0787 </imageobject> 0788 <textobject> 0789 <phrase>Spectrum</phrase> 0790 </textobject> 0791 </mediaobject> 0792 </screenshot> 0793 0794 0795 <para> 0796 This will bring up the New Filter Dialog: 0797 </para> 0798 0799 <screenshot> 0800 <screeninfo>Spectrum</screeninfo> 0801 <mediaobject> 0802 <imageobject> 0803 <imagedata fileref="Screenshot-kst-filter-dialog.png" format="PNG" /> 0804 </imageobject> 0805 <textobject> 0806 <phrase>Spectrum</phrase> 0807 </textobject> 0808 </mediaobject> 0809 </screenshot> 0810 0811 <para> 0812 Fill out the dialog as shown. In particular, 0813 select <guimenuitem>Low Pass Filter</guimenuitem> as the Plugin, set 0814 <guilabel>Cutoff Frequency/Sample Rate</guilabel> to 0.05, and select 0815 <guilabel>Place in existing plot</guilabel>. Here we have also set the 0816 line to be red, and the <guilabel>Weight</guilabel> to 2, so the line will 0817 be more visible. When you are satisfied, select <guibutton>OK</guibutton>. 0818 </para> 0819 <para> 0820 This will add the low-pass filtered data as a new curve in the plot: 0821 </para> 0822 0823 <screenshot> 0824 <screeninfo>Filtered Curve</screeninfo> 0825 <mediaobject> 0826 <imageobject> 0827 <imagedata fileref="Screenshot-kst-filtered-curve.png" format="PNG" /> 0828 </imageobject> 0829 <textobject> 0830 <phrase>Filtered Curve</phrase> 0831 </textobject> 0832 </mediaobject> 0833 </screenshot> 0834 0835 <para> 0836 In the same way you can fit a variety of functions to curves using the 0837 <guimenu>Fit</guimenu> submenu after right-clicking in a plot. 0838 </para> 0839 0840 </sect1> 0841 0842 </chapter> 0843 0844 <!-- Keep this comment at the end of the file 0845 Local variables: 0846 mode: xml 0847 sgml-omittag:nil 0848 sgml-shorttag:nil 0849 sgml-namecase-general:nil 0850 sgml-general-insert-case:lower 0851 sgml-minimize-attributes:nil 0852 sgml-always-quote-attributes:t 0853 sgml-indent-step:0 0854 sgml-indent-data:true 0855 sgml-parent-document:("index.docbook" "book" "chapter") 0856 sgml-exposed-tags:nil 0857 sgml-local-catalogs:nil 0858 sgml-local-ecat-files:nil 0859 End: 0860 --> 0861