Extension included in QtGrace that are NOT part of Grace

QtGrace Version 0.2.4

(All extensions included by Andreas Winter <andreas.f.winter(at-nospam)web.de>.)

Contents:

1. General Changes:

QtGrace contains some minor changes in the behavior in comparison to the original Grace intended to make it easier to use.

2. Usage of the decimal separator:

In the past I had some problem with different operating systems where the decimal separator is not '.'. Therefore I changed the behavior of QtGrace in responce to decimal separators in general. Internally always '.' is used. Only for display purposes and for data input something else is possible. In the Extra-Preferences the decimal separator can be selected (at the moment only '.' and ',' can be used). The one you select will be used for every display of numbers (the display has been inconsisted before version 0.2.4) and for every input (keep that in mind: if you select ',' as decimal separator you have to enter all numbers with ',' as decimal separator and '.' will be ignored.). Numbers already stored in QtGrace will be redisplayed with the new decimal separator if you change the separator-preference.

For saving and reading of files '.' is used. In case of Drap-and-Drop or Paste the number of ',' is counted and if it is greater than the number of '.' in the file the user is asked wheter ',' should be used for this one import-operation. For Copy-operations the default setting of the operating system is used for the decimal separator. If the user does Data->Import->Ascii.. the '.' is used for import by default, but the user can select whether ',' is wanted (no counting of ',' or '.', just simple import as selected).

3. UTF-8-support:

The original Grace does not support UTF-8-encoding. All supported characters/glyphs are part of the T1-font-encoding which is more or less hardcoded into Grace. This is useful in conjunction with LaTeX but not very helpful if someone wants to use characters outside the T1-encoding.

In the latest version of QtGrace the support for UTF-8-encoding is included in the following way:

The Qt-library supports UTF-8 for all input-widgets (like line-edit). Therefore it is possible to enter any UTF-8 character in any input-dialog QtGrace offers (as long as text input is allowed - some inputs only accept numbers).

The computation and the display of graphs and especially text in QtGrace is still (mostly) taken unchanged from Grace. Therefore it can not handle UTF-8 characters that are not part of the first 128 characters of the ascii-table.

To display any UTF-8 character QtGrace uses the font-library of the operating system and the painting methods of Qt.

In the Extra-Preferences-dialog you will find a setting for the file encoding. For all inputs UTF-8 is used; for loading and saving text from and to files the selected encoding is used. Every time data is loaded from a file all text-entries are updated (therefore any unapplied text-changes/inputs are lost after data is loaded - sorry).

Detailed description:

QtGrace saves every text-string in two locations. One location is used for displaying the text using as much of the original Grace functions as possible (let us call it the 'Grace'-version of a text-string). The second location is used to store the original version of every text-string. The 'original' is the text the user entered (or which has been loaded from a file) and it is always stored in UTF-8 encoding.

When text is entered via direct input in a dialog it is stored in the 'original'-location. Then the text is converted into a version that can be interpreted by the display driver. If Qt-fonts are not to be used (i.e. the original Grace-fonts are used) the original text-string is converted into the iso-latin-1 encoding, if QtFonts are to be used the text-string is just copied from 'original' to 'Grace'.

If LaTeX-commands are to be used: During the conversion the 'original' text is analyzed and the LaTeX-commands are replaced with the appropriate Grace-commands. (Remember: the original version is always stored in the 'original' location including the LaTeX-commands as entered without change.)

When text is loaded from a file the text-string is stored in the 'Grace'-loaction. This version of the string is considered as the original. To copy it into the 'original' location it is interpreted in the preselected encoding and converted to UTF-8. The preselected encoding is stored in every project-file and is used after loading text from this file. (If you open an old file with no information about the encoding used the one you selected in the extra-preferences is used.)

For interpreting the text-string in the original location the encoding that is set in the Extra-Preferences-dialog is used. When data is to be saved in a file the original-string is copied to the 'Grace' location and converted into the encoding set in the Extra-Preferences-dialog. Then the text-string in the 'Grace' location is saved.

