home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 December / simtel1292_SIMTEL_1292_Walnut_Creek.iso / msdos / spredsht / profile.arc / PROF.HEL < prev    next >
Text File  |  1990-01-03  |  100KB  |  2,712 lines

  1. #public - Copyright Information on Public Domain Profile
  2.  
  3. You are now using the Public Domain version of the general purpose 
  4. measurement data processor Profile. This software may not be distributed 
  5. commercially, that is, for more than the cost of distribution. However, 
  6. non-commercial copying of this program package (for example by non-profit 
  7. organizations, computer user groups, bulletin board systems or private 
  8. users) is strongly encouraged. 
  9.  
  10. In other words: Copy Freely, But Do Not Sell.
  11.  
  12. You are strongly urged to distribute this software in its original form. 
  13. That is a compressed archive file called PROFILE.ARC. It contains not only 
  14. the executable program, but also the help file, further documentation and 
  15. several example Profile programs.
  16.  
  17. Every care has been taken to ensure that the Profile package operates
  18. properly. We however make no warranties, explicit or implied, that it is
  19. free of error. If you use Profile to solve a problem whose incorrect 
  20. solution might injure people or damage property, you do so at your own
  21. risk. 
  22.  
  23. By using Profile you agree to the terms above. You also agree that the
  24. author and the Delft University of Technology will not be held liable for
  25. any cost you may incur, or potential income you might lose as a result of
  26. using Profile. 
  27.  
  28. Profile is written in portable C and runs on various computer systems,
  29. including the IBM-PC, VAX/VMS and several UNIX dialects. You can acquire
  30. a printed manual, non Public Domain executables for the VAX and the PC 
  31. and the source code by signing a licence agreement with the Faculty of
  32. Electrical Engineering of the Delft University of Technology. Send a 
  33. written request, stating the desired magnetic carrier, to
  34.  
  35.                           dr. Wim Crans
  36.                    Electrical Materials Laboratory
  37.                    Delft University of Technology
  38.                       P.O. Box 5031, Mekelweg 4
  39.                            2600 GA  DELFT
  40.                           THE NETHERLANDS
  41.                         Fax: +31-15-783622
  42.  
  43. You will then be sent the appropiate licence forms. After shipment of the
  44. manual and the software you will be billed for the handling cost, estimated 
  45. to be US $50 or Dfl. 100,--, unless you enclose a check for that amount.
  46. A suitable software request form is included as a part of the PROFILE.DOC
  47. file distributed with the public domain Profile package. 
  48.  
  49. Good news for Delft University Users: you do not need a licence agreement.
  50. The manual and executables can be ordered at the above address using an 
  51. internal order form. The exchange of the source code is negotiable.
  52.  
  53.  
  54. #help - Overview of all available manual pages for Profile.
  55.  
  56.  
  57. +------------------------+-------------+-------------------------------+------+
  58. | Subject                |  Keyword    | Contents                      | page |
  59. +------------------------+-------------+-------------------------------+------+
  60. | General information    |  intro      | possibilities of profile      | 1.1. |
  61. | Invoking profile       |  invoke     | call profile from the shell   | 1.2. |
  62. | A detailed example     |  example    | process MOS-CV measurements   | 1.3. |
  63. | Synthetic data example |  example2   | generate a pnp doping profile | 1.4. |
  64. +------------------------+-------------+-------------------------------+------+
  65. | Giving commands        |  history    | repeat a command line         | 2.1. |
  66. |                        |  edit       | repair typing mistakes        | 2.2. |
  67. |                        |  exec       | read commands from a file     | 2.3. |
  68. |                        |  log        | write commands to a file      | 2.4. |
  69. |                        |  quit       | close a profile session       | 2.5. |
  70. |                        |  silent     | refrain profile from talking  | 2.6. |
  71. |                        |  shell      | give a system command         | 2.7. |
  72. |                        |  comment    | giving comment text           | 2.8. |
  73. +------------------------+-------------+-------------------------------+------+
  74. | Data structure         |  data       | introduction to profile data  | 3.1. |
  75. |                        |  alloc      | allocate data lines           | 3.2. |
  76. |                        |  type       | declare a data type (column)  | 3.3. |
  77. |                        |  var        | declare a program variable    | 3.4. |
  78. |                        |  assign     | give values to type elements  | 3.5. |
  79. |                        |  extract    | read values of type elements  | 3.5. |
  80. |                        |  clear      | clear data space              | 3.6. |
  81. |                        |  recount    | reset default type count      | 3.7. |
  82. |                        |  defaults   | program defined data          | 3.8. |
  83. +------------------------+-------------+-------------------------------+------+
  84. | Evaluation of          |  expression | what expressions are allowed  | 4.1. |
  85. | expressions            |  define     | define standard expressions   | 4.2. |
  86. |                        |  functions  | available standard functions  | 4.3. |
  87. |                        |  show       | give overview of definitions  | 4.4. |
  88. +------------------------+-------------+-------------------------------+------+
  89. | Iterative processing   |  do         | start a repetitive sequence   | 5.1. |
  90. |                        |  od         | end of a repetitive sequence  | 5.1. |
  91. +------------------------+-------------+-------------------------------+------+
  92. | Input/Output           |  get        | read data from a file         | 6.1. |
  93. |                        |  startmark  | define a starting point       | 6.2. |
  94. |                        |  endmark    | define an ending point        | 6.3. |
  95. |                        |  put        | write data to a file          | 6.4. |
  96. |                        |  print      | write data to the screen      | 6.5. |
  97. |                        |  putvar     | write variable values to file | 6.6. |
  98. +------------------------+-------------+-------------------------------+------+
  99. | Graphical Output       |  view       | preview data on the screen    | 7.1. |
  100. |                        |  graph      | plot with printable chars     | 7.2. |
  101. |                        |  plot       | plot data on an HP-GL plotter | 7.3. |
  102. |                        |  setplot    | set plotstyle per data type   | 7.4. |
  103. |                        |  term       | select video terminal type    | 7.5. |
  104. |                        |  adapt      | select video adaptor (IBM-PC) | 7.6. |
  105. |                        |  plotfile   | output file for plotter data  | 7.7. |
  106. |                        |  viewfile   | output file for screen data   | 7.7. |
  107. +------------------------+-------------+-------------------------------+------+
  108. | Manipulating data      |  sort       | sort to a named data type     | 8.1. |
  109. |                        |  remove     | delete lines of data          | 8.2. |
  110. |                        |  reduce     | delete at regular intervals   | 8.3. |
  111. |                        |  insert     | add empty data lines          | 8.4. |
  112. |                        |  smooth     | apply a moving average filter | 8.5. |
  113. |                        |  mono       | make data fully monotone      | 8.6. |
  114. |                        |  clip       | remove noise peaks            | 8.7. |
  115. |                        |  polar      | from rectangular to polar     | 8.8. |
  116. |                        |  rect       | from polar to rectangular     | 8.8. |
  117. +------------------------+-------------+-------------------------------+------+
  118. | Numerical Analysis     |  fit        | polynomial curve-fit          | 9.1. |
  119. |                        |  diff       | differentiate numerically     | 9.2. |
  120. |                        |  inte       | integrate numerically         | 9.3. |
  121. |                        |  sum        | summation of a data type      | 9.4. |
  122. |                        |  compare    | compare two data types        | 9.5. |
  123. |                        |  map        | map data to another x-axis    | 9.6. |
  124. |                        |  minmax     | find extremes of a data type  | 9.7. |
  125. |                        |  poisson    | solve Poisson's equation      | 9.8. |
  126. +------------------------+-------------+------------------------------++------+
  127. | Non-linear             |  levmar     | Optimization driver          | 10.1. |
  128. | Optimization           |  setext     | Define external model names  | 10.2. |
  129. |                        |  setlm      | Set operational parameters   | 10.3. |
  130. |                        |  constrain  | Specify parameter constrains | 10.4. |
  131. |                        |  callext    | Call the external model once | 10.5. |
  132. |                        |  scanspace  | Scan the parameter space     | 10.6. |
  133. |                        |  tpled      | Input file template editor   | 10.7. |
  134. +------------------------+-------------+------------------------------+-------+
  135.  
  136.  
  137. #intro (1.1.)  Introduction to the possibilities of Profile.
  138.  
  139.  
  140.     Profile - a measurement data processing command interpreter
  141.     ===========================================================
  142.  
  143.  
  144.     by Gertjan L. Ouwerling,
  145.        Electrical Materials Laboratory, Faculty of Electrical
  146.        Engineering, Delft University of Technology, The Netherlands.
  147.  
  148.  
  149.  
  150.     Profile is a program that can be used to process data, obtained
  151.     by measurements of simulations or otherwise, fast and flexibly.
  152.     A major constraint is that data has to be to be available in
  153.     text files, and organized columnwise. Profile can also generate
  154.     columnwise organized data files by evaluation of functions.
  155.  
  156.     Profile supports the following features:
  157.  
  158.     - Batch (from a command file) or interactive mode.
  159.     - On-line definitions of
  160.       + data types (columns of data);
  161.       + program variables;
  162.       + evaluation sequences (arithmetic operations on data).
  163.     - All usual math functions (sin,ln,sqrt, etc).
  164.     - Evaluation of expressions (also use as a
  165.       pocket calculator).
  166.     - Polynomial curve-fit (even on unequally spaced data)
  167.     - Numerical differentiation and integration.
  168.     - A diversity of data manipulation commands
  169.       (such as smoothing, data reduction etc).
  170.     - Non-linear optimization and Inverse Modelling driver.
  171.     - On-line help on all commands.
  172.     - History mechanism and command line editing.
  173.     - Graphical output on both screen and plotter.
  174.       Nice graphs on ordinary video terminals.
  175.     - Runs on both mainframes (UNIX) and PCs.
  176.  
  177.  
  178.     (C) 1986, 1987, 1988 Electrical Materials Laboratory.
  179.  
  180.  
  181. Profile operates as a command interpreter. When invoked it prompts with
  182.  
  183. prof>
  184.  
  185. and to this prompt commands and expressions may be typed. A command
  186. tells profile to do something with the data (read it, write it,
  187. perform a numerical transformation, make a plot, etc). An expression
  188. is a mathematical formula that tells profile to compute new data using
  189. data already present.
  190.  
  191. prof> diff num ydata xdata dydx       or
  192. prof> y2=ln(x2/pi)
  193.  
  194. Data is present in the form of scalars (variables) and 1D vectors
  195. (data types or 'columns'). The names of the variables and data types
  196. must be declared to profile using the commands type and var.
  197. All data is represented by double precision floating point notation.
  198.  
  199. If a command operates on an undetermined number of data types or
  200. variables, it usually ends in a dollar sign '$', that indicates
  201. the end of data names:
  202.  
  203. prof> print a1 a2 a3 a4 $
  204.  
  205. If however profile knows in advance how many names will be given,
  206. the dollar sign is not required:
  207.  
  208. prof> fit idrain vgate idrfit
  209.  
  210. When giving commands, profile asks for more data until it is
  211. satisfied. E.g., if you only type the command name fit, it will ask
  212. for the names of the appropriate data types:
  213.  
  214. prof> fit
  215. y data type: idrain
  216. x data type: vgate
  217. fitted y data type: idrfit
  218.  
  219. Hence, in case you are unsure, just give the command name.
  220.  
  221. Help on all commands, and on a number of topics of general interest,
  222. is available by giving
  223.  
  224. prof> help <keyword>
  225.  
  226. A list of possible keywords is displayed if you give
  227.  
  228. prof> help help
  229.  
  230. Most UNIX or MS-DOS commands can be executed directly without leaving
  231. the program profile. This allows you to use e.g. the system editor for
  232. changing data in files whilst using the profile package.
  233.  
  234. prof> edit data.dat
  235. prof> get data.dat x y z $
  236.  
  237.  
  238. A variety of graphical output can be generated using profile.
  239.  
  240. In the first place, with the command graph it is possible to make a plot
  241. on the computer line printer using alpha-numerical characters only.
  242. The size of this plot is user controlled.
  243.  
  244. In the second place, with plot it is possible to produce a much nicer
  245. plot on pen plotters that use HP-GL as an graphical language. This has been
  246. tested for the much used HP7550A eight color pen plotter.
  247.  
  248. Thirdly, plots may be previewed on the terminal or PC screen using the
  249. command view. Profile knows several terminal protocols (including VT100,
  250. VT52, CIT101 alternate graphics and IBM-PC graphics) and is able to draw
  251. a graph of acceptable resolution on ordinary video terminals such as the
  252. DEC VT100.
  253.  
  254.  
  255. A series of Profile commands may be saved in a file and executed as a
  256. Profile 'program'. This can even be done on line using the command exec.
  257.  
  258. prof> exec subrout.pro
  259.  
  260. This makes it possible to use previously defined data processing
  261. sequences (comparable to subroutines in programming languages).
  262. Exec statements may be nested, allowing an hierarchical program structure.
  263.  
  264.  
  265. The Modified Damped Least Squares non-linear parameter optimization
  266. method, an improved variant of the Levenberg-Marquardt method, is
  267. available through the command levmar. This allows the iterative
  268. determination of the (non-linear) parameters of a (non-linear) model
  269. that describes some measurement data. This model may be either an
  270. internal analytical expression (previously defined) or an external
  271. program that reads the parameters and simulates the measurement.
  272.  
  273.  
  274. #invoke (1.2.)  Call Profile from the operating system prompt.
  275.  
  276.  
  277. Profile is available on the IBM-PC and true compatibles, on VAX/VMS and 
  278. on various UNIX dialects. Program invocation and use are almost equal for
  279. the PC versus UNIX, with one exception: on the PC the program is called
  280. prof (unless renamed by the user). Our examples use the name profile.
  281.  
  282. Possible invocation modes:
  283.  
  284.    System prompt (On the PC: C>  and on the VAX: $).
  285.    |
  286.    v
  287. 1. % profile [options] <return>
  288.  
  289.      Profile starts in interactive mode. The profile prompt
  290.      prof> indicates that profile is ready to accept your commands.
  291.  
  292. 2. % profile [options] [commandfile] <return>
  293.  
  294.      Profile starts in batch mode and reads commands from the command 
  295.      file. If this does not end in the profile statement 'quit', profile 
  296.      switches to interactive mode upon completion of the command file.
  297.      All output is written to the screen.
  298.  
  299. 3. % profile [options] [commandfile] > [outputfile] <return>     (Unix,PC)
  300.    $ profile [options] /output=[outputfile] [commandfile] <return>   (Vax)
  301.  
  302.      As above, but now writing all output to the output file
  303.      (by the usual data redirect > (Unix,MS-DOS) or /output= (Vax)).
  304.  
  305. As command line options are available:
  306.  
  307. -n[number]   <- max length of data type
  308. -d[path]     <- search path for help files
  309.  
  310. With the option -n[number] the maximum length of a Profile data type
  311. (data column) may be installed for this Profile run. Any number larger than
  312. 2 is allowed but the limited amount of memory present in your computer
  313. must be considered. The default maximum length is 1000 (IBM-PC).
  314.  
  315. With the option -d[path] the path of the Profile help texts file can be
  316. stated to the program. Usually this is useful on the PC only. Specifying 
  317. no path (just -d) will let Profile search in the current directory.
  318.  
  319. Example Profile Invocations:
  320.  
  321. % profile                            <-- Run default Profile
  322. % profile program.pro                <-- Run Profile program program.pro
  323. % profile -n500                      <-- Maximum data type length 500
  324. % profile -dA:                       <-- Search helpfile on disk A:
  325. % profile -d                         <-- Search helpfile in current directory
  326. % profile -n3000 -dB:\Help test.pro  <-- Mixed example
  327. % profile mypro.pro > mypro.log      <-- Catch Output by Redirect into File
  328. % profile/output=mypro.log mypro.pro <-- The same on VAX/VMS
  329.  
  330.  
  331. #example (1.3.)  MOS-CV measurements data processing.
  332.  
  333.  
  334. : This text is the full profile command input to process
  335. : data obtained by MOS-CV measurements.
  336. : These measurements are meant to find the doping profile
  337. : in the silicon under the MOS-capacitor: the dopant
  338. : concentration versus the depth.
  339. :
  340. : Definition of types and variables
  341. :
  342. type c $    : contains the measured capacitance
  343. type v $    : contains the bias voltage
  344. type dcdv $ : will contain the first derivative of c to v
  345. type nd $   : will contain the dopant concentration
  346. type x $    : will contain the depth into the silicon
  347. :
  348. var real area $   : area of the MOS capacitor
  349. var real dox  $   : thickness of the silicon dioxide
  350. var real nd_ave $ : will contain the average dopant concentration
  351. var real q_tot $  : will contain the total charge present
  352. :
  353. : Definition of expressions used to compute nd and xe
  354. : using default variables q, eps0, epssi and epsox
  355. :
  356. define dope =  (c~3)/(q*eps0*epssi*sqr(area)*dcdv)
  357. define depth = ((eps0*epssi*area)/ c ) + ((epssi/epsox)*dox)
  358. :
  359. : Setting the values of dox and area for this device
  360. :
  361. dox = 1E-06
  362. : dox = 0.01 um = 1E-06 cm
  363. area = pi*sqr(200E-04)
  364. : device is round with radius of 200 um
  365. :
  366. : Setting the markers that indicate at which lines of the
  367. : input file reading data should start and end
  368. :
  369. startmark meas_#1
  370. endmark   meas_#2
  371. :
  372. : Reading data from file
  373. :
  374. get moscv.dat v c $
  375. :
  376. : Remove data lines that are not needed
  377. :
  378. remove 50 $
  379. :
  380. : Reduce the amount of lines to enable numerical differentiation
  381. :
  382. reduce 2
  383. :
  384. : Smooth the C-data to stabilize the numerical derivative
  385. :
  386. nsmooth=3
  387. smooth c
  388. :
  389. :
  390. : Determine the derivative numerically
  391. :
  392. diff num c v dcdv
  393. :
  394. : Compute the wanted quantities x and nd
  395. :
  396. x = depth
  397. nd = dope
  398. :
  399. : Compute the average dope
  400. :
  401. sum nd tmp1
  402. nd_ave = tmp1/ndata
  403. :
  404. : Compute the total charge present
  405. :
  406. inte nd x q_tot
  407. q_tot = q_tot * area * q
  408. :
  409. : Write the results to a file (e.g. for making a plot)
  410. :
  411. put moscv#1.out x nd $
  412. :
  413. : Ready
  414. :
  415. quit
  416.  
  417.  
  418. #example2 (1.4.)  Data generation (a pnp-structure doping profile).
  419.  
  420.  
  421. : This profile program generates a doping profile as generated
  422. : by making one or two implants in uniformly doped background
  423. : material. (In this case, two implants is chosen).
  424. : The plotted result is shown following this text.
  425. :
  426.  
  427. type x dope absdope logdope efield psi chandope vg $
  428. var int ngrid ngate nred $
  429. var real nrp1 rp1 drp1 nrp2 rp2 drp2 dsub dgate dback
  430.          wtot wsub wgate wsmooth
  431.          ptype ntype imp1type imp2type gatetype subtype backtype
  432.          gatepres imp1pres imp2pres subpres
  433.          mu emax vmax eps
  434.          $
  435.  
  436. : p-type dope is negative of sign, n-type positive
  437. : a scaling factor mu gives the length in cm
  438. : eps is set to the epsilon of Silicon
  439.  
  440. ptype = -1
  441. ntype = 1
  442. mu = 1E-04
  443. eps = eps0*epssi
  444.  
  445. : p-gate area if x < 0
  446. : p-substrate area if x > wsub
  447. : n-channel area in between
  448.  
  449. define isgate = neg(x)
  450. define issub  = pos(x-wsub)
  451. define ischan = pos(pos(x)+neg(x-wsub)-1.5)
  452.  
  453. : formulas describing dopant concentration due to
  454. : two implantations (fimp1 and fimp2), background
  455. : channel doping (fback), gate doping (fgate) and
  456. : substrate doping (fsub). A function fsmooth is
  457. : used to smooth the transition between channel and
  458. : substrate.
  459.  
  460. define fimp1 = imp1type*imp1pres*nrp1*exp(min(sqr(x-rp1)/(2*sqr(drp1))))
  461. define fimp2 = imp2type*imp2pres*nrp2*exp(min(sqr(x-rp2)/(2*sqr(drp2))))
  462. define fgate = gatetype*dgate
  463. define fsub  = subtype *dsub
  464. define fback = backtype*dback
  465. define fsmooth = 1 - exp(min(sqr((x-wsub)/wsmooth)))
  466. :
  467. : ********** definition of variable values **********
  468. :
  469. : The values below decribe the exact properties of the
  470. : doping profile that will be generated
  471. :
  472.  
  473. ngrid = 400
  474. nred = 8
  475. ngate = 10
  476.  
  477. imp1type=ntype
  478. imp2type=ntype
  479. backtype=ntype
  480. gatetype=ptype
  481. subtype =ptype
  482.  
  483. gatepres=1
  484. imp1pres=1
  485. imp2pres=1
  486. subpres =1
  487.  
  488. dback=7E14
  489. dsub =2E14
  490. dgate=1E20
  491.  
  492. nrp1 = 4E15
  493. rp1  = 0.5*mu
  494. drp1 = 0.7*mu
  495.  
  496. nrp2 = 3E15
  497. rp2  = 2.5
  498. drp2 = 0.7
  499.  
  500. wgate = 0.1*mu
  501. wsub  = 8.0*mu
  502. wtot  = 10.0*mu
  503. wsmooth = 0.2*mu
  504.  
  505. : definition of the xgrid
  506.  
  507. : ngrid lines of data space are allocated and the
  508. : x coordinate is filled according to the variable values.
  509.  
  510. alloc ngrid
  511. x = (count/ndata)*wtot
  512. x = x - (gatepres*wgate)
  513.  
  514. : the dope is computed using the predefined formulas
  515.  
  516. dope = fsmooth*((fgate*isgate)+(ischan*(fback+fimp1+fimp2))+(issub*fsub))
  517.  
  518. : for plotting purposes, the absolute value and the log of the dope
  519. : are computed
  520.  
  521. absdope = abs(dope)
  522. logdope = log(absdope)
  523.  
  524. : the channel region is selected by setting gate and substrate
  525. : dope to zero in the data type chandope. Double integration gives
  526. : the electric field strength and the gate voltage for a fully
  527. : depleted channel (according to Poisson's equation).
  528.  
  529. chandope = dope*pos(dope*backtype)
  530. inte chandope x efield
  531. efield = efield*(q/eps)
  532. emax=efield
  533. efield=efield-emax
  534. efield = efield*pos(dope*backtype)
  535. inte efield x psi
  536. vmax=psi
  537.  
  538. : A first impression of the result is gotten by viewing on the terminal
  539. : in the channel (x>0.0) and the substrate (x=10 mu).
  540.  
  541. xls = 0.01*mu
  542. xrs = 10*mu
  543. view x absdope | psi $
  544.  
  545. : Using this picture, appropriate scaling values are chosen and a
  546. : plot is made using forced scales, no colors and a reduced number
  547. : of markers.
  548.  
  549. yls = 0.0
  550. yus = 5E15
  551. ryls = -70.0
  552. ryus = +10.0
  553. color=0
  554. marker=1
  555. mreduct=20
  556. plot x absdope | psi $ Profile example2: Generation of a 'camel' dope profile
  557.  
  558. : The values of the maximal electric field and potential are printed
  559.  
  560. emax
  561. vmax
  562.  
  563. quit
  564.  
  565.  
  566.  
  567. The plot obtained by this program is depicted on the next page.
  568.  
  569.  
  570. #history (2.1.)  Command History Mechanism - reduce typing effort.
  571.  
  572.  
  573. The profile history mechanism enables you to repeat previously
  574. entered commands. This may save a lot of typing effort.
  575. The following history commands are valid:
  576.  
  577. h        <- give an overview of the 20 most recently entered
  578.             commandlines.
  579. !!       <- repeat the last given command.
  580. !-3      <- repeat the command 3 lines above the current
  581.             (!-1 equals !!).
  582. !27      <- repeat the 27th command (from the start).
  583. !hoi     <- repeat the most recent command starting with "hoi".
  584.  
  585. The history mechanism may be combined with the command line editor.
  586. See also  help edit.
  587.  
  588.  
  589. #edit (2.2.)  Edit command lines in batch and interactively.
  590.  
  591.  
  592. Typing errors may be corrected (or variants of previously given
  593. commands may be generated) by using the command line editor:
  594.  
  595. prof> ^wrongstr^rightstr
  596.  
  597. replaces the first instance of 'wrongstr' in the last given
  598. command line by 'rightstr'. Example:
  599.  
  600. prof> get dta.dat a b c $
  601.       Cannot open dta.dat.
  602. prof> ^dta^data
  603. get data.dat a b c $
  604.       15 lines.
  605.  
  606. A command line editor command may be preceded by any kind of
  607. history command to indicate which line should be edited,
  608. for example:
  609.  
  610. !-3^hoi^hai
  611. !hoi^hoi^hai                           (See also  help history.)
  612.  
  613.  
  614. When using Profile in batch mode (by execution of a file with Profile
  615. commands), it is possible to edit the commandline by putting a question
  616. between question marks. This question will be asked on the screen and
  617. will be replaced (including the question marks) by the answer typed by
  618. the user. For example:
  619.  
  620. prof> get ?give input data file name? x1 y1 $
  621.  
  622.  ---- give input data file name: infile.dat    <- answer typed by user
  623.       get infile.dat x1 y1 $
  624. prof>
  625.  
  626. Because this operates on strings, it can be used for any required 
  627. answer, including numerical values. For example:
  628.  
  629. prof> var real a1 a2 $
  630. prof> a1 = ?give the value of a1?
  631. prof> a2 = ?give the value of a2?
  632.  
  633. Moreover, it is possible to temporarily halt the execution of Profile
  634. with the pause command. This is demonstrated in the <tutorial.pro>
  635. Profile command file as provided in the Profile example set. Or:
  636.  
  637. prof> pause
  638. ----------- Give <return> to continue -----> 
  639.  
  640.  
  641. #exec (2.3.)  Read commands from a named file.
  642.  
  643. With exec it is possible to read profile commands from a file
  644. instead of from the current file or from the screen. Exec's
  645. may be nested up to a certain (high) level. If a profile session
  646. executing from a nesting of exec's is closed (by the statement
  647. quit) prematurely, profile gives an overview of files not read
  648. to end.
  649.  
  650. Example:
  651.  
  652. prof> exec mymeas.def
  653.  
  654. The file mymeas.def may contain all data types and variables
  655. definitions belonging to a certain measurement.
  656.  
  657.  
  658. #log (2.4.)  Save command lines in a named logfile.
  659.  
  660.  
  661. Log enables you to save all your commands in a named file,
  662. so that this file later can easily be used as (or turned into)
  663. a profile batch command file. Log works as a toggle.
  664. Example:
  665.  
  666. prof> log [logfile]
  667.       Logging turned on.
  668. prof> log
  669.       Logging turned off.
  670.  
  671.  
  672. Profile programs may be made by editting log files of trial sessions.
  673.  
  674.  
  675. #quit (2.5.)  Terminate a profile session.
  676.  
  677.  
  678. The command quit checks if all exec files were closed,
  679. and stops profile from executing. Example:
  680.  
  681. prof> quit
  682.       Cpu user   time 12.4 sec. \  UNIX only
  683.       Cpu system time 6.9 sec.  /
  684.  
  685. Quit may be issued from the screen and from files alike.
  686.  
  687. NOTE: if you use a Profile program in the background or with output data
  688.       redirect, don't forget to include a quit statement in your program
  689.       file, or Profile will wait quietly for it to arrive from the
  690.       terminal!
  691.  
  692.  
  693. #silent (2.6.)  Stop profile from talking to you.
  694.  
  695.  
  696. Silent operates as a toggle that switches the verbal capabilities
  697. of profile on and off. It is especially useful for stopping
  698. large amounts of output generated by reading files with
  699. definitions of data types etc. for a certain measurement.
  700. Example:
  701.  
  702. prof> silent
  703.       Profile is muted.
  704. prof> exec mymeas.def
  705. prof> silent
  706.       Profile talks again.
  707.  
  708.  
  709. #shell (2.7.)  Escape to the operating system level.
  710.  
  711.  
  712. You may from time to time wish to issue commands to the
  713. operating system without leaving the profile program (and
  714. thus loosing all generated data). This can be done by
  715. using the shell escape %. By nature, profile knowns the names
  716. of almost all relevant system commands and allows you to use
  717. them without using this shell escape!
  718.  
  719. Example: (with the UNIX command ls)
  720.  
  721. prof> % ls
  722. data1.dat data2.dat mymeas.def output1.out output2.out
  723.  
  724. But also:
  725.  
  726. prof> ls
  727. data1.dat data2.dat mymeas.def output1.out output2.out
  728.  
  729.  
  730. #comment (2.8.)  Give input that is not executed.
  731.  
  732.  
  733. Everything on a line that follows the string ': ' is
  734. regarded to be comment and thus not executed.
  735.  
  736. Example:
  737.  
  738. prof> : This is a wonderful program
  739.        ^
  740.        |
  741.        note: this space must be present.
  742.  
  743. prof> silent : now profile is mute.
  744.  
  745. Comments are not allowed behind expressions.
  746.  
  747.  
  748. #data (3.1.)  Data structure of the program Profile.
  749.  
  750.  
  751. Profile processes data organized columnwise. Each column of
  752. data represents a certain measured (or obtained otherwise)
  753. quantity. Such a column is called a data type.
  754. Data types are internally represented by double precision
  755. floating point numbers.
  756. Lines with data types may be processed (all alike) by specifying
  757. arithmetic expressions involving data types, math functions
  758. constants and also program variables.
  759. Colunms (one or more data type) may be processed with a number
  760. of dedicated processing commands (smoothing, differentiation,
  761. integration etc.). See also  help help.
  762.  
  763.  
  764. Data types  ->     a    b    c  count (present by default)
  765.                 +----+----+----+----+
  766.               1 |  0 |  1 |  0 |  0 |
  767.                 +----+----+----+----+
  768.               2 |  2 |  2 |  4 |  1 |
  769. Data lines      +----+----+----+----+
  770.               3 |  4 |  3 | 12 |  2 |
  771.                 +----+----+----+----+
  772.               4 |  8 |  5 | 40 |  3 |
  773.                 +----+----+----+----+
  774.  
  775.  
  776. This situation may occur after reading a and b from file (see
  777. help get) and applying the expression  c=a*b  (see  help expression).
  778.  
  779. see also:
  780.  
  781. help defaults <-- overview of data types and constants that are
  782.                   present by default.
  783. help alloc    <-- allocation of data lines without file reading
  784.                   and using the data type count for data generation.
  785. help var      <-- declaration of a variable.
  786. help type     <-- declaration of a data type.
  787. help show     <-- get an overview of data types and variables
  788.                   presently declared.
  789. help clear    <-- clear the program data space.
  790. help recount  <-- reset the default data type called count.
  791.  
  792.  
  793. #alloc (3.2.)  Allocate a certain number of data lines.
  794.  
  795.  
  796. When data is read from file, enough data lines are allocated
  797. automatically to contain the data. When computations have
  798. to be done without reading data (for instance for data
  799. generation using the default data type count), data lines
  800. can be obtained with alloc. The default integer variable
  801. ndata is set to the number of lines allocated.
  802.    An alternative way to allocate a number of data lines is
  803. to set the default variable ndata to the desired number. If you
  804. do that, the default variable count will not be recounted!
  805.  
  806. Syntax: alloc [number of lines]
  807. or:     ndata=[integer or integer variable]
  808.  
  809. Example:
  810.  
  811. prof> alloc 100
  812. prof> ndata
  813.       100
  814. prof> type kwadraat wortel $
  815. prof> kwadraat = count*count
  816. prof> wortel   = sqrt(count)
  817.  
  818. Or:
  819.  
  820. prof> ndata=200
  821.  
  822.  
  823. NOTE: if the default maximum number of data lines is not sufficient, a
  824. larger number can be obtained by invoking Profile with option -n (see
  825. help invoke). On the other hand, if there can not be declared a large
  826. enough number of data types due to memory shortage, it may be possible
  827. to reduce their default maximum length with option -n.
  828.  
  829.  
  830. #type (3.3.)  Declaration of a number of data types (columns).
  831.  
  832.  
  833. Before using a data type (column of data), it must be declared to
  834. profile with type.
  835.  
  836. Syntax:  type [data types] $
  837.                            ^
  838.                            |
  839.                            dollar indicates end of types.
  840.  
  841. Example:
  842.  
  843. prof> type va vb vc ia ib ic ra rb rc $
  844.  
  845. Values may be assigned to a data type by reading data from file
  846. (see also  help get), or by evaluating an expression (see also
  847. help expression) or by assigning values to the elements of the
  848. data type separately (see also  help assign).
  849.  
  850. The number of data lines is determined by the number of readable
  851. lines that were present in the input file, or that were allocated
  852. by the user (see also  help alloc).
  853. The maximum number of data lines in a data type, and therewith the maximum
  854. number of data types given a certain memory size, can be changed by using
  855. option -n (see also help invoke).
  856.  
  857. An overview of all user defined data types can be obtained by typing
  858.  
  859. prof> show types
  860.  
  861. Profile may refuse certain identifiers as type names. Most notably are
  862. identifiers starting with a digit, or identifiers already in use, as
  863. variables, data types, functions, command names or as recognized operating
  864. system commands (e.g. ls and vi on UNIX).
  865.  
  866.  
  867. #var (3.4.)  Declaration of a number of program variables.
  868.  
  869.  
  870. Program variables contain values that may be used in the evaluation
  871. of expressions with data types. They may also be used for
  872. computations that do not need data types.
  873.  
  874. Before using a variable, it must be declared to profile with var.
  875.  
  876. Profile knows both real and integer variables. They should be
  877. declared separately.
  878.  
  879. Syntax: var [variable kind] [variables] $
  880.                                         ^
  881.                                         |
  882.                                   dollar indicates and of variables
  883.  
  884. Example:
  885.  
  886. prof> var real vds id $
  887. prof> var int nvolt ncount $
  888.  
  889. Values may be assigned to variables by evaluating an expression:
  890.  
  891. prof> vds=0.1
  892.  
  893. A number of variables is present by default. See also  help defaults.
  894.  
  895. An overview of all user defined variables may be obtained by typing
  896.  
  897. prof> show vars
  898.  
  899. As with the decalartion of data types, not all identifiers are
  900. acceptable as a variable name. See help type.
  901.  
  902.  
  903. #assign (3.5.)  Give values to individual elements of data types.
  904.  
  905.  
  906. Assign makes it possible to approach the individual elements of the
  907. data array consisting of a data type.
  908.  
  909. Syntax: assign [data type name] [index nr.] [value] [...] $
  910.  
  911. Example:
  912.  
  913. prof> type x3 $
  914. prof> ndata=6
  915. prof> assign x3 2 3.7 4 3.9 6 4.1 $
  916.  
  917. This will result in
  918.  
  919.     x3     value
  920.   ------+--------
  921.    [1]     0.0
  922.    [2]     3.7
  923.    [3]     0.0
  924.    [4]     3.9
  925.    [5]     0.0
  926.    [6]     4.1
  927.  
  928.  
  929. #extract (3.5.)  Obtain the value of one data type element.
  930.  
  931.  
  932. Extract makes it possible to obtain the values of individual elements
  933. of the data array consisting of a data type. Extracted values are
  934. printed to the screen and may also be assigned to a real variable.
  935.  
  936. Syntax:
  937.  
  938. extract [data type name] [index nr.] [real variable name]   or
  939. extract [data type name] [index nr.] $                     (printing only)
  940.  
  941. Example:
  942.  
  943. prof> type array $
  944. prof> var real element $
  945. prof> ndata=10
  946. prof> array=count/2
  947. prof> extract array 4 element
  948.       array[4]=1.5
  949. prof> element
  950.       1.5
  951.  
  952.  
  953. #clear (3.6.)  Remove data from the data space.
  954.  
  955.  
  956. Clear removes all data read from file from the programs data space.
  957. However, it keeps all data type and variable declarations and
  958. also the current values of the variables. Definitions of
  959. expressions (see  help define) are maintained as well.
  960.  
  961. Example:
  962.  
  963. prof> clear
  964.  
  965.  
  966. #recount (3.7.)  Reset the default data type count.
  967.  
  968.  
  969. When data space is allocated, either by getting data from file
  970. (see help get) or by using the alloc keyword (see help alloc),
  971. automatically a data type named count, defined by default,
  972. is enumerated from 0 to ndata-1. After removing, reducing or
  973. sorting data, the enumeration in count will be garbled. Count
  974. can be enumerated again from 0 to the (new) ndata-1 by giving
  975. recount.
  976.  
  977. Syntax: recount
  978.  
  979. Example:
  980.  
  981. prof> recount
  982.  
  983. The default type count can be used to reorder data after sorting, but
  984. also for data generation (see help example2). Count is set by using
  985. the commands alloc or get to acquire data. Changing the default variable
  986. ndata does not affect count.
  987.  
  988.  
  989. #defaults (3.8.)  Data types and variables present by default.
  990.  
  991.  
  992. A number of data types are present immediately after the program
  993. has been invoked.
  994. They are called tmp1, tmp2, ... , tmp5 and may be used by either
  995. profile data manipulation commands or by the user in definitions
  996. of expressions as temporary storage of data. NOTE: the tmp types
  997. easily get corrupted by using commands such as diff or map!
  998. Another data type present by default is count. Count is enumerated
  999. 0 to ndata-1 when reading data from file (by using get) or when
  1000. allocating data space (by using alloc).
  1001. Count can be re-enumerated using the command recount.
  1002. The last default data type is weight. It is used by the polynomial
  1003. curve fitter fit, and also by the non-linear optimizer levmar, as a weight
  1004. function. Its default value is 1.0 for all elements.
  1005.  
  1006.  
  1007. A number of program variables are also default present. They are:
  1008.  
  1009.  
  1010.           +---------+---------+-------------------------------------+
  1011. integers: | name    |  value  |  meaning                            |
  1012.           +---------+---------+-------------------------------------+
  1013.           | ndata   |    0    |  number of data lines available     |
  1014.           | nsmooth |    1    |  order of moving average smoother.  |
  1015.           | npoly   |   12    |  highest order of polynomials       |
  1016.           |         |         |  in curve-fit for differentiation.  |
  1017.           | nfit    |  ndata  |  last data line used for curve-fit. |
  1018.           | wtype   |    0    |  kind of weight function in         |
  1019.           |         |         |  polynomial curve fit.              |
  1020.           | verbose |    1    |  fit talks (1) or is silent (0)     |
  1021.           | putprec |    6    |  significant digits in output file  |
  1022.           +---------+---------+-------------------------------------+
  1023.           | ticks   |    0    |  how many ticks in the 1D plot      |
  1024.           | line    |    1    |  lines are to be drawn in plot      |
  1025.           | marker  |    0    |  markers are to be drawn in plot    |
  1026.           | lstyle  |    0    |  solid lines (0) or different styles|
  1027.           | color   |    1    |  different pens (1) or all pen #1   |
  1028.           | asize   |    4    |  A3 or A4 papersize to be used      |
  1029.           | docadre |   10    |  Level of framework in the plot     |
  1030.           | pencadre|    1    |  Plotter pen used for framework     |
  1031.           | pendata |    8    |  Plotter pen for data (color=0)     |
  1032.           +---------+-+-------+-------------------------------------+
  1033.           | lprwidth  | 130   |  width of printer plot with graph   |
  1034.           | lprheight |  65   |  height of printer plot with graph  |
  1035.           +-----------+-------+-------------------------------------+
  1036.  
  1037.           +---------+-----------+-----------------------------------+
  1038. reals:    | name    |  value    |  meaning                          |
  1039.           +---------+-----------+-----------------------------------+
  1040.           | q       | 1.602E-19 |  magnitude of electronic charge.  |
  1041.           | eps0    | 8.854E-14 |  dielectric constant of vacuum.   |
  1042.           | epssi   | 11.9      |  relative eps of silicon.         |
  1043.           | epsox   | 3.4       |  relative eps of silicon-dioxide. |
  1044.           | k       | 1.381E-23 |  Boltzmann's constant.            |
  1045.           | ni      | 1.1e+10   |  intrinsic concentration T=300K.  |
  1046.           | pi      | 3.1415926 |  mathematic pi.                   |
  1047.           | e       | 2.71828   |  base of natural logarithm.       |
  1048.           | maxabb  | 0.05      |  maximal kept abberation in clip. |
  1049.           +---------+-----------+-----------------------------------+
  1050.           | xls     |   0.0     |  left x-axis scaling value (view) |
  1051.           | xrs     |   0.0     | right x-axis scaling value (view) |
  1052.           | yls     |   0.0     | lower y-axis scaling value (view) |
  1053.           | yus     |   0.0     | upper y-axis scaling value (view) |
  1054.           | ryls    |   0.0     | right y-axis scaling value (view) |
  1055.           | ryus    |   0.0     | right y-axis scaling value (view) |
  1056.           +---------+-----------+-----------------------------------+
  1057.           | xoffset |   0.0     | x-offset of data plot in cm       |
  1058.           | yoffset |   0.0     | y-offset of data plot in cm       |
  1059.           | xrelsize|   1.0     | relative size of plot in x-dir    |
  1060.           | yrelsize|   1.0     | relative size of plot in y-dir    |
  1061.           +---------+-----------+-----------------------------------+
  1062.  
  1063.  
  1064. #expression (4.1.) Evaluation of mathematical expressions.
  1065.  
  1066.  
  1067. Profile evaluates mathematical expressions that are typed to it.
  1068. These expressions may contain the following operands and operators:
  1069.  
  1070. 1. Constant values (such as 2.3, 1E17);
  1071. 2. Previously declared program variables (such as pi);
  1072. 3. Previously declared data types (columns of data) (such as tmp1);
  1073. 4. Previously defined expressions (see  help define);
  1074. 5. A number of mathematical functions (see  help functions)
  1075. 6. The following binary operators (with two arguments):
  1076.    * <- multiplication
  1077.    / <- division
  1078.    + <- addition
  1079.    - <- substraction
  1080.    ~ <- real power ( x~y = exp(y*ln(x)) )
  1081.    @ <- integer power ( x~n = x*x*x*x* ... )
  1082. 7. Left ('(') and righ (')') parentheses.
  1083.  
  1084. The preferent order of execution of binary operators is (by the
  1085. European convention): first ~,@, then *,/, then +,-. This preference
  1086. may be superseded by using parentheses.
  1087.  
  1088. The results of an expression may be either a data type or a program
  1089. variable. This difference is understood automatically by Profile.
  1090.  
  1091. Examples:
  1092.  
  1093. prof> 3-2/4    <--- this allows use of profile as a pocket calculator
  1094.       2.5
  1095. prof> pi       <--- pi is a program variable
  1096.       3.1415
  1097. prof> a        <--- a is a data type with four lines of data
  1098.       0
  1099.       2
  1100.       4
  1101.       8
  1102. prof> c=a*b    <--- data type c gets the value of a * b (for each line)
  1103.  
  1104. prof> c=ln(a/pi) <--- variables, functions and data types may be mixed
  1105.  
  1106. See also:
  1107.  
  1108. help define    <-- how to define and save an expression.
  1109. help functions <-- what mathematical functions are available.
  1110. help show      <-- get an overview of data types, variables
  1111.                    and definitions.
  1112.  
  1113.  
  1114.  
  1115. #define (4.2.)  Define an expression and save it for later use.
  1116.  
  1117.  
  1118. Profile allows the (hierarchical) definition of expressions
  1119. (see also  help expression) in the following manner.
  1120.  
  1121. Example:
  1122.  
  1123. prof> define teller=a*b*c
  1124. prof> define noemer=e*f*g
  1125. prof> define breuk=teller/noemer
  1126. prof> d=breuk
  1127.  
  1128. This define mechanism is especially helpful if an expression
  1129. has to be used many times in a measurement data processing program.
  1130. It also helps in saving temporary storage:
  1131.  
  1132. prof> tmp1=a_very_long_expression
  1133. prof> tmp2=a_even_longer_expression
  1134. prof> result=tmp1~tmp2
  1135.  
  1136. can be replaced by (also gaining clarity)
  1137.  
  1138. prof> define root=a_very_long_expression
  1139. prof> define power=an_even_longer_expression
  1140. prof> result=root~power
  1141.  
  1142. An overview of all expression definitions can be obtained
  1143. by typing
  1144.  
  1145. prof> show defines
  1146.  
  1147.  
  1148. #functions (4.3.)  Available mathematical functions.
  1149.  
  1150. The following functions of one argument may be used in expressions:
  1151.  
  1152. +----------+--------------------------------+
  1153. | name     | description                    |
  1154. +----------+--------------------------------+
  1155. | min      | complement: min(x) = -x        |
  1156. | inv      | inversion:  inv(x) = 1/x       |
  1157. | abs      | absolute value: abs(x) = |x|   |
  1158. | exp      | natural exponent               |
  1159. | ln       | natural logarithm              |
  1160. | log      | logarithm with base 10         |
  1161. | sqr      | square: sqr(x) = x*x           |
  1162. | sqrt     | square root                    |
  1163. | sin      | sine                           |
  1164. | cos      | cosine                         |
  1165. | tan      | tangent                        |
  1166. | arcsin   | inverse sine                   |
  1167. | arccos   | inverse cosine                 |
  1168. | arctan   | inverse tangent                |
  1169. | sinh     | hyperbolic sine                |
  1170. | cosh     | hyperbolic cosine              |
  1171. | tanh     | hyperbolic tangent             |
  1172. | erf      | error function                 |
  1173. | erfc     | complementary error function   |
  1174. | lngamma  | natural log of gamma function  |
  1175. | fac      | factorial (rounds to integers) |
  1176. | trunc    | truncation to integer number   |
  1177. | pos      | 1 if x > 0, otherwise zero     |
  1178. | neg      | 1 if x < 0, otherwise zero     |
  1179. | sgn      | 1 if x>0, 0 if x=0, -1 if x<0  |
  1180. | pls      | 1 if x = 0, otherwise 0        |
  1181. | zdiv     | 1 if x = 0, otherwise x        |
  1182. +----------+--------------------------------+
  1183.  
  1184. The following functions of two arguments were taken from Numerical Recipes
  1185. (The Art of Scientific Computing) by W.H. Press et al. (Cambridge UP):
  1186.  
  1187. +---------------+---------------------------------------+
  1188. | name          | description                           |
  1189. +---------------+---------------------------------------+
  1190. | pgamma (a,x)  | incomplete gamma function             |
  1191. | qgamma (a,x)  | 1 - pgamma(a,x)                       |
  1192. | poisson(k,x)  | cumulative Poisson distribution       |
  1193. | pchisq (c,n)  | chi-square distribution               |
  1194. | qchisq (c,n)  | 1 - pchisq(chi2,nu)                   |
  1195. | betaf  (x,y)  | F-distribution function               |
  1196. | student(t,v)  | Student distribution function         |
  1197. | bessj  (n,x)  | Bessel function J of order n          |
  1198. | bessy  (n,x)  | Bessel function Y of order n          |
  1199. | bessk  (n,x)  | Modified Bessel function K of order n |
  1200. | bessi  (n,x)  | Modified Bessel function I of order n |
  1201. +---------------+---------------------------------------+
  1202.  
  1203.  
  1204. #show (4.4.)  Give an overview of all declared variables and types.
  1205.  
  1206.  
  1207. The command show gives an overview of all user declared
  1208. data types or variables, or of all defined expressions.
  1209. Data types or variables present by default are not shown.
  1210. See also  help defaults.
  1211.  
  1212. Examples:
  1213.  
  1214. prof> show vars
  1215. prof> show types
  1216. prof> show defines
  1217.  
  1218.  
  1219. #do (5.1.)  Start a repetitive sequence.
  1220.  
  1221.  
  1222. Do can be used to tell Profile that all the commands following
  1223. do until the command od is found should be repeated n times.
  1224. It is a (rather primitive) way to implement iterative computations.
  1225. Do-od loops cannot be nested.
  1226.  
  1227. syntax: do [number of times]
  1228.  
  1229. example:
  1230.  
  1231. prof> b=starting_value_for_b
  1232. prof> do 5
  1233. prof> a=compute_a_from_b
  1234. prof> b=compute_b_from_a
  1235. prof> od
  1236. prof> print a b $
  1237.  
  1238.  
  1239. #od (5.1.)  End of a repetitive sequence.
  1240.  
  1241.  
  1242. Od is used in conjunction with do to mark a command sequence that
  1243. should be executed n-times.
  1244. See help do for an example.
  1245.  
  1246.  
  1247. #get (6.1.)  Read data types (columns of data) from a file.
  1248.  
  1249.  
  1250. Get is used to obtain the data that should be processed from a
  1251. file. It assumes the data to be organized columnwise.
  1252. Get ignores unreadable lines (such as headings) in these files.
  1253. A startmark (text strings occuring at the start of a line) and
  1254. endmark (idem) may be defined using the startmark and endmark
  1255. commands. If this is done, get starts reading after the first line
  1256. starting with the startmark, and stops reading directly after
  1257. the endmark.
  1258. If no start- or endmark are defined, get scans the whole file.
  1259. If the first non-empty line of the input file contains the names
  1260. of the data columns, these may be used as data type names.
  1261. The data type names that have been read are remembered and can be
  1262. used again by put, print and view (so-called last read types).
  1263.  
  1264. syntax:
  1265.  
  1266. get [data file] [data types] $
  1267.                              ^
  1268.                              |
  1269.                              indicates end of data types.
  1270.  
  1271. or, if the file contains a heading with columnnames:
  1272.  
  1273. get [data file] $
  1274.  
  1275.  
  1276. Example:
  1277.  
  1278. prof> get data.dat vg i didv c $
  1279.  
  1280. prof> get data.dat $
  1281.  
  1282.  
  1283. If there are more data lines in the file than the maximum number
  1284. of lines per data type, only the maximum number will be read. The
  1285. current maximum can be asked for by giving the command status. It is
  1286. possible to change the maximum number of lines per data type using the
  1287. program option -n (see help invoke). This allows for a tradeof between
  1288. the maximum number of types and the maximum number of lines.
  1289.  
  1290.  
  1291. #startmark (6.2.)  Define a starting marker for reading from file.
  1292.  
  1293.  
  1294. If a string is specified with startmark, the data reading command
  1295. get starts reading after the startmark string has occurred the
  1296. first time at the beginning of an input line. This input line itself
  1297. is not scanned.
  1298. The special startmark string bof (begin-of-file) indicates that
  1299. get should start reading at the first line of the file. Bof is
  1300. the default value of the starting marker.
  1301.  
  1302. Syntax: startmark [text string]
  1303.  
  1304. Example:
  1305.  
  1306. prof> startmark eerste_meting
  1307. prof> startmark bof
  1308.  
  1309.  
  1310. NOTE: once set, a startmark remains valid until it is reset by giving
  1311.       startmark bof.
  1312.  
  1313.  
  1314. #endmark (6.3.)  Define an ending marker for reading from file.
  1315.  
  1316.  
  1317. If a string is specified with endmark, the data reading command
  1318. get stops reading after the endmark string has occurred the
  1319. first time at the beginning of an input line. This input line
  1320. itself is not scanned.
  1321. The special endmark string eof (end-of-file) indicates that get
  1322. should read until the end of the input file. Eof is the default
  1323. value of the ending marker.
  1324.  
  1325. Syntax: endmark [text string]
  1326.  
  1327. Example:
  1328.  
  1329. prof> endmark tweede_meting
  1330. prof> endmark eof
  1331.  
  1332.  
  1333. NOTE: once set, an endmark remains valid until it is reset by giving
  1334.       endmark eof.
  1335.  
  1336.  
  1337. #put (6.4.)  Write data to a file.
  1338.  
  1339.  
  1340. Put writes the contents of named data types to a named file and
  1341. puts a heading with the names of the data types above the columns
  1342. of data.
  1343. The number of significant digits in the result is controlled by the
  1344. integer variable putprec. The default value is 6.
  1345. If the put command line ends in a dollar sign $, all data lines are
  1346. written to file. However, it is possible to select a range of lines
  1347. to be put by ending the command line in  | [line-nr] [line-nr].
  1348. If no data types are specified, put will write the data types last
  1349. read in (see also help get).
  1350.  
  1351. Syntax: put [output file] [data types] $
  1352.                                        ^
  1353.                                        |
  1354.                                      indicates end of data types.
  1355.  
  1356. or (for selecting a certain part of the data lines)
  1357.  
  1358.         put [output file] [data type names] | [start line nr] [end line nr]
  1359.  
  1360. or (for remembered last read data type names):
  1361.  
  1362.         put [output file] $
  1363. or      put [output file] | [start line nr] [end line nr]
  1364.  
  1365. Example:
  1366.  
  1367. prof> put data.out vg i dgdv ng $        : all lines
  1368. prof> put dat2.out vg i didv | 12 ndata  : between 12 and ndata
  1369.  
  1370. prof> var int half $
  1371. prof> half=ndata/2
  1372. prof> putprec=8                          : 8 significant digits
  1373. prof> put data.out $                     : all lines
  1374. prof> put dat2.out | half ndata          : only last half
  1375.  
  1376.  
  1377. #print (6.5.)  Print columns of data on the screen.
  1378.  
  1379.  
  1380. Print writes the contents of named data types to the screen, and
  1381. puts a heading with the names of the data types above the columns
  1382. of data.
  1383. If the print command line ends in a dollar sign $, all data lines are
  1384. written to the screen. However, it is possible to select a range of lines
  1385. to be printed by ending the command line in  | [line-nr] [line-nr].
  1386. If no data type names are given, the remembered names of the data
  1387. types last used will be printed.
  1388.  
  1389. Syntax: print [data types] $
  1390.                            ^
  1391.                            |
  1392.                          indicates end of data types.
  1393.  
  1394. or (for selecting part of the data lines)
  1395.  
  1396.         print [data types] | [first line nr] [last line nr]
  1397.  
  1398. Example:
  1399.  
  1400. prof> print vg i dgdv ng $      : all data lines are printed
  1401. prof> print vg i dgdv ng | 1 10 : only lines 1 to 10
  1402.  
  1403.  
  1404. prof> print $                   : last read data types are printed
  1405. prof> print | 50 ndata          : from line 50 to end
  1406.  
  1407.  
  1408. #putvar (6.6.)  Write variable values to file.
  1409.  
  1410.  
  1411. See also: help exec, help var, help levmar.
  1412.  
  1413. Syntax: putvar [file name] [real or integer variables] $
  1414.  
  1415. Putvar is used to write values of Profile real and integer variables
  1416. to file in a format such that they can be read again by Profile
  1417. using the exec command: 
  1418.  
  1419. [var1 name] = [var1 value]
  1420. [var2 name] = [var2 value]
  1421. ...           ...
  1422.  
  1423. This can be used to transfer data between two Profile programs, 
  1424. or to communicate variable values to another program, e.g. Prof2d. 
  1425. If an instance of Profile is used as a data conversion tool between 
  1426. the levmar optimization driver and an external program, it may also 
  1427. be used to write changed model parameters to the external program.
  1428.  
  1429. Example:
  1430.  
  1431. Profile program nr. 1:
  1432.  
  1433. prof> var real psi eps1 kappa gamma $
  1434. prof> var int  ngates nfields $
  1435. prof> ...
  1436. prof> putvar examvars.dat ngates psi eps1 nfields kappa gamma $
  1437.  
  1438. Profile program nr. 2:
  1439.  
  1440. prof> var real psi eps1 kappa gamma $
  1441. prof> var int  ngates nfields $
  1442. prof> exec examvars.dat                : read variable values
  1443.  
  1444.  
  1445. #view (7.1.)  Plot data types on video terminal or P.C. screens.
  1446.  
  1447.  
  1448. see also: help term.
  1449.  
  1450. View uses the (sometimes limited) graphical possibilities of video terminals
  1451. to draw a graph of one or more data types. The resolution of the obtained
  1452. pictures depends on the terminal type and is about 100*110 "pixels" on video
  1453. terminals which do not support graphics possibilities. This is enough to allow
  1454. previewing of plots to be made with the command plot.
  1455.  
  1456. Profile knows several terminal communication protocols, one of which may
  1457. be chosen by using the command term. An overview of the available types
  1458. can be found on the term manual page.
  1459.  
  1460. If no data type names are specified, the remembered names of the data
  1461. types last read will be used, with the first type as x-type (see help get).
  1462. Data types can be plotted on one y-axis (on the left side) or two
  1463. y-axes (on the left and right side). Both are scaled independently.
  1464. View provides both autoscaling facilities and forced scales. Scales can
  1465. be forced using the predefined real variables
  1466.  
  1467.   xls <-- extreme left value of x-axis
  1468.   xrs <-- extreme right value of x-axis
  1469.   yls <-- extreme lower value of left y-axis
  1470.   yus <-- extreme upper value of left y-axis
  1471.  ryls <-- extreme lower value of right y-axis
  1472.  ryus <-- extreme upper value of right y-axis
  1473.  
  1474. Autoscaling is presumed if xls >= xrs, etc. This is the default
  1475. situation. A grid is drawn in the graph if the predefined integer
  1476. variable gridon is set to 1.
  1477.  
  1478. Syntax: view [x-axis data type] [left y-axis data types] |
  1479.              [right y-axis data types] $
  1480.  
  1481. Examples:
  1482.  
  1483. prof> type x y1 y2 y3 y4 $
  1484.       .
  1485.       .
  1486.       .
  1487. prof> view x y1 y2 | y3 y4 $   : both left and right y-axes
  1488. prof> view x y1 $              : only the left y-axis
  1489. prof> xls=0.0                  : \
  1490. prof> xrs=10.0                 :  | limit the
  1491. prof> yls=-1.5                 :  | displayed area
  1492. prof> yus=11.5                 : /
  1493. prof> !view                    : repeat last view
  1494.  
  1495. prof> view $                   : view last read data types
  1496.  
  1497.  
  1498. #graph (7.2.)  make a graph to be printed on one line printer sheet.
  1499.  
  1500.  
  1501. See also: help view.
  1502.  
  1503. Graph operates in a fashion quite similar to view, except that the
  1504. resultant plot is composed of printable characters and can be printed
  1505. on exactly one standard page of the line printer.
  1506. The usual practice will be to preview a graph with view and than obtain a
  1507. hardcopy with plot or graph.
  1508. Graph is especially useful for those who desire hardcopy of their graph
  1509. but do not have available a HP-GL penplotter (see help plot).
  1510.  
  1511. On UNIX systems, the graphical information is written to the terminal
  1512. and can be caught in a file by standard UNIX shell redirect
  1513. (prof in non-interactive mode). It will be preceded and followed by
  1514. a Form-Feed character (ASCII decimal 12), thus simplifying alignment
  1515. on the line printer.
  1516.  
  1517. On MS-DOS PCs, the output is printed on a printer connected to the
  1518. parallel port #1 (LPT1). Form-Feeds are not used.
  1519.  
  1520. In addition to view, it is possible to specify a title to be printed
  1521. above the graph.
  1522.  
  1523. The size of the graph can be chosen using the default integer variables
  1524. lprwidth and lprheight. These are defaulted to a big one page (130*65)
  1525. graph (see also help defaults).
  1526.  
  1527.  
  1528. Syntax: graph [x-axis data type] [left y-axis data types] |
  1529.               [right y-axis data types] $ title-text
  1530.  
  1531. Example (on UNIX systems):
  1532.  
  1533. In file graph.pro :
  1534.  
  1535. lprwidth=100
  1536. lprheight=40
  1537. graph x y1 y2 | y3 y4 $ this a plot of y1, y2, y3 and y4
  1538.  
  1539. or:
  1540.  
  1541. graph $                 : last read data types
  1542.  
  1543. UNIX C-Shell prompt % profile graph.pro > lpr.out
  1544. UNIX C-Shell prompt % lpr lpr.out
  1545.  
  1546.  
  1547. #plot (7.3.)  plot data on an HP-GL compatible penplotter.
  1548.  
  1549.  
  1550. See also: help view, help graph, help setplot, help defaults.
  1551.           The installation manual page.
  1552.  
  1553. Syntax: 
  1554.  
  1555. plot [x-axis] [left y-types] | [right y-types] $ comm1 | comm2 | comm3
  1556.  
  1557.  
  1558. Plot is the profile facility for making a hardcopy of what you see on
  1559. the screen when using view. All the features mentioned for view are also
  1560. available with plot. Obviously, plot offers a much better resolution for
  1561. the data to be plotted and also some extra features. These are regulated
  1562. by the following predefined integer variables:
  1563.  
  1564.  - line     (if 0 <- No lines are drawn, otherwise lines)
  1565.  - marker   (if 0 <- No markers are drawn, otherwise markers)
  1566.  - lstyle   (if 0 <- All lines are solid, otherwise different styles)
  1567.  - color    (if 0 <- All plotted with pen 1, otherwise all pens)
  1568.  - asize    (Chosen papersize. asize=4 <- A4, asize=3 <- A3)
  1569.  - ticks    (2 for 9 ticks, 1 for 1 tick and 0 for none)
  1570.  
  1571. The default setting is a colored plot in solid lines without markers.
  1572. It is also possible to specify exactly for each data type how it should
  1573. be plotted. This is done by the separate command setplot (see
  1574. help setplot).
  1575. The syntax is identical to that of view and graph. A title of the
  1576. plot (as in graph) may be specified and will be plotted.
  1577.  
  1578. For presentation graphics, it is possible to influence the plot's
  1579. appearance and size by using the following predefined variables:
  1580.  
  1581.  - docadre  (10 -> plot all, 5 no outer framework, 0 no text at all)
  1582.  - pencadre (pen number to plot the outer and graph frameworks)
  1583.  - pendata  (pen number to plot data if color=0)
  1584.  - xoffset  (shift in cm of the plot in the x-direction)
  1585.  - yoffset  (shift in cm of the plot in the y-direction)
  1586.  - xrelsize (relative size of the plot in the x-direction, normal = 1.0)
  1587.  - yrelsize (relative size of the plot in the y-direction, normal = 1.0)
  1588.  
  1589. To get a plot on a terminal system, the plotter can be in between
  1590. the terminal and the computer and must operate in eavesdrop mode with
  1591. xon/xoff handshaking. Also, with the plotfile command a plotter 
  1592. accessable as file in the file system can be selected.
  1593. On the IBM-PC, the plotter must be connected to the RS232 COM1 serial 
  1594. data output and operate in standalone mode with hardwired handshaking.
  1595.  
  1596. The plot description (in HP-GL language) can be caught in a file
  1597. instead of sent to the plotter with the plotfile command.
  1598.  
  1599. Consult the installation manual page for more information and for the
  1600. correct plotter settings.
  1601.  
  1602.  
  1603. #setplot (7.4.)  Set plotting style per data type separately.
  1604.  
  1605.  
  1606. Setplot can be used together with the plot command to
  1607. choose for each data type that is to be plotted on the HP-GL
  1608. plotter what plotting style is to be used. A setplot definition
  1609. completely overrules the choices made with the predefined variables
  1610. line, lstyle and color.
  1611.  
  1612. Syntax: setplot [pennr][lstyle][marker] [...] | [...] $
  1613.         setplot $
  1614.  
  1615. The following attributes may be specified:
  1616.  
  1617. 1. pen number - defines which pen must be taken to plot this
  1618.                 data type (and thus which color will be used).
  1619. 2. line style - defines which line style must be used.
  1620.                 Available line styles are:
  1621.  
  1622.                 0 - no line is to be drawn
  1623.                 1 - solid line: ________________________________
  1624.                 2 - like this:  ____     ____     ____     ____
  1625.                 3 -             ______   ______   ______   _____
  1626.                 4 -             ______ . ______ . ______ . _____
  1627.                 5 -             ______ _ ______ _ ______ _ _____
  1628.                 6 -             ____ _ _ ____ _ _ ____ _ _ ____ _
  1629.  
  1630. 3. marker     - defines what marker must be used. 0 indicates no
  1631.                 marker, 1-10 makes a choice out of:
  1632.  
  1633.                   1 - box         6 - octogon
  1634.                   2 - circle      7 - asterisk
  1635.                   3 - diamond     8 - triangle up
  1636.                   4 - plus        9 - triangle down
  1637.                   5 - times      10 - circle with plus
  1638.  
  1639. For each data type to be plotted, all three attributes are
  1640. specified by three integer number in one string. Left and right
  1641. data types are separated by |, as with view/plot itself. If only a
  1642. $ ending symbol is given, previous setplot settings are defaulted
  1643. and the line/lstyle/color variables regain control. If more data
  1644. types are plotted than specified, the non-specified ones get a
  1645. default specification 110.
  1646.  
  1647. Example:
  1648.  
  1649. prof> setplot 110 210 310 410 | 121 131 141 151 $
  1650. prof> plot x y1 y2 y3 y4 | z1 z2 z3 z4 $ demonstration setplot
  1651. prof> setplot $
  1652. prof> color=1
  1653. prof> lstyle=0
  1654. prof> plot x y1 y2 y3 y4 $
  1655.  
  1656.  
  1657. #term (7.5.)  Select a video terminal protocol.
  1658.  
  1659.  
  1660. See also: help adapt (IBM-PC only).
  1661.  
  1662. Syntax: term [term-type]
  1663. or      term ?             to ask the current terminal type,
  1664.                            and a list of available types.
  1665. Example:
  1666.  
  1667. prof> term vt100
  1668. prof> term ?
  1669.  
  1670.  
  1671. The following device protocols for displaying graphs are available:
  1672.  
  1673. dialup  : Plain 80*24 character terminal screen. 
  1674. vt52    : DEC vt52 protocol (uses graphics charcters). 
  1675. vt100   : DEC vt100 or ANSI protocol (uses graphics charcters). 
  1676. vt200   : Reduces to vt100 protocol.
  1677. cit224  : Reduces to vt100 protocol.
  1678. vt102   : Equals vt100 but limited to 80 characters width.
  1679. cit101  : C. Itoh cit101 terminal protocol (special graphics charcters). 
  1680. tek4010 : Tek4010 graphics protocol for Tek 4010 compatible terminals.
  1681. mskermit: Uses the Tek4010 mode of the MS-Kermit terminal emulator.
  1682.           Automatic switching between vt102 and Tek4010 emulation.
  1683. xterm   : Tek4010 emulation of the X-Windows xterm terminal emulator.
  1684. vt240   : Tek4010 emulation of the DEC vt240 terminal.
  1685. vt340   : Tek4010 emulation of the DEC vt340 terminal.
  1686.  
  1687. hp98550 : To be used on the console of the HP9000-350 workstation with
  1688.           HP98550 graphics card. Invokes separate Starbase Tek emulator.
  1689.  
  1690. apollo  : Uses GDL graphics on the Apollo Domain workstations.
  1691.  
  1692. ibmpc   : Produces a graph on the IBM-PC. The resolution of this graph
  1693.           depends on the Video Adaptor Card present. This card is sensed
  1694.           automatically but may be set by the command adapt.
  1695.  
  1696. atari   : 640x400 proprietary Atari ST graphics.
  1697.  
  1698. local   : Locally implemented graphics device driver in file local.c
  1699.           (see the Profile/Prof2d System Programmers Manual section 2.4).
  1700.  
  1701. On UNIX systems, Profile asks the system shell what the current terminal
  1702. type is and uses that type as a default. This default can be changed with
  1703. term within profile or with setenv profterm [term-type] in the C-Shell.
  1704.  
  1705. Only on mainframes (UNIX, VAX/VMS) all terminal types are supported;
  1706. on Personal Computers and workstations, the appropriate type is default.
  1707.  
  1708.  
  1709. #adapt (7.6.)  Select an IBM-PC Video Adaptor Card (Graphics).
  1710.  
  1711.  
  1712. Syntax: adapt [adaptor name]  <- set adaptor card type
  1713.         adapt ?               <- print current and possible adaptors
  1714.  
  1715.  
  1716. Profile automatically senses what Video Adaptor Card is present in your
  1717. IBM-PC or compatible. The following adaptors are recognized:
  1718.  
  1719. Color Graphics Adaptor (CGA)    <- 640 x 200 resolution    (mode 06H)
  1720. Compaq Graphics Adaptor         <- Will be treated as CGA
  1721. Enhanced Graphics Adaptor (EGA) <- 640 x 350 resolution    (mode 10H)
  1722. Olivetti/AT&T 6300 Adaptor      <- 640 x 400 resolution    (mode 40H)
  1723. VGA graphics adaptor            <- 640 x 480 resolution    (mode 12H)
  1724. Super VGA adaptor (HPVGA)       <- 800 x 600 reoslution    (mode 58H)
  1725. Hercules Monochrome Adaptor     <- 720 x 348 resolution
  1726. Apparently no Graphics Adaptor  <- Character Graphics (75 x 100)
  1727.  
  1728. If unexpectedly Profile senses the WRONG video adaptor, you may set one of
  1729. the above choices using the new Profile command adapt. Giving
  1730.  
  1731. prof> adapt ?
  1732.  
  1733. will provide you with a list of all adaptors. Be sure to type the adaptor
  1734. name exactly correct (capitals!).
  1735.  
  1736. Hardcopy of a graph on the screen may be obtained by typing
  1737.  
  1738. <shift><PrtSc>.
  1739.  
  1740. Be sure that the printer is switched on and on line, and be sure to
  1741. execute the MS-DOS program GRAPHICS before invoking Profile. It is
  1742. preferred to put a call to graphics in your autoexec.bat file.
  1743.  
  1744.  
  1745. #plotfile (7.7.) Specify an output file for (HP-GL) plotter data
  1746.  
  1747.  
  1748. Syntax: plotfile [filename]
  1749.         plotfile $            <- Reset to default state
  1750.  
  1751. Examples:
  1752.  
  1753. prof> plotfile hpgl.dat
  1754. prof> plotfile /dev/plotter
  1755. prof> plotfile $
  1756.  
  1757.  
  1758. By default, HP-GL plot descriptions are sent to the terminal or
  1759. to the RS232 interface of the IBM-PC. Using the command plotfile
  1760. however makes it possible to store the plot description in a
  1761. named file. In this way the plotting can be performed later, or
  1762. the plot description can be saved.
  1763.  
  1764. The defined plotfile remains valid and will be overwritten until
  1765. a new one is defined or the default situation is restored (use $).
  1766.  
  1767. On UNIX systems, it may also be attractive to send the HP-GL data
  1768. stream to a plotter device present as a virtual file in the file
  1769. system. This file can be named using plotfile.
  1770.  
  1771. Note for system programmers: it is possible to change the
  1772. default plot destination in the source code.
  1773.  
  1774.  
  1775. #viewfile (7.7.) Specify an output file for graphical screen data
  1776.  
  1777.  
  1778. Syntax: viewfile [filename]
  1779.  
  1780. Examples:
  1781.  
  1782. prof> term tek4010
  1783. prof> viewfile tek4010.dat
  1784. prof> view x y z $
  1785.  
  1786.  
  1787. Viewfile can be used to catch the graphical description of a screen
  1788. image in a file. The nature of the description depends on the terminal
  1789. type selected with the command term. The definition of the viewfile
  1790. is only used once, afterwards the output is sent to the screen again.
  1791.  
  1792. Viewfile is especially useful to save a TEK4010 graphical image
  1793. description for later printing on a Laser printer that has a TEK4010
  1794. emulation mode. An example of such a printer is the LPS40 installed
  1795. at the DARF facilities of the Faculty of Electrical Engineering,
  1796. Delft University of Technology. This printer can be reached on the
  1797. VAX 11/750 with network name TUDEDV.
  1798.  
  1799.  
  1800. #sort (8.1.)  Sort the data lines to a data type.
  1801.  
  1802.  
  1803. Sort shuffles the data lines (for all present data types)
  1804. in such a way that a named data type becomes sorted (from
  1805. small to large).
  1806. Often you will want to sort the default type count.
  1807.  
  1808. Syntax: sort [data type]
  1809.  
  1810. Examples:
  1811.  
  1812. prof> sort vg
  1813. prof> : sort in reverse order
  1814. prof> vg = min(vg)
  1815. prof> sort vg
  1816. prof> vg = min(vg)
  1817.  
  1818. To restore the previous order of the lines, use data type count:
  1819.  
  1820. prof> sort count
  1821.  
  1822.  
  1823. #remove (8.2.)  Remove a given number of data lines.
  1824.  
  1825.  
  1826. Removes the data lines between to given boundaries.
  1827. The boundary $ is understood to be the last data line.
  1828.  
  1829. Syntax: remove [n1 n2]
  1830.  
  1831. Examples:
  1832.  
  1833. prof> remove 12 14
  1834. prof> remove 100 $
  1835. prof> remove 1 1    : <--- removes line #1 only.
  1836. prof> remove n1 n2  : <--- use integer variables.
  1837.  
  1838.  
  1839. #reduce (8.3.)  Remove data lines at regular intervals.
  1840.  
  1841.  
  1842. Reduce n deletes from every n data lines the last n-1.
  1843. Reduce is especially useful to 'thin' data on which
  1844. numerical differentiation is difficult because of too small
  1845. intervals dx.
  1846.  
  1847. Syntax:
  1848.  
  1849. reduce [n]
  1850.  
  1851. Example:
  1852.  
  1853. prof> reduce 10
  1854. prof> reduce nreduct
  1855.  
  1856.  
  1857. #insert (8.4.)  Insert empty data lines below a certain line.
  1858.  
  1859.  
  1860. Insert inserts a given number of lines containing value 0.0 below
  1861. a given line. It can be used to reshape data to a form e.g. more
  1862. useful to do a curvefit or a comparison with other data.
  1863.  
  1864. Syntax:
  1865.  
  1866. insert [below-line-nr] [nr-of-lines]
  1867.  
  1868. Examples:
  1869.  
  1870. prof> ndata
  1871.       25
  1872. prof> insert 2 7
  1873.       Number of data elements set to 32.
  1874.  
  1875. prof> insert nbelow ninsert : <-- use integer variables
  1876.  
  1877.  
  1878. #smooth (8.5.)  Make data smooth with a moving average filter.
  1879.  
  1880.  
  1881. Smooth applies a moving average filter to a given data
  1882. type. The order of this filter is given by the default variable
  1883. nsmooth. At the edges of the data type, the smoothing order
  1884. is asymmetrically reduced.
  1885.  
  1886. Syntax: smooth [data type]
  1887.  
  1888. Example:
  1889.  
  1890. prof> nsmooth=3
  1891. prof> smooth didv
  1892.  
  1893.  
  1894. #mono (8.6.)  Make a data type (column of data) completely monotonous.
  1895.  
  1896.  
  1897. Mono removes noise from data by making a data type
  1898. completely monotonous. The first data element is
  1899. compared with the last to determine if the type is
  1900. ascending or descending. Plain linear interpolation
  1901. is used.
  1902.  
  1903. Syntax: mono [data type]
  1904.  
  1905. Example: prof> mono dgdv
  1906.  
  1907.  
  1908. #clip (8.7.)  Remove noise peaks by linear interpolation.
  1909.  
  1910.  
  1911. Clip removes data points that are abberant more than a certain
  1912. relative value (maintained in the real constant maxabb)
  1913. from the average of their neighbours. It is then replaced
  1914. by exactly this average.
  1915. Clip can be used to remove strange peaks from data (caused
  1916. by electrical disturbances etc.)
  1917.  
  1918. Syntax: clip [data type]
  1919.  
  1920. Example: prof> maxabb=0.02
  1921.          prof> clip noisy_data
  1922.  
  1923.  
  1924. #polar (8.8.)  Convert rectangular to polar coordinates.
  1925.  
  1926.  
  1927. The command polar converts the contents of two data types that describe
  1928. a two-dimensional or a complex quantity in rectangular coordinates to
  1929. two data types representing the same quantity in polar coordinates, or
  1930.  
  1931.      (x,y) -> (r,phi)
  1932.  
  1933. by   r = sqrt(x**2 + y**2)  and  phi = arctan(y/x).
  1934.  
  1935. If x=0 and y!=0, phi is set to either pi/2 or -pi/2, depending
  1936. on the sign of y. If both x and y are 0, phi is set to 0 as well.
  1937.  
  1938. Syntax: polar [x-type] [y-type] [r-type] [phi-type]
  1939.  
  1940. Example: prof> type time real imag amplitude phase $ : declare types
  1941.          prof> get data.data time real imag $        : read complex data
  1942.          prof> polar real imag amplitude phase       : convert
  1943.          prof> view time amplitude | phase $         : show data
  1944.  
  1945.  
  1946.  
  1947. #rect (8.8.)  Convert rectangular to polar coordinates.
  1948.  
  1949.  
  1950. The command rect converts the contents of two data types that describe
  1951. a two-dimensional or a complex quantity in polar coordinates to two data
  1952. types representing the same quantity in rectangular coordinates, or
  1953.  
  1954.     (r,phi) ->  (x,y)
  1955.  
  1956. by   x = r*cos(phi)  and  y = r*sin(phi).
  1957.  
  1958. Syntax: rect [r-type] [phi-type] [x-type] [y-type]
  1959.  
  1960. Example: prof> type time real imag amplitude phase $ : declare types
  1961.          prof> ndata=100                             : \
  1962.          prof> time=count/(ndata-1)                  :  | data
  1963.          prof> amplitude = 4*exp(-time/1.23)         :  | generation
  1964.          prof> phase=time*2*pi                       : /
  1965.          prof> rect amplitude phase real imag        : convert
  1966.          prof> view time real imag $                 : show data
  1967.  
  1968.  
  1969. #fit (9.1.)  Do a polynomial curve-fit on measurement data.
  1970.  
  1971.  
  1972. The command fit allows you to fit a recursively defined
  1973. polynomial to measured or otherwise generated data. The method used
  1974. was developed by Ralston (see reference) and is quite reliable.
  1975. It minimizes the sum of the squared errors between the fitted and the
  1976. measured data. A weight function for the sum of errors can be used.
  1977. It operates correctly on unequally spaced x-axis data.
  1978.  
  1979. The best fits are obtained if you first do a coordinate-transformation
  1980. that makes your data look as much as possible like a straight line
  1981. (i.e. y=ax+b.) Often a physical model is present that allows this.
  1982. In the example (below) such a coordinate transformation is decribed.
  1983.  
  1984. It may be desired to give a different weight to the data element
  1985. values. This is possible through default variable wtype and the default
  1986. data type weight. The latter is initiated to 1.0 for all elements.
  1987. As a weight function value w[i] the absolute value of weight[i]
  1988. will be used (see also below).
  1989.  
  1990. As the Ralston polynomials (and their derivatives) are computed
  1991. recursively, the polynomial coefficients are not explicitly known.
  1992. This version of profile does not compute them.
  1993.  
  1994. After the fitting process, data types tmp1-tmp4 will contain the
  1995. following information:
  1996.  
  1997. tmp1 - the first analytical derivative of the fitted polynomial
  1998. tmp2 - the second analytical derivative of the fitted polynomial
  1999. tmp3 - the numerical values of the weight function used
  2000. tmp4 - the numerical values of the fitted polynomial itself
  2001.  
  2002. Several default variables are available to control the fitting:
  2003.  
  2004.   - The maximal order of the Ralston polynomials
  2005.     is given by the variable npoly.
  2006.     If you choose npoly=1, linear regression is effected.
  2007.   - The weight function of the squared errors is
  2008.     chosen by the variable wtype:
  2009.     wtype = 0: w(x) = absolute value of data type weight(x)
  2010.                       (defaulted to 1.0);
  2011.     wtype = 1: w(x) = (2*max(|y|) - |y|)/max(|y|);
  2012.     wtype = 2: w(x) = min(|y|)/|y|.
  2013.     The last two weight functions favour the accuracy
  2014.     of the fit on smaller data values. A user-defined weight
  2015.     function may be computed and put in data type weight.
  2016.   - The variable nfit sets the last data element that
  2017.     used in the fit. It may be used to exclude bad elements
  2018.     in data tails from fitting without throwing them away.
  2019.   - The variable verbose lets fit talk to you (if verbose > 0)
  2020.     or be silent (verbose=0). If fit talks, it will give you
  2021.     a performance indicator in the form of the fitting variance.
  2022.     If the variance starts to increase (ratio > 1), the optimal
  2023.     fitting order has been reached (in rough approximation).
  2024.  
  2025.  
  2026. Syntax:
  2027.  
  2028. fit [y data type] [x data type] [fitted y data type]
  2029.  
  2030. Example:
  2031.  
  2032. A fit is made on measured C(V) data. It is known from theory
  2033. that the C(V) curve behaves approximately as
  2034.  
  2035. C(V) = K/sqrt(V-Vbi).
  2036.  
  2037. In fact it are the deviations from this ideal formula that attracts
  2038. our interest. We will first do a coordinate transformation, then choose a
  2039. suitable weight function, perform the curve fit and transform back.
  2040.  
  2041. prof> type c v x y cfit yfit dcdv $
  2042. prof> var real vbi $
  2043. prof> get cv.dat v c $
  2044. prof> vbi=0.8
  2045. prof> x=sqrt(v-vbi)
  2046. prof> y=1/c
  2047. prof> weight=sqrt(y)
  2048. prof> wtype=0
  2049. prof> fit y x yfit
  2050. prof> cfit=1/yfit
  2051. prof> diff num cfit v dcdv
  2052. prof> view v c cfit | dcdv $
  2053.  
  2054. Reference: Anthony Ralston, A first course in Numerical Analysis,
  2055.            McGraw-Hill, New York 1965, pp. 235-243.
  2056.  
  2057.  
  2058. #diff (9.2.)  Differentiate by subtraction or by curve-fit.
  2059.  
  2060.  
  2061. Diff computes the derivative of data type <y> with respect
  2062. to data type <x> and stores the result in data type <dydx>.
  2063.  
  2064. Two methods of differentiation are available:
  2065.  
  2066.  1. Numerical, by subtraction.
  2067.     A symmetrical difference formula is used:
  2068.      dydx(i) =[y(i+1)-y(i-1)]/[y(i+1)-y(i-1)],
  2069.     except at the edges where forward (i=0) resp. backward
  2070.     (i=ndata) differences are taken.
  2071.     If the measurement accuracy of your data is not very high,
  2072.     or if the data are distorted by noise, previous smoothing
  2073.     is highly recommended. See also help smooth.
  2074.  
  2075.  2. By polynomial curve-fit.
  2076.     Differentiation is also possible by fitting a
  2077.     polynomial to the data, and computing analytically
  2078.     the 1st (and even 2nd) derivative of this polynomial.
  2079.     Due to the curve-fitting, this method smoothes itself.
  2080.     A polynomial curve-fit differentiation method is
  2081.     provided with the help of the Ralston polynomials
  2082.     fitter that is described in detail under help fit.
  2083.     All default data types and variables that are used
  2084.     for fit can also be used here.
  2085.  
  2086. Experience has shown, that the best way to differentiate
  2087. measurement data is the following procedure:
  2088.  
  2089. a. first fit a data type to your data using fit;
  2090. b. then differentiate the fitted result numerically
  2091.    using diff num.
  2092.  
  2093. Syntax: diff [method] [ytype] [xtype] [dydxtype]
  2094.  
  2095. Example: prof> diff fit i vg didv
  2096.          prof> diff num ifit vg didv
  2097.  
  2098.  
  2099. #inte (9.3.)  Perform numerical integration by Trapezium Rule.
  2100.  
  2101.  
  2102. Inte asks for the data type which represents x, the data
  2103. type which represents y, and the data type that has
  2104. to contain the integral over all the data lines of ydx.
  2105. Then it computes this integral with the trapezium rule, or
  2106.  
  2107.            x
  2108.           /
  2109. ydxtype = | ydx'
  2110.           /
  2111.          0
  2112.  
  2113. The starting value of y is considered to be zero.
  2114. It can be added to y separately, if desired.
  2115.  
  2116. Syntax: inte [y type] [x type] [ydx type]
  2117.  
  2118. Example:
  2119.  
  2120. prof> type rho xe charge $
  2121. ...
  2122. prof> inte rho xe charge
  2123. prof> charge = charge + start_charge
  2124.  
  2125.  
  2126. #sum (9.4.)  Perform summation of a data type's element values.
  2127.  
  2128.  
  2129. Sum computes the cumulative sum of the contents of a data type
  2130. for all the lines of the data space. It asks for the data type that must
  2131. be summed, and for the data type that must contain the result.
  2132. The final sum may be obtained by assigning the result data type to
  2133. a real variable (the last data element is then used).
  2134.  
  2135. Syntax: sum [data type] [result data type]
  2136.  
  2137. Example:
  2138.  
  2139. prof> type money cumusum $
  2140. prof> var  real treasure $
  2141. ...
  2142. prof> sum money cumusum
  2143. prof> treasure=cumusum
  2144.  
  2145.  
  2146. #compare (9.5.)  Make a squared difference comparison.
  2147.  
  2148.  
  2149. Compare makes a squared differences comparison between two
  2150. data types. The absolute value of the sum of differences
  2151. is printed. The sum of the differences relative to the
  2152. data type named secondly is also printed.
  2153. Compare may be useful to study the effect of an iterative
  2154. process on a data type.
  2155.  
  2156. Absolute difference: sum(sqr(y1(i)-y2(i)))
  2157. Relative difference: sum(sqr(y1(i)-y2(i)))/sum(sqr(y2))
  2158.  
  2159. Syntax: compare <type1> <type2>
  2160.  
  2161. Example: prof> compare didv tmp5
  2162.  
  2163.  
  2164. #map (9.6.)  Map data from an existing x-axis to another one.
  2165.  
  2166.  
  2167. Map can be used for transferring an (x,y) set of data types to
  2168. another set (x',y') by linear interpolation. This can be useful for
  2169.  
  2170.  - Simultaneously processing data that have been acquired separately
  2171.    and thus are given as a function of different x-axes;
  2172.  - Zooming in (or out) on data or a piece of data, e.g. for more
  2173.    accurate determination of the x-value for which two y data types
  2174.    are equal.
  2175.  
  2176. Map allows the x-axes to be of different size (expressed in number
  2177. of data lines) and to run in opposite directions. The two x-axes
  2178. need not fully coincide. If the mapping x-axis exceeds the
  2179. existing x-axis, the first or the last existing y-value will be
  2180. used to expand the mapping y-axis. If the existing x-axis exceeds the
  2181. mapping x-axis, only the appropriate part is mapped.
  2182.  
  2183. Syntax:
  2184.  
  2185. map [existing x] [existing y] [nr of lines] [map x] [map y] [nr of lines]
  2186.  
  2187. Example:
  2188.  
  2189. Two files are read with equivalent data on different x-axes. The
  2190. information from the second file is mapped to the x-axis of the first
  2191. file.
  2192.  
  2193. prof> type x1 x2 y1 y2 y2map $
  2194. prof> var int n1 n2 $
  2195. prof> get file1 x1 y1 $
  2196. prof> n1=ndata
  2197. prof> get file2 x2 y2 $
  2198. prof> n2=ndata
  2199. prof> map x2 y2 n2 x1 y2map n1
  2200. prof> ndata=n1
  2201. prof> view x1 y1 y2map $
  2202.  
  2203.  
  2204. #minmax (9.7.)  Determine extremes of a data type.
  2205.  
  2206.  
  2207. Minmax determines the minimum and maximum values of the data array
  2208. that is represented by a data type. The values are printed to the
  2209. screen and may also be assigned to (previously declared) real variables.
  2210.  
  2211. Syntax:
  2212.  
  2213. minmax [data type name] [minimum real variable] [maximum real variable]
  2214. minmax [data type name] $    : printing only
  2215.  
  2216. Example:
  2217.  
  2218. prof> type data $
  2219. prof> get file.dat data $
  2220.       25 lines.
  2221. prof> var real minval maxval $
  2222. prof> minmax data minval maxval
  2223.       Minimum data(7)=-3.2211, maximum data(15)=12.3412.
  2224. prof> minval
  2225.       -3.2211
  2226.  
  2227.  
  2228. #poisson (9.8) - Solve Poisson's equation in a Schottky diode.
  2229.  
  2230. As an example of how to add a proprietary command to Profile with
  2231. the <extra> mechanism, a Poisson solver for a reversed biased 
  2232. Schottky diode was implemented. It is NOT available on the IBM-PC
  2233. unless by recompilation!
  2234.  
  2235. Syntax:
  2236.  
  2237. extra poisson x dope elec psi vbi vbias emax temp eps miter 
  2238.  
  2239. Here, <poisson> is called through <extra> because the extra command
  2240. was used to link the code of the Poisson solver to Profile. This is
  2241. described in section 2.1 of the Profile/Prof2d System Programmers 
  2242. Manual. The arguments have the following meaning:
  2243.  
  2244. type x          : one-dimensional x-axis in the diode in cm
  2245. type dope       : doping concentration in cm-3 (n-type assumed)
  2246. type elec       : electron concentration (to be computed) in cm-3
  2247. type psi        : electrostatic potential (to be computed) in Volt
  2248.  
  2249. var real vbi    : built-in voltage of the Schottky contact in Volt
  2250. var real vbias  : currently applied bias voltage in Volt
  2251. var real emax   : maximally tolerable electric field in V/cm
  2252. var real temp   : absolute temperature in Kelvin
  2253.  
  2254. var real eps    : acceptable error in potential solution in Volt
  2255. var int  miter  : maximum number of Poisson solution iterations
  2256.  
  2257. An example application, the simulation of a Capacitance-Voltage
  2258. measurement on a reversed biased Schottky diode, is given by the 
  2259. Profile program <poisson.pro> that is included with the Profile
  2260. example set.
  2261.  
  2262. The junction is supposed to be at the beginning of the x-axis. Minority
  2263. carriers (holes) are neglected and Boltzmann statistics are used. The
  2264. global Newton solution algorithm is detailed in the fully commented
  2265. source code to be found in the standard extra.c source code file.
  2266.  
  2267.  
  2268.  
  2269. #levmar (10.1)  Extraction of non-linear model parameters from data.
  2270.  
  2271.  
  2272. See also:
  2273.  
  2274. help define    <-- How to define an internal non-linear model
  2275. help fit       <-- How to choose the fitting weight function
  2276. help setext    <-- Set parameters of the external non-linear model
  2277. help setlm     <-- Set parameters of the numerical levmar procedure
  2278. help constrain <-- Constrain parameter values within fixed bounds
  2279. help tpled     <-- Template editor for external model's input file
  2280.  
  2281. And: hartley.pro, camel.pro, nasecode.pro in the Profile example set.
  2282.  
  2283. Levmar fits a non-linear model to measurement data. The model may be both
  2284. non-linear in its parameters and in its dependence on the data x-axis.
  2285. This can be used to
  2286.  
  2287.  - extract physical parameters from measurement data
  2288.  - assess the correctness of a physical model
  2289.  - remove noise from measurement data
  2290.  
  2291. The fit is made by minimizing the squared sum of differences between
  2292. measurement data and computed data. A weight function may be used, and
  2293. is specified with the default Profile data type weight (see help fit).
  2294. The model parameters must be known as Profile real variables.
  2295. The model can be internal (defined as an expression with the command define)
  2296. or external. An external model is formed by another computer program,
  2297. that reads the parameters from a file written by levmar and writes its
  2298. output to a file read by levmar. The external model program may well be
  2299. Profile itself. More information about external models is on the next
  2300. pages.
  2301.  
  2302.  
  2303. Syntax:  levmar def [define] [ym-type] [x-type] [yc-type] [pars | fixed] $
  2304.     or:  levmar pro          [ym-type] [x-type] [yc-type] [pars | fixed] $
  2305.     or:  levmar prd          [ym-type] [x-type] [yc-type] [pars | fixed] $
  2306.  
  2307.  
  2308. In which:
  2309.  
  2310. levmar def   <-- Use a defined expression as a non-linear model
  2311. levmar pro   <-- Use an external program as a non-linear model
  2312. levmar prd   <-- Use a program that also generates derivatives of the
  2313.                  data with respect to the model parameters
  2314.  
  2315. [define]     <-- Name of the expression defined with define
  2316. [ym-type]    <-- Data type that contains the measurement data
  2317. [x-type]     <-- Data type that contains the x-axis
  2318. [yc-type]    <-- Data type that will contain the fit data
  2319.  
  2320. [pars]       <-- Real variables that are variable parameters of the model
  2321. [fixed]      <-- Real variables that are fixed    parameters of the model
  2322. $            <-- Indicates end of parameters
  2323.  
  2324. Example: (internal model):
  2325.  
  2326. prof> type x ym yc $                        : Declare data types
  2327. prof> var real a1 a2 a3 $                   : Declare model parameters
  2328. prof> define nlmod = a1 + a2*exp(x*a3)      : The non-linear model
  2329. prof> get meas.dat x ym $                   : Read measurement data
  2330. prof> weight = 1/(abs(ym)+0.01)             : Set weight function
  2331. prof> a1 =  580                             : \
  2332. prof> a2 = -180                             : | Initial parameter values
  2333. prof> a3 = -0.16                            : /
  2334. prof> setlm talk 1                          : Some more output from levmar
  2335. prof> levmar def nlmod ym x yc a1 a2 a3 $   : The fit itself
  2336. prof> view x yc ym $                        : Look at the result
  2337.  
  2338. After this fit, the parameters a1-a3 contain the optimized values.
  2339.  
  2340. An external non-linear model may be used to optimize parameters of models
  2341. that can only be represented in numerical form, and not by an analytical
  2342. expression. Such a model might be a series of Profile commands (including
  2343. such things as integration and differentiation) but also an entirely
  2344. different computer program. If the cost of computing the derivative of
  2345. the computed y-axis with respect to the parameters is much less than the
  2346. cost of computing the y-axis itself, these derivatives may be handed to
  2347. levmar (levmar pro <--> levmar prd). Otherwise, levmar will compute these
  2348. derivatives by using a perturbation technique.
  2349.  
  2350. Levmar communicates with the external model program through files:
  2351.  
  2352.  
  2353.         +---------------------------------------+
  2354.         |                                       |
  2355.         |        Profile running Levmar         |----+
  2356.         |                                       |    |
  2357.         +---------------------------------------+    |
  2358.              |           |              ^            |
  2359.              v           v              |            |
  2360.         +--------+ +-----------+ +--------------+    |
  2361.         | x-axis | | parameter | | model output |    v The model program
  2362.         |  file  | |    file   | |     file     |    | is invoked by Profile
  2363.         +--------+ +-----------+ +--------------+    |
  2364.              |           |              ^            |
  2365.              v           v              |            |
  2366.         +---------------------------------------+    |
  2367.         |                                       |    |
  2368.         |        Non-linear model program       |<---+
  2369.         |                                       |
  2370.         +---------------------------------------+
  2371.  
  2372.  
  2373. The x-axis file contains a listing of the x-axis (as generated by the
  2374. Profile command put) to be used by the model program. This file is written
  2375. only once for each call of levmar.
  2376.  
  2377. The parameter file contains a listing of the parameters to be used by the
  2378. model program in the form
  2379.  
  2380.      [parameter name]=[parameter value]    (e.g. a1=3.0)
  2381.  
  2382. If the model also generates derivatives (levmar prd), the parameter statement
  2383.  
  2384.      dodiff=1
  2385.  
  2386. will head the parameter file. The parameter file is written everytime
  2387. the external model program is invoked.
  2388.  
  2389. The external program output file must contain (in the first column) the
  2390. y-values computed by the program, and, if derivatives are used, in the
  2391. next columns the derivatives with respect to the parameters in the order
  2392. in which the parameters where specified to levmar, or
  2393.  
  2394.      if levmar was invoked as:     levmar prd y x yfit a1 a2 a3 $
  2395.      then the output file columns: y_computed dy_da1 dy_da2 dy_da3
  2396.  
  2397. The external program output file should be in a format readable by the
  2398. Profile command get.
  2399.  
  2400. The names of the three files and the exact call of the non-linear model
  2401. program can be asked for and changed with the command setext.
  2402.  
  2403. If the external model creates a file called "error.flg" (the so-called 
  2404. error flag file), the optimization procedure is halted. Old error.flg 
  2405. files are removed automatically before the optimization begins.
  2406.  
  2407. Example:
  2408.  
  2409. In this example we will use Profile itself as an external non-linear
  2410. model program. The names of the files and the program call are the
  2411. default settings:
  2412.  
  2413. x-axis file:         nlmin.dat
  2414. parameter file:      params.dat
  2415. model output file:   nlmout.dat
  2416. program call:        profile nlm.pro > nlm.out
  2417.  
  2418. The Profile command file nlm.pro is understood to be the Profile description
  2419. of the non-linear model evaluation. Profile should get nlmin.dat, execute
  2420. params.dat (!) and put nlmout.dat. Output of the non-linear model Profile is
  2421. redirected to nlm.out, to avoid streams of data on the screen.
  2422.  
  2423. A very simple example of nlm.pro, comprising exactly the same model as in
  2424. the example given above for the internal model, is
  2425.  
  2426.       type x yc dy_da1 dyda_2 dy_da3 $      : Declare data types
  2427.       var real dodiff a1 a2 a3 $            : Declare model parameters
  2428.       define nlmod  = a1 + a2*exp(x*a3)     : The non-linear model
  2429.       define dm_da1 = 1.0                   : Derivative with respect to a1
  2430.       define dm_da2 = exp(x*a3)             : Derivative with respect to a2
  2431.       define dm_da1 = a2*x*exp(x*a3)        : Derivative with respect to a3
  2432.       get nlmin.dat x $                     : Read x-axis
  2433.       exec params.dat                       : Set parameter values for this run
  2434.       yc     = nlmod                        : \
  2435.       dy_da1 = dm_da1                       : | Evaluate the model
  2436.       dy_da2 = dm_da2                       : | and derivatives
  2437.       dy_da3 = dm_da3                       : /
  2438.       put nlmout.dat
  2439.           yc dy_da1 dy_da2 dy_da3 $         : Write the output file
  2440.       quit                                  : Exit model Profile
  2441.  
  2442. The call of levmar in the main Profile should now look something like this:
  2443.  
  2444. prof> type x ym yc $                        : Declare data types
  2445. prof> var real a1 a2 a3 $                   : Declare model parameters
  2446. prof> get meas.dat x ym $                   : Read measurement data
  2447. prof> weight = 1/(abs(ym)+0.01)             : Set weight function
  2448. prof> a1 =  580                             : \
  2449. prof> a2 = -180                             : | Initial parameter values
  2450. prof> a3 = -0.16                            : /
  2451. prof> levmar prd ym x yc a1 a2 a3 $         : The fit itself
  2452. prof> view x yc ym $                        : Look at the result
  2453.  
  2454. It should be noted that the use of an external program is necessary only if
  2455. the non-linear model cannot be caught into an analytical expression. From
  2456. this point of view, our simple example is not an efficient solution.
  2457.  
  2458. If an existing external model program is used (e.g. some kind of simulation
  2459. program), this may not always exactly fit in the scheme scetched above. In
  2460. this case additional effort will be required to effect the communication
  2461. between the optimization driver (levmar) and the model program. The Profile
  2462. command <tpled> can be used to generate a parametrized input file of
  2463. arbitrary format for an external model program; this is illustrated with
  2464. a Spice example in the tpled manual page. In this case, a second instance
  2465. of Profile acts as a shell around the external model program.
  2466. For reading the models output, it may be necessary to write a data conversion 
  2467. program that changes the model output to a format readible by the Profile 
  2468. <get> command. Often, this can be achieved using Unix commands like ed, sed
  2469. and awk.
  2470.  
  2471. Also, it is often possible to create an external model by adding a 
  2472. (usually relatively simple) command to Profile with the "extra" mechanism
  2473. as described in section 2.2 of the Profile/Prof2d System Programmer's
  2474. Manual. This command acts as the numerical core of the external model; 
  2475. all data input/output can then be effected by the usual Profile commands.
  2476.  
  2477. More information on the use of Profile as an optimization driver for
  2478. parameter extraction can be found in:
  2479.  
  2480.  - G.J.L. Ouwerling, H.M. Wentinck, F. van Rijs, J.C. Staalenburg 
  2481.    and W. Crans, "Physical Parameter Extraction by Inverse Modelling
  2482.    of Semiconductor Devices," Proceedings SISDEP-88, Bologna, Sept. 1988.
  2483.  - G.J.L. Ouwerling, F. van Rijs, B.F.P. Jansen and W. Crans, 
  2484.    "Inverse Modelling with the PROFILE Optimization Driver", Digest of 
  2485.    the Short Course on Software Tools for Process, Device and Circuit 
  2486.    Modelling, NASECODE VI Conference, Dublin, Boole Press, July 1989.
  2487.  - G.J.L. Ouwerling, "One- and Two-Dimensional Doping Profiling by
  2488.    Inverse Methods", Ph.D. Thesis, Delft University of Technology, 1989.
  2489.    Of which appendix C: Algorithm of the MDLS optimization method.
  2490.  
  2491.  
  2492. #setext (10.2)  Define the communication with the external model.
  2493.  
  2494.  
  2495. See also:
  2496.  
  2497. help levmar  <-- Optimization driver for internal and external models
  2498. help tpled   <-- Template editor for external model input files
  2499.  
  2500. Setext is used to define the file and program names for the communication
  2501. between the non-linear optimization driver levmar and an external non-
  2502. linear model (typically a simulation program, conceivably Profile itself).
  2503.  
  2504. Syntax:
  2505.  
  2506. setext ?                <- show all current values
  2507. setext [name] [string]  <- set name to 'string'
  2508. setext [name] $         <- reset name to default value (see below)
  2509.  
  2510. Here [name] represents one of the following:
  2511.  
  2512. call  <-  set the invocation string of the external model program
  2513. par   <-  set the name of the levmar parameter values output file
  2514. axs   <-  set the name of the levmar x-axis values output file
  2515. nlm   <-  give the name of the external model's output data file
  2516.  
  2517. The default values are chosen for the use of Profile itself as an external
  2518. non-linear model:
  2519.  
  2520. (axs)  x-axis file:         nlmin.dat
  2521. (par)  parameter file:      params.dat
  2522. (nlm)  model output file:   nlmout.dat
  2523. (call) program call:        profile nlm.pro > nlm.out           (Unix, PC)
  2524.                             profile/output=nlm.out nlm.pro       (VAX/VMS)
  2525.  
  2526. The Profile command file nlm.pro is understood to be the Profile description
  2527. of the non-linear model evaluation. The external Profile should read the
  2528. data in nlmin.dat (command get), execute params.dat (!) to set the parameter
  2529. values (command exec) and write the results to nlmout.dat (command put).
  2530. In the external Profile's call, output from running nlm.pro is redirected
  2531. to nlm.out, to avoid streams of data on the screen.
  2532.  
  2533. NOTE: the execution of the optimization procedure is halted if the 
  2534.       external model creates a file called "error.flg" (the so-called
  2535.       error-flag file). Before the optimization starts, Levmar removes
  2536.       old error flag files. 
  2537.       This can be used to communicate an error condition from the 
  2538.       external model to the optimization driver.
  2539.  
  2540.  
  2541. #setlm (10.3)  Set the operational parameters of the levmar procedure.
  2542.  
  2543.  
  2544. See also:
  2545.  
  2546. help levmar  <-- Optimization driver for internal and external models
  2547.  
  2548. Setlm is used to change the values of operational parameters that govern
  2549. the behaviour of the non-linear optimization driver levmar.
  2550.  
  2551. Syntax:
  2552.  
  2553. setlm $                <- reset all values to default (see below)
  2554. setlm ?                <- show all current values
  2555. setlm [name] [value]   <- set name to value
  2556. setlm [name] $         <- reset name to default value (see below)
  2557.  
  2558. Here [name] represents one of the following:
  2559.  
  2560. name       default   summarized meaning
  2561. ----------+---------+--------------------------------------------------
  2562. talk       0         output level of the optimization procedure
  2563. ill        1.0E-12   max condition number for ill conditioned matrix
  2564. alambda    1.0E-02   starting value of Marquardt lambda
  2565. eps1       0.5E-06   min largest gradient element for singular matrix
  2566. eps2       0.5E-14   min length of update in scaled parameter vector
  2567. eps3       1.0E-05   min relative change in squared error sum
  2568. eps4       0.0       absolute value of error (use WEIGHTED error!)
  2569. beta       1.0E-05   measure of linear search accuracy
  2570. itermax    20        maximum number of parameter vector updates
  2571. deltapa    1.0E-06   absolute perturbance of scaled parameter
  2572. deltapr    0.001     relative perturbance of scaled parameter
  2573. liniter    10        maximum number of iterations in linear search
  2574. maxbroyd   -1        max number of Broyden updates. If -1, equals npars
  2575. ----------+---------+--------------------------------------------------
  2576.  
  2577. Some additional information about the parameter talk:
  2578.  
  2579.    talk=0  Only print table of original and ending parameter values.
  2580.    talk=1  Include some comments and statistics.
  2581.    talk=2  Also print information for each parameter update.
  2582.    talk=3  Draw a curve of the fit (with view) for each iteration
  2583.    talk=4  Dump the Hessian matrix and the Jacobian matrix.
  2584.  
  2585. More detailed information about the numerical procedure and the 
  2586. statistical analysis of the parameter solution can be found in
  2587. the reference given on the <levmar> manual page.
  2588.  
  2589.  
  2590. #constrain (10.4)  Specify constraints for non-linear parameters.
  2591.  
  2592.  
  2593. See also: help levmar.
  2594.  
  2595. Constrain specifies the interval that the value of a levmar parameter
  2596. may reach. If no constraints are specified for a certain parameter, it
  2597. may take any real value. Constraint specifications remain valid until
  2598. cancelled.
  2599.  
  2600. Syntax:
  2601.  
  2602. constrain [real var name] [lower value] [higher value]
  2603. constrain [real var name] $      <- remove this constraint
  2604. constrain ?                      <- show all constraints
  2605. constrain $                      <- remove all constraints
  2606.  
  2607. Example:
  2608.  
  2609. prof> var real a1 a2 a3 a4 $
  2610. prof> constrain $
  2611. prof> constrain a1 -1.0 2.0
  2612. prof> constrain a2 1.0e14 1.0e15
  2613. prof> constrain a3 pi e
  2614. prof> a1 = 0.0
  2615. prof> a2 = 5e14
  2616. prof> a3 = (pi+e)/2.0
  2617.  
  2618.  
  2619. Constraints are implemented by using a coordinate transformation:
  2620.  
  2621. p[model] = Low + (High-Low)*sqr(sin(p[internal]))
  2622.  
  2623. with Low and High the constraint values.
  2624.  
  2625.  
  2626. #callext (10.5)  Call the external non-linear model once.
  2627.  
  2628.  
  2629. See also: help levmar, help setext.
  2630.  
  2631. Callext does one call to an external non-linear model as defined by the
  2632. command setext (or by the default settings). This may be used to test the
  2633. interface between Profile and the external model, or to obtain a starting
  2634. profile of the simulated data using the starting parameters. Callext does
  2635. not request nor read derivatives from the external model.
  2636.  
  2637.  
  2638. Syntax:
  2639.  
  2640. callext [x-type] [y-type] [variable parameters] [| [fixed parameters]] $
  2641.  
  2642. The x-axis and all parameters are written to the intermediate files and
  2643. the y-axis is read from the model's output file as described in the levmar
  2644. help page.
  2645.  
  2646. Example:
  2647.  
  2648. prof> type x ystart ym yc $
  2649. prof> var real a1 a2 a3 $
  2650. prof> get meas.dat x ym $                        : read x-axis and data
  2651. prof> setext call ext_mod params.dat nlmout.dat  : set external model call
  2652. prof> a1=1.0
  2653. prof> a2=2.0
  2654. prof> a3=3.0
  2655. prof> callext x ystart a1 a2 | a3 $              : a3 will remain fixed
  2656. prof> view x ystart ym $                         : look at starting guess
  2657. prof> levmar pro ym x yc a1 a2 | a3 $            : find parameters a1 & a2
  2658.  
  2659.  
  2660. #scanspace (10.6)  Scan a least squares error space.
  2661.  
  2662.  
  2663. See also: help levmar, help setext.
  2664.  
  2665. Scanspace evaluates the non-linear model (either internal or external)
  2666. for a series of parameter values that are taken from equivalent data types
  2667. containing the required parameter values. The call of scanspace is similar
  2668. to that of levmar, with this respect that for every variable parameter an
  2669. equivalent data type must be given.
  2670.  
  2671. The parameter data type values may have been previously generated by using
  2672. Profile (1D) or Prof2d (2D) to create a parameter space. The computed error
  2673. function is subject to the weight values in the default data type weight
  2674. (like with levmar). If an error occurs during the model evaulation, the
  2675. error function value -1 is returned.
  2676.  
  2677.  
  2678. Syntax:
  2679.  
  2680. scanspace [model kind] [[model name]]
  2681.           [ym-type] [x-type] [yc-type] [error value type]
  2682.           ndata nparams
  2683.           [parameter value types] | [parameters] [| fixed parameters]] $
  2684.  
  2685. Here ndata is an integer (variable) giving the number of data lines, and
  2686. nparams an integer (variable) giving the number of parameter values to
  2687. be scanned.
  2688.  
  2689. Example:
  2690.  
  2691. prof> var real a1 a2 $
  2692. prof> type a1val a2val x ym yc error $
  2693. prof> var integer datlines parlines $
  2694. prof> define nlm=a1*a2
  2695. prof> get meas.dat x ym $
  2696. prof> datlines=ndata
  2697. prof> get params.dat a1val a2val $
  2698. prof> parlines=ndata
  2699. prof> scanspace def nlm ym x yc error datlines parlines a1val a2val | a1 a2 $
  2700. prof> put error.dat a1val a2val error $
  2701.  
  2702.  
  2703. #tpled (10.7) - Template editor to parametrize external model input files.
  2704.  
  2705.  
  2706. See also: help levmar, help setext
  2707.  
  2708. With the template editor tpled it is possible to create parametrized
  2709. input files of arbitrary format for use with external models.
  2710. Unfortunately, the template editor is not available on the IBM-PC 
  2711. unless by recompilation of the Profile source code.
  2712.