4. Examples of use#
Let the following text file contain the information to be read. It is composed of columns of numbers, here separated by white characters, defining blocks, which are themselves delimited by free text.
Any line that contains characters other than numbers and the predefined separator is considered free delimiting text. So we have 4 blocks in the following file:
AAA BBB CCC
DDD
Eee FFF
0. 0. 0.
0.1 1. 10.
0.2 2. 20.
0.3 3. 30.
xxx yyy
www zzz
0.4 4. 40. 400.
0.5 5. 50. 500.
0.6 6. 60. 600.
xxx
70. 700.
80. 800.
90. 900.
Ppp qqq
8.8
9.9
4.1. Reading a simple function#
By using the default values for the choice of columns:
F= LIRE_FONCTION (UNITE = 38,
NOM_PARA = 'INST',)
The function thus created is:
Abscissas = [:ref:`0., 0.1, 0.2, 0.3 <0., 0.1, 0.2, 0.3>`]
Orders = [:ref:`0., 1. , 2. , 3. <0., 1. , 2. , 3. >`]
By combining columns taken from different blocks for abscissa and ordinates:
F= LIRE_FONCTION (UNITE = 38,
NOM_PARA = 'INST',
INDIC_PARA = [:ref:`2,4 <2,4>`],
INDIC_RESU = [:ref:`3,1 <3,1>`],
The function thus created is:
X-legs = [:ref:`400., 500., 600. <400., 500., 600.>`]
Orders = [:ref:` 70., 80., 90. < 70., 80., 90.>`]
Attention, the command then verifies that the cardinals of the columns defined by INDIC_PARA and INDIC_RESU are identical. This would not have been the case here with for example INDIC_PARA = [1,3].
4.2. Reading a complex function#
By using the default values for the choice of columns:
F= LIRE_FONCTION (UNITE = 38,
NOM_PARA = 'INST',
TYPE = 'FONCTION_C',
FORMAT_C = 'REEL_IMAG',)
The function thus created is:
X-legs = [:ref:`0., 0.1, 0.2, 0.3 <0., 0.1, 0.2, 0.3>`]
Orders = [:external:ref:`(0.,0.) , (1.,10.) , (2.,20.) , (3.,30.) <(0.,0.) , (1.,10.) , (2.,20.) , (3.,30.)>`]
Of course, we could have specified columns other than those by default for INDIC_REEL and INDIC_IMAG for and. However, be careful to point to columns with the same cardinal.
4.3. Reading a tablecloth#
By using the default values for the choice of columns:
F= LIRE_FONCTION (UNITE = 38,
NOM_PARA = 'INST',
INDIC_PARA = [:ref:`4,1 <4,1>`],
NOM_PARA_FONC = 'FREQ',
INDIC_ABSCISSE = [:ref:`2,2 <2,2>`],
DEFI_FONCTION = (F (INDIC_RESU = [:ref:`3,1 <3,1>`],),
F (INDIC_RESU = [2,3],),))
The tablecloth created in this way is:
For the value of the parameter INST =8.8, the function:
X-legs = [:ref:`4. , 5. , 6. <4. , 5. , 6.>`]
Orders = [:ref:`70. , 80. , 90. <70. , 80. , 90.>`]
For the value of the parameter INST =9.9, the function:
X-legs = [:ref:`4. , 5. , 6. <4. , 5. , 6.>`]
Orders = [:ref:`40. , 50. , 60. <40. , 50. , 60.>`]
The consistency checks of the cardinals of abscissa and ordinate columns are done by the command.