After loading or saving the text in all string-locations is reconverted (encoding-changes and LaTeX-conversions are applied - which may cancel all unapplied text-changes as mentioned above; and again remember: the reconversion is done after EVERY load or save operation).

Changes when QtFonts as activated:

In every font selector the label on the left side saying 'Font:' will change to a command button and pressing on it will display fonts that are available for use with the Qt-drivers (This should include most of the fonts available on your operating system. This is not restricted to the T1-fonts in the QtGrace-folder.). These fonts are only used for printing when Qt is used. This is the case for the display/screen, for using the native printer dialog and printing to 'jpg', 'png' and 'bmp' files. The T1-standard-fonts are used for printing on all other devices (like 'ps'). At the beginning the combo-box will only show the standard fonts supported by the original Grace. If you want to add other fonts: click on the command button saying 'Font:' and select a font from the font dialog of your operating system (usually the font size can be selected here as well, but this setting is ignored at the moment).

When using the 'QtFonts'-option the Font-Tool will be considerably slower (I hope to improve this in future releases).
Using the Symbol-font will not have the same effect as it has with the T1-fonts: In T1 the Symbol-font contains the greek letters (only). In the Qt-fonts every font contains the greek letters (but not at the same positions as the latin-letters). That means if you want to use the QtFonts and latin and greek letters at the same time you have to enter the unicode-numbers of the greek letters or copy and paste the letters from the Font tool or use LaTeX-commands (see below).

I can not guarantee that all special font commands like "\s", "\S" or similar will work all the time (due to differences between UTF-8 and Ascii). Using the LaTeX-shortcuts may also be unreliable while using QtFonts because the character positioning has been optimized for T1-fonts.

The Grace fonts and their ordering is used for the first Qt-Fonts. If new Qt-fonts are added to the list the Qt-Font-list will be longer then the Grace-Font-Liste. If a Qt-Font is used with a higher number then the amount of Grace-fonts this font can only be used with useQtFonts activated. If Grace-Fonts are to be used (use QtFonts off) there is no font with such a high number. Text in this font will be displayed in Times Roman. The QtFonts are stored in every project file. The original Grace-fonts are saved as well, but the font lists may be different.

Conversion of path-names to ascii-characters is done using the default system-encoding, because this is necessary for the internal file-operation-functions.

4. LaTeX-support:

The support for simple LaTeX-commands can be activated in the Preferences dialog in the Extra preferences.

