2. Data creation/import#

This paragraph describes the « data » portion of Grace. There are three ways to get data to plot in Grace:

  • by importing data into files;

  • by creating data (via sampled mathematical functions);

  • by duplicating and modifying existing data.

2.1. Importing#

Grace is able to import curves from text files. These files should only contain data (except lines starting with # which are considered comment lines).

Data must be in columns (separated by spaces or tab characters). Attention, a file can only contain a single « data block », i.e. data on several columns and several rows (unlike the.dogr files previously used by the Agraf tool).

Grace can read the different columns in the form:

  • a single curve (“single set”): XY, Grace takes column 1 for the x and column 2 for the y; or a XYDX curve, Grace then takes the x in column 1, the y in column 1, the y in column 2 and the x in column 2 and lx (the uncertainty on x) in column 3; multiple types of curves are provided;

  • several curves that share the same abscissa (“NXY”): column 1 contains the x-numbers common to all the curves; the columns (i+1) contain the ordinates of the curve (i).

  • several curves with potentially different abscissa (“block data”): an interface opens to define the number of the column where there are abscissa or ordinate rows of each curve - an “index” entry also allows you to define a curve ((1, y1), (2, y2),… , (n, yn)) -.

_images/100002010000018F000002D2C11E73D7BA1D5EB4.png
_images/10000201000000EB000002C4A76936468ED83614.png

In practice, the import is done from the « Data/Import/Ascii… » menu, which opens the dialog window above. Note:

  • the « file selector » part at the top;

  • the possibility of sending the imported data to the graph of your choice (See below the organization of Grace in graphs and curves): « Read to graph »

  • the selection of the type of import (« Load as » and « Set type »). In the case of an import in the form of « block data », after validation by « ok », Grace analyzes the file and a new window opens which allows you to assign the various columns. Note that at the top of this window, Grace indicates the number of columns and rows that he found in the file. It should also be noted that the type of the curve can be defined by “Set type”. Finally, the difference between the « apply » and « accept » button is interesting to know: « apply » loads the curve while leaving the dialog box open (to be used if the user has several curves to import from the same file), while « accept » loads the curve and closes the dialog box (to be used for importing a single curve from the same file).

2.2. Data creation by mathematical function#

To define a curve, the following commands must be linked together:

  • Edit/Data sets…

  • Right click in the area under « Data sets »;

  • Choose « Create New/By Formula », which opens the next box, which must be filled in. For example, to plot sin (x) +2.5 from -10 to 10 in 100 steps;

_images/10000201000001AF00000166B4F9E76254474194.png _images/10000201000001460000027771F1C697CE63E60E.png
  • After « Accept » then « Close », possibly « Autoscale » button (tool (see paragraph [§5] detailing Grace’s toolbar) « AS » to the right of the zoom magnifying glass) to display the curve at the correct scale.

You can also use tests (use of the « ? » characters) equivalent of a « then » and « : » equivalent of an « else ») in the formulas, as in the following examples:

_images/10000201000001AF000001661D52BFBA1136E09C.png _images/1000020100000361000002D257D5B0415DF62E6B.png
_images/10000201000001AF000001660B701B4F5A0FA7E7.png _images/1000020100000361000002D24C5C0FA374CC029F.png

You can also use the symbol PI:

_images/10000201000001C800000102FE458239C61C0727.png _images/10000201000001C800000102015A60AF6EF578BE.png
\[\]

: label: EQ-None

_images/1000020100000361000002D2A154AF227A8FC20B.png

2.3. Duplicating and modifying existing data#

Suppose Grace already has the following curve:

_images/10000201000003B1000002D2CB771B52B1CDC644.png

To duplicate/modify a curve, there are two solutions. Whatever the solution chosen, it is necessary to open the control console. With the first solution, you start by duplicating the curve to modify it in the control console; with the second, everything is done in the control console.

2.3.1. Duplication then modification in the console#

It is assumed that there is at least one curve available in Grace.

The command sequence is as follows:

  • Edit/Set Operations,

  • select G0 as the graph to copy, S0 as the curve to copy and G0 as the destination graph and « copy » as the operation to be performed, finally « accept »,

  • you now have to modify column Y of set S1; this is done by opening the command console: Window/Commands, and typing « s1.y = s0.y^2 » to get the previous curve squared (Cf. [§5.4] from the User’s Guide for a complete list of authorized transactions).

_images/100002010000012D000001A487FC40C29834817C.png _images/100002010000016B0000014D1C3B89524D99909F.png

2.3.2. creation in the console#

We immediately open the command console: Window/Commands.

  • We first create the curve by specifying the number of points (identical to the number of points in the S0 set) « s1 length s0.length »,

  • then we duplicate the abscissa « s1.x = s0.x »,

  • finally we define the ordinates « s1.y = s0.y^2 »

_images/100002010000016B0000014DAE42320DA8B7549F.png