The LaTeX-support is meant for the input of simple LaTeX-commands declared by '$$' at the beginning and the end of the command (without'). Only text-input-widgets that are ment for comments/labels do accept the LaTeX-commands and only if the option is activated in the Extra-Preferences. This should be helpful to write formulas for people who know how to use LaTeX. For Example: You can enter something like '$$E=(\frac{1}{2}\pm\nu)\cdot\hbar\omega$$' and this command will internally be translated in the Grace-typesetting language (there is no real LaTeX-typesetter included - just some sort of makro-translator). At the moment the translation is one-way only. The original input is stored and you can switch between the original and the translated version. Usually the original will be shown. If you want to edit the translated text click on the label on the left of the text-input-widget. The text will be shown in red then. If you edit something in the converted version and click on Apply or press Enter while Immediate Update is on the text containing the Grace-font-setting-commands will be stored as original and your LaTeX-input is lost.

I did not copy every command from a LaTeX-handbook - I only included commands I thought could be useful and that are simple enough to include. (Take a look into ListOfLatexCommands.cpp if you want to know which commands are recognized at the moment.) Complex commands (like special braces like \underbrace or \overbrace) are not recognized at the moment and the overall translation is not completely fail-save. Don't use it in critical situations and save often. (If you enter a command and it is not recognized correctly try experimenting with spaces before or after it.) Nevertheless I would be very interested in your experiences in using this new feature. I also would like to know which commands would be most useful to you if they were included. Font attributes are copied. Please notice: there is no font-command for making a font bold. Therefore characters that use the symbol font can not be displayed in bold. Sorry.

5. Binary data import:

To import data from a binary file go to: Data->Import->Binary...

This will open a dialog. Be aware, that you have to know exactly (!) how the structure of the file is that you want to open. You have to tell the import-filter the exact format once and afterwards you may chose to save this format-information to reuse it later. I have included the file-format-specification of wav-files: Click 'Load File Format' and select 'wav_format.fmt' in the bin-folder. To select the actual binary file click on 'Browse...' on the right hand side of 'Datafile:'. By default it is assumed that the binary file also contains a header that has some information about the data present (this is the case for wav-files).

The first part of telling the filter about the file format is to define the header-contents (byte for byte). This is done by adding a token to the list (click on '+') and tell the filter the format of the token (usually this is the kind of numerical representation of a number in a C-like format). The 'Bytes' box is only used for 'Offset' tokens that are ignored during data import later. It is possible (but not strictly necessary for every file type) to tell the filter how to use the header-information via the ComboBox 'InputAs'. In case you have done something wrong you are able to delete a token by clicking on '-'.

By clicking 'TestLoad' you can check whether your input has been correct (I always recommend clicking 'TestLoad' since it is needed for some files). The 'File-Info'-tab contains the data read from the header.

The second part is setting the Data-Format. It is assumed, that the data is present after the header in the file as a stream of bytes (no additional information in-between). It is also assumed, that the data-points are either present one after the other or one channel after the other. You have to set the format of every channel present in the file and whether or not this channel shall be imported.

The last step is to set the destination for the import: set-type and graph-number. It is also possible for data and header to be present in different files. You may select both of them in this case. For the header-information two versions are supported yet: header-information in binary format or in the format of ini-files (like system settings: '[Data] t0=5 dt=0.1' separated by new lines).

Experiment with binary import on wav-files. This may give you a good idea of how I meant it to work.

You may import more than one set at once. In order to do so set more than one import-channel to the same column (like one 'X' and three times 'Y').

Beginning with v0.2.2 it is possible to select several files for binary import at the same time. Doing so, the import filter will assume the files to have the same format and import the selected data from every file into a new set.

One channel in a file can be declared as a trigger channel. This channel is used as a reference for the x-axis. Currently only a rising edge is supported and the import dialog will ask for a trigger level if a trigger channel is selected. After import the x-position of the rising edge is detected and all imported sets are shifted to set the rising edge to x=0.

There is also a binary-export-dialog for saving sets. I included a file format specification for these files as well ("grace_binary_format.fmt"). Please remember to select "Read Data until EOF" in the Data-Format settings.

Any suggestions for improvements are welcome.

6. csv-import:

To import data from a file with comma-separated values go to: Data->Import->CSV...

This will open a dialog. In the Filename box you may enter the name of the file (the complete path!) you want to load data from. Although: The usual method would be for you to click on "Select CSV file" and use the operating systems file selection dialog. After selecting a file or clicking on "Re-guess columns" the first lines (ending with a new-line-character) of the files are loaded and shown in the File contents box. You may also notice a "-#-#-#-#-#-#-#-#-" somewhere in this box. This indicates the separation between a header (which is ignored) and the actual data columns below.

On the right hand side of the dialog you can select the target graph data will be imported into.

In the middle of the dialog you have to set the file format yourself (since there is no standard for csv, the files are different depending on how they have been generated).

At first you have to set how many lines at the beginning of the file are to be ignored (please note, that these header lines have to be separated by newline-characters or they may not be recognized as actual lines). The Data-set-separator specifies the ending of every data point. It is assumed, that every point consists of a number of values and in the file the end of one point and the beginning of a new point is announced by a special character like a newline-character. A newline has to be entered as '\n'; a tab-character as '\t'; except this all separators have to be single characters! Different (column-)values of one data point are separated by the Column-separator; Strings are indicated by a text-separator-character at the beginning an the end of the string (internally the string separator for Grace is always " therefore the use of the Text-separator or " inside the strings is very dangerous).

After entering all these format settings it is strictly advised to click on "Re-guess columns" since this will show whether the import filter works correctly. The guessed column-formats are shown in the contents-box below the first six data lines below '...'. It is possible to use ',' instead of '.' as decimal separator during import operation (usage of ',' as a column- or Data-set-separator is not advisable in this case). The guessing also sets the presumed number of data sets present in the file (=Number of data columns-1) and the formats in the column import selectors above the Apply/Accept/Close-buttons. The standard-import targets are set to: import first column as X-value for all new sets, import all following columns as Y-Values for new sets. If you set higher target columns (like Y1, Y2, ...) the set-type of the new sets will be adjusted automatically in order for the set to represent enough columns. If you need more sets than the guessed ones you can alter the "Number of sets to read". Strings can not be imported, they can only be recognized as columns between real values.

In short: suggested workflow:
Select a csv-file; Enter the separator-characters and the number of header-lines and press "Re-guess columns"; Set the import-format and import-targets for every column in the file; Press "Apply".

7. Digital filtes:

I noticed the lack of proper low-pass or high-pass filters for measurement data in Grace. Therefore I included a filter-dialog that uses fourier-transformations and filter function in frequency space. The user has to select source and target sets and what kind of filter is to be used and how to realize this. Then the cut-off-frequency/frequencies and the order of the filter have to be selected (hint: a Brickwall-filter is a filter with infinite order). There has to be a linear relation between the current X-axis of the selected sets and the time in s. The formula to convert the x-axis into time in s has to be specified (if a wrong faktor is given here the selected cut-off-frequncies are not correct). Since internally the filtering is done by multiplying a filter function with the frequency-values in frequency-space (FFT data, multiplication, inverse FFT) and the fast fourier algorithm is used the number of data points in the data sets have to be a power of 2. In order to arrange it to be so the method for extending the number of data points has to be selected (to increase the number of points to the next power of 2). If interpolation is selected oversampling may be selected. For nonperiodic data it may be helpful to select the "absolute value"-option in order to remove phase-shifts. In case debug is selected intermediate data in the procession of the data is preserved (like the filter function and the fourier-transformed data).

Simply experiment with this dialog and you may see how it works.

It is also possible to use the filters in scripts (=Commands-dialog): Either you do a filter and use the "Translate selection to commands"-button in the UnDo-List or you enter the following command in the Commands-dialog
#QTGRACE_SPECIAL FILTER_SET <nr_of_source_sets>,<nr_of_target_sets>{<first_source_graph>,<first_source_set>;<second_source_graph>,<second_source_set>;...}{<first_destination_graph>,<first_destination_set>;...}{<type>;<realization>;<order_first_cutoff>;<order_second_cutoff>;<absolute_values>;<debug>;<point_extension>;<oversampling>;<region_nr>;<negate_region>;<first_frequency(Hz)>;<second_frequency(Hz)>;<chebychev_ripples(dB)>;<x_transformation_formula>}
You have to enter all entries in this command, although depending on the settings not all entries are used. All entries (apart from the x-transformation-formula) are numbers. Please relate to the Filter-dialog for what number represent what: on check-boxes: 0=not checked, 1=checked; on combo-boxes: first entry=0, the further below in the combo-selection-list the higher the number (e.g. "Band-Stop"=3); for the restriction: no restriction=-1, inside graph=-2, Region0=0, Region1=1 and so on. Example:
#QTGRACE_SPECIAL FILTER_SET 1,1{0,0}{0,1}{0;1;2;2;1;0;0;0;-1;0;10000.0;100000.0;10.0;1}
This means a 10 kHz Low-Pass-filter on set G0.S0 and the result will be written in G0.S1. A second order butterworth-filter using only absolute-values is used and the x-values are already in time in s (i.e. x-transformation-formula="1" - see last entry). No oversampling is used and the points are to be interpolated to the next power of 2. No debug-output, no restriction (the "-1"-entry),no negated restriction. The second frequency is entered as 100 KHz with order 2 and the Chebychev-rippels are entered as 10.0 dB but these three values are unused.

Suggestions for improvements are welcome.

8. QtGrace specific preferences:

The settings that are present in the original Grace can be set in the Preferences-dialog. On the lower right hand side of this dialog there is a Extra-button. This opens a new dialog with additional settings only relevant for QtGrace.

This include for example the setting of the dialog language (please note, that only german is at the moment listed here, but the german translation is faaar from being complete). The Show/Hide workaround should not be necessary any more (only use it if you do not see any changes if you modify data). You can activate the support the LaTeX-commands for text input-lines (you may use most common LaTeX-commands for editing formulas). If immediate update is selected every change you make in a dialog is applied directely (without the need to press accept or apply). To use the full UTF-8-support for non-ascii-caracters you have to activate the Qt-Fonts here. The decimal separator may be selected; the size of the history-list can be set (the number files opened recently that are remembered in the ini-file). The default printing device is used as a standard setting for the print setup. You may also select "Last selection" which means, that the setting you used the last time will be set at the next restart of QtGrace.

9. Undo/Redo:

Starting with version v0.1.3 I have included a feature to Undo and later Redo some operations the user does with graphs and data sets. It is deactivated as a default because it is of an experimental nature at this point. It will be activated as a default in a later release when I am sure that no harm is done by this function. To activate it: Go to Edit->UndoList and set the "Undo active"-option. This option will be saved in the ini-preference-file and will be restored at every startup of QtGrace (keep this in mind: if you activate Undo/Redo, it will stay active until you deactivate it again!). I do not recommend activating this option for Graphs that include large datasets (>100.000 points) since it may consume a lot of memory because the undo saves up to 100 states of your work. Since you now have been warned, let us get to the nice stuff: What is possible with this feature?

When "Undo active" is activated, every supported operation is recorded as can be seen in the UndoList. In this list you will find a description of what you have done (the last one is the one on the bottom) and at the beginning of one line the letter 'U' or the letter 'R'. Actions marked as such are the actions that will be Undone or Redone when you use Edit->UnDo or Edit->ReDo respectively. You may also select one or more actions in the list and click on "Undo" below the list. Undo will undo the actions form the last one upwards. Redo will undo the actions from upper most selected action downwards. Every UnDo- or ReDo- operation is considered as some sort of toggle-operation. After an action has been undone a "(*)" will appear at the beginning of the description in the UndoList. This means, that you already have made this undone. Clicking on it and clicking Undo afterwards will effectively redo it. This is also the case, when you use Edit->UnDo. An action that has already been made undone will be redone, when it is reached by the Edit->Undo-operation. Doing a normal operation in QtGrace will set the 'U'-marker to the last operation in the list. This means that by clicking Edit->UnDo the last operation will be made undone and the 'U' will go to the operation before this one. The 'R' for Redo will then be set at the last operation. Clicking multiple times on Edit-UnDo will set the 'U'-marker one operation back(=upwards) until the end of the list is reached or a new normal operation is done in QtGrace. You can always do a manual undo via the list. Manual operations do not alter the 'U'-marker. Using Edit->ReDo will Undo the Undo-operations until the end of the list is reached. Give it a try and you will see what I mean. The shortcuts Ctrl+Z and Ctrl+Shift+Z are used for Undo and Redo. Please note: In Grace Ctrl+Z is normally used for Zoom-operations. I use Ctrl+Z for an undo and Alt+Z for zooming.

One further warning: Operations that change the ordering of the sets in a graph or the ordering of graphs (like swap-operations or pack-sets) are a bit dangerous if you do manual undo. At the moment the undo-function does not check whether the set-number has been changed since the operation you want to undo. Doing a chronological undo with Edit->Undo should be save, manual undo can sometime have unexpected results.

Simple description of what Undo/Redo does: Undo does set the state before the action has been performed, Undo again will set the state after the action has been performed. (Undo and Redo are only different with respect to the chronological order in which operations are made undone.) Undo/Redo does usually NOT really do the action again (there are some exceptions), only data is restored. Please use the manual undo-operation only for emergencies or if you really know what you want. Don't manually undo and redo several operations in arbitrary order to often, because unexpected results will be guaranteed. Chronological Undo via Edit->Undo or Edit->Redo is preferred.

Any suggestions are as always very welcome! Bug-reports as well.

10. Copy/Paste/Drag and Drop:

For an improved interaction with other software (especially spreadsheet-applications) I implemented copy and paste as well as drag and drop into QtGrace. In order to work it is necessary, that the user only uses data in the usual spreadsheet format (multimple columuns and rows without text-comments; only comments starting with '#' are allowed). It is for example possible to select a block of cells containing numerical data in a spreadsheet edits program and drag it over the QtGrace-window and drop it. It is also possible to copy the same data into the clipboard (Crtl+C) in your external application and click in the draw-area of QtGrace (a graph should be selected) and press Crtl+V. By doing so, the data will be imported as one or multiple new sets (depending on the shape of the data: empty lines are interpreted as a separation between sets and if more than two columns are present, the first column is interpreted as x-axis and the other columns are interpreted as the y-axes of several sets) in the current gaph. You may also select the "paste"-option in the context menu summoned by right-clicking in any set-list. Internally the data to be imported via drag-and-drop or paste is copied in a temporal file and then loaded via the usual ascii-import function. You may also drag and drop files directely from your file-browser into the QtGrace-window. If you select an ascii-file (or multiple files at the same time) the data is simply loaded via ascii-import. If the file is recognised as being binary (this is done on the basis as guesswork ;-) ) the binary import filter dialog is summoned and the user has to select the import-parameters (i.e. tell QtGrace the data structure of the binary file) to start the import.

A drag-and-drop operation from QtGrace to another application is not supported (no drag-out, only drag-into).

To get data from one or several sets from QtGrace to another program the user has to use the clipboard: select the data sets concerned and right-click in any set-list. This summons the context-menu and the user has to select the "copy"-option. The data is stored in the clipboard as ascii-data and can be paste in any other application that is able to use the clipboard (e.g. any spreadsheet editor). As decimal separator the default setting of the operating system is used.

11. Zooming:

Zooming multiple graphs:

On the upper left hand side of the QtGrace-window there is now a new graph-selector. This selector shows all graphs present and the currently active graph is selected. Any change in graph-selection/activation is represented here. You can also change the current graph by using this selector. The main purpose of this is to be able to select more than one graph for zoom-in and zoom-out. All zoom-operations that are shown in the toolbar use this selector for determining on what graph(s) they should be used. Please mind, that internally Grace supports only one active/selected graph. This one is usually with focus-markers. This new graph-selector will only work with the zoom-buttons in the toolbar and is meant for people who use superimposed graphs and want to zoom in and out simultaneously.

Zoom-Slider:

I added a zoom-slider in the toolbar on the lower left hand side of the QtGrace-window. You will find it just above the 'Exit'-Button. The slider-value is changed logarithmically and can be set between 0.1 and 10.0. (The internal values of the slider range between -100 and +100 and the actual zoom-factor is calculated by 10^(value*0.01). The current value of the slider is saved in the QtGrace-ini-file as "PageViewZoom". (If you have problems resetting the page zoom to 1, set this value in the ini-file manually back to 0.) The setting only effects the visual display on screen. Print-commands are unaffected by this. There is also no Undo for changing the slider setting because this in nondestructive. The setting is saved when QtGrace is closed and will be reset to the last value at the next startup. I intended this for people who have uncommon display-resolutions. QtGrace calculates the size of the visual page according to the resolution of the computer-screen used. This is ok for most users. It is very inconvenient for people using notebooks with small screens (like 12") because they will not be able to see the whole page. With this new zoom-slider you can reduce the page size for the display according to your needs. You are still able to produce hardcopies (in Print or in Files) with an exact resolution. To reset the slider to factor 1.00 you may use the shortcut 'Crtl+1'.
Please note: The Zoom-Slider is deactivated if QtGrace is started with the '-free' option, because it is useless in this case!
The 'Fit'-Button below the page-zoom-slider sets the zoom-slider in order to fit the page-size to the available space of the window. (Thank you jhenin for suggesting this and supplying the source-code which I modified a bit.)

12. Color(palette) management:

In the original Grace it was possible to use more than the 16 colors preset in Grace, but you had to enter them in the file header manually. I wanted to have a more convenient method.

In 'Window->Color Management...' you can change the current Color palette used for the project. In the upper part you can select a color from the current palette and edit it. You may enter the red/green/blue-color-components and the color name. Below you will see a preview of the edited color. You have three options for the single color: delete the color with the specified number from the palette, add the color as a new color to the palette or replace the color with the specified number with the new color (Edit color). The option 'Define color' lets you select a color from the color-selector-dialog of your operating system. If you want to add this new color to the current palette use add or edit (to replace an existing one).

You may also edit the whole palette in one go. You may set the palette for example to a specified spectrum of colors. You may use predefined spectra or set your own spectrum. By selecting 'Custom...' and setting a number of path-points you may define the spectrum by specified colors that have to be part of the spectrum. For each path point you have to specify a color via 'Current path point' and 'Color'. Below you will see a preview of the spectrum. Please note, that the first two colors in the spectrum will always be white and black because otherwise you will get very irritating results. If you don't want this: set a spectrum and edit the first two colors afterwards (but consider yourself as having been warned).

Please note also: everything you edit in the Color management dialog only effects the color-palette of the color selector in this dialog. If you want the change to take effect in the current project you have to click Apply or Accept (no immediate update here!).

13. Commands / Scripting:

I included an option in the Undo-List-dialog: If some of the entries in the undo-list are selected the button below the list may be pressed. This will convert the undo-entries into appropriate commands in the Command-dialog. By doing so it is possible to record a script of what has been done (Do something in the normal way while Undo is active. Then afterwards select the actions that should make up a script and then press the button. In the Commands-dialog you may then alter the commands, save and load them.). Unfortunately this feature is still incomplete at the moment. Loading and saving data is not fully supported yet. The scripting works concerning style-changes in things like Graph-Appearance, Set-Appearance and so on.

In the commands-dialog I inserted a set-selector for source and destination set and a new command-button: "Replay replacing set-Ids". By pressing this button the list of commands is executed as would be the case with the Replay-button, but in contrast to this every set-id in the command is replaced by the selected ids (separated in source and destination). This is very useful for scripting complicated commands like regression or filtering.

I also included an option to use special let us call them "clipboard-commands": remember value (including the last formula used in fits or for evaluate expression), add/multiply/substract/divide by last or remembered formula/saved formula/saved value. This can be used for example for generating scripts to remove offsets and process measurements: load measurement (without script) and define a region for the offset-correction (an area where your signal is zero, but background signal is not zero), then use a script command for regression in this area (maybe without displaying the result); the resulting formula is automatically remembered internally as the last formula; then use the special command "Minus last formula" to substract the offset from the complete set; following this you may for example use the filter (scriptable as well). (I have used this scripting method to remove the offset and used the filter on 100 sets at the same time by only one click on the "Replay replacing set-Ids"-button.)

Concerning "Replay replacing set-Ids": For some complicated scripts I included options for the set-ids in the scripts: If a set-id is given in the usual way (e.g. g0.s0, please do not use a shortened form here) it is replaced by the selected set-id. If you do not want an id to be replaces write a '$' after it (e.g. "G0.S0$.Y", not "G0.S0.Y$" or "G0$.S0"); in this case the operation will be done with the same set every time regardless which sets are selected (like the standard "Replay"-button does). If a '#' is typed after a set-id the given number is taken as the first id to be used with the first selected set, but the number will be increased for every other selected set. For example: if you select S0, S1 and S2 in G0 as source and destination and have a command like "G0.S0.Y=G0.S0.Y+G0.S3#.Y" and click on "Replay replacing set-Ids" then the set s3 is added to set s0, the set s4 is added to s1 and s5 is added to s2. These extensions will only work in the Commands-dialog if "Replay replacing set-Ids" is used (nowhere else!).

14. Comments about the font size:

Because the coordinates in Grace/QtGrace are usually relative to the smaller page-dimension (viewport-coordinates) there is no simple transformation formula between Grace/QtGrace and other applications. Let us assume a page in landscape orientation with the x-y-dimensions a x b in pixels (like 792 x 612 pixels for a Letter-page in 72dpi). In this case b is the smaller dimension and Grace/QtGrace will scale everything in relation to this value (viewport-coordinate '1' corresponds to b pixels in this case; generally: viewport-coordinate '1' corresponds to the smaller page dimension).

In comparison with other applications which give font-sizes in points (pt) I have derived a rough formula for converting font-sizes:

(Grace-char-size) = 445/9*fontsize(pt)*resolution(dpi)/(lower page dimension in Grace)

Or for example in two simple cases:
(Grace-char-size) = 5.817*fontsize(pt) (for letter-pages in 72 dpi)
(Grace-char-size) = 5.983*fontsize(pt) (for A4-pages in 72 dpi)

If you use a letter-page in 72 dpi and want a font-size of 20 pt you have to set the char-size in QtGrace/Grace to 116. As mentioned before: This is a rough conversion based on experimental values. Suggestions for improvements are welcome here as well.

15. Further regression options:

For the regression I created the possibility to generate sets with an arbitrary abscissa. Like with "Create set->by formula" you may now enter values for a paramter $t and a formular that generates x-values form $t (default: "Load x as $t"). In this way you may for example generate sets with x-values increasing as powers of 10 ("Load x as 10^$t" and set start=-5 and stop=5 for x-values between 0.00001 and 100000) which is handy for logarithmic scaling of the x-axis.

This new option is also included in the NonLinearFit-Dialog.

I also included the possibility to just do a regression without producing a new set. Just select "Load: None". This may be usefull if you want to use the regression inside a script.

In the same way the filters can be used in the Commands-Dialog you may also use the regression by the following command (you may also use the UnDo-List to automatically generate a command for a script):

#QTGRACE_SPECIAL REGRESSION <nr_of_source_sets>,<nr_of_target_sets>{<first_source_graph>,<first_source_set>;<second_source_graph>,<second_source_set>;...}{<Type_of_fit>,<restriction>,<invert_region>,<nr_of_points>,<Load>,<start>,<stop>,<x_$t_formula>}

Like with the filter-command (see above) please refer to the regression dialog on what numerical values to enter. Example:

#QTGRACE_SPECIAL REGRESSION 1,1{0,2}{0,4}{1;-1;0;250;2;-8.0;-1.0;10^$t}

This will do a linear regression on set G0.S0 and save the result to G0.S4. No restriction is to be used and no inversion. The new set will have 250 points and the x-values will be calculated via "10^$t" with $t ranging from -8 to -1 which results in x-values from 0.00000001 to 0.1. The Load-options is 2 here which means, that the new set will be calculated by a function.

16. Further interpolation options:

In the Interpolation-dialog I included a few extra options: at fist it is now possible to select a set from a diffent graph as the source-set for the new abcissa.
There is an option to increase the setlength to the next power of 2 (if the setlength is already a power of 2 nothing is changed). If this options is activated, the field for entering the new length is disabled.
For sampling you may now select "Linear in original bounds". This will disable the fields for Start- and Stop-entry and take the minimum and maximum values of x as start and stop. The new set will have the new length as entered (i.e. the value entered in the Length-field or the next power of 2 if this option has been selected). This is diffent form the Grace-standard-option "Linear mesh" in combination with the "Strict"-option. These settings can reduce the actual length of the interpolated set if start and stop are outside the original source bounds.
The last new option "Expand bounds, keep stepping" will pad the original set with new points (or remove points) by extrapolating the set at the beginning and the end in order to increase (or decrease) the setlength to the Length entered.

17. Fill area between sets

In QtGrace it is possible to fill the area between two sets (in Grace only the area between a set and y=0 or y=ymax or other constant values can be filled).

To do so open the set-appearance-dialog for the first set and go to the Line-Tab. Select Type="As polygon" in the Fill properties and select the second set as Polygon base set.

Please note: This option is specific for QtGrace and will not be used if the file with this filling-option is opened in the original Grace.