📄 param.doc
字号:
parameter file values will be superseded by Common file values if rules (2)-(3) or (2)-(4) above apply). Rule (4) was introduced to make it easier for ESPS programs to do what users expect - often, it would be annoying or a mistake to use values from ESPS common unless one is processing the same file that was being processed when ESPS common was written. Which set of rules applies can be determined from the "ESPS COMMON" section of the manual pages. 5 .2 . Common File Location The default ESPS common file is ".espscom" in the user's home direc- tory, but this can be reset by using the ESPSCOM UNIX environment variable, e.g.: %setenv ESPSCOM /usr/shore/fftcommon 5 .3 . User Control of Common Processing Before running an ESPS program, you can always disable common file processing by removing the common file or touching the parameter file (so that the common file is not younger than the parameter file). Also, you can disable common processing completely by setting the Unix environment variable USE_ESPS_COMMON to "off". For example, with csh, the following will do the trick: %setenv USE_ESPS_COMMON off In a sh script, common can be disabled by means of the following: USE_ESPS_COMMON=off export USE_ESPS_COMMON Version 3.5 ERL 1/22/93 ETM-S-86-12:jtb page 8 5 .4 . User Feedback of Parameter and Common file Processing Parameter sets for different ESPS programs can be combined in one parameter file - since each program only reads the parameters it needs, no harm is done by having other parameters in the same file. One result of this is that some users prefer to maintain one large parameter file for all of the programs they run. This can be error prone as it's easy to forget what's in such a file. Further confusion can arise from common file processing, since the final values for parameters can depend on the relative age of the common file, on which program is being run, and on which programs have been run previously. For these reasons, ESPS provides a mechanism by which you can see the parameter values that actually are used by a particular program. The degree of feedback is determined by the Unix environment variable ESPS_VERBOSE according to the following scheme (higher values of ESPS_VERBOSE include the feedback provided by lower values): Version 3.5 ERL 1/22/93 ETM-S-86-12:jtb page 9 __________________________________________________ |_______ESPS_Parameter_Processing_Feedback________| |ESPS_VERBOSE = | Feedback | |________________|________________________________| |_______0________|_no_feedback____________________| | 1 | reports if common is processed | |________________|________________________________| | 2 or greater | reports parameter file used | | | and individual parameter | | | values as taken from the | | | parameter file or the common | |________________|_file___________________________| The default setting of ESPS_VERBOSE is 2. As you become more experi- enced with ESPS, you should set a lower value for ESPS_VERBOSE in your .login file. As an example, consider a case where the range of a sampled data file is selected by running plotsd (1-ESPS) followed by range (1-ESPS): %plotsd test.sd %range After range finishes, the contents of ESPS Common is as follows: string filename = "test.sd"; string prog = "range"; int start = 192; int nan = 4251; int beginplot = 0; int endplot = 8000; Next, suppose you run refcof (1-ESPS) with the following parameter file: int start = 1; int nan = 1024; int frame_len = 1024; int order = 10; If ESPS_VERBOSE = 3, you would see the following output: %refcof test.sd test.spec read_params: Common processed. getsym_i: symbol start, value 192, taken from Common. getsym_i: symbol nan, value 4251, taken from Common. getsym_i: symbol frame_len, value 1024 taken from param file. getsym_i: symbol order, value 10 taken from param file. Version 3.5 ERL 1/22/93 ETM-S-86-12:jtb page 10 If you happened to use the -l0 option on refcof (so that the the full range is treated as a single frame), you would see the following out- put: %refcof -l0 test.sd test.spec read_params: Common processed. getsym_i: symbol start, value 192, taken from Common. getsym_i: symbol nan, value 4251, taken from Common. getsym_i: symbol order, value 10 taken from param file. 6 . Format of Parameter and Common Files Parameter files and common files are written in a C-like language. Parameters may have six types: integer, real (stored as double preci- sion values), string, character, array of integer, and array of real. For each parameter, the parameter file contains the following: parameter type parameter name definite assigned value (operator "=") or indefinite assigned value (operator "?=") (optional) prompt string (optional) parameter limitations (discrete choices or range of values) If the assigned value for a parameter is indefinite (indicated by the assignment operator "?=" or "=?"), then the user will be prompted for the value to be used. The prompt will occur at runtime when the corresponding getsym (3-ESPS) call is made. If the optional prompt string was supplied in the parameter file, that string will be used as the prompt; otherwise the parameter name will be used. If the user enters a RETURN in answer to the prompt, the default value will be used. If the optional parameter limitations are supplied, they are appended to the prompt string that is used for indefinite assignments. While they are not enforced by the getsym (3-ESPS) routines, the limitations are available to user programs by means of symchoices (3-ESPS) and symrange (3-ESPS). (The program xprompt (1-ESPS), for example, does exploit this information.) A simplified grammar follows. In this grammar, parentheses indicate that the contents may be repeated zero or more times. Square brackets indicate that the contents are optional (zero or one repetitions). Vertical bars indicate "or". CHRVAL, STRVAL, FLOVAL, and INTVAL represent legal C tokens for characters, strings, real values, and integers respectively. IDENT represents any legal C variable name, Version 3.5 ERL 1/22/93 ETM-S-86-12:jtb page 11 other than one of the reserved keywords. Case is significant, and all characters of names are significant (the restriction imposed by LEX, which builds the lexical analyzer, is about 200 characters). Most C escape sequences like '\n' are supported in character and string con- stants. Character constants like '^b', meaning control-b, are also supported. However, octal and hexadecimal numbers are not supported. Multiline strings are not supported. file :== ( statement ) statement :== type decl ( ',' decl ) ';' type :== "int" | "float" | "char" | "string" | "char *" decl :== IDENT assop value [prompt] [limits] value :== CHRVAL | STRVAL | FLOVAL | INTVAL | array array :== '{' num ( ',' num ) '}' num :== INTVAL | FLOVAL prompt :== ':' STRVAL limits :== choices | range choices :== ':' strarray strarray :== '{' STRVAL ( ',' STRVAL) '}' range :== ':' '[' num ',' num ']' assop :== '=' | '=' '?' | '?' '=' The following keywords are reserved: int, char, string, float, yes, no, true, false. The keywords "yes" and "true" are treated as integer constants with value one (the C convention for expressing logical true); the keywords "no" and "false" are integer constants with value zero. The comment convention is different from C. It is the same as for the C shell. A '#' character indicates that the rest of the line is a com- ment, unless it is contained in a character or string constant. This makes it easier to comment out lines. Here is an example of a parameter file: int order ?= 10 : "Model order"; # ask for prompt int verbose = no; #preemphasis specification int preflg = yes; float pre_num = { 0.9, -0.5 }, # zeros of preemph filter pre_den = { 0.99, -0.99 }, # poles of preemph filter scale = 0.25; int frmlen ?= 150: "Length of analysis window"; int nshft ?= 180: "Distance between frames"; #method for autocorrelation computation string method = "BURG"; #Burg method 6 .1 . Parameter Assignment Statements There are three types of assignment statements. The most basic state- ment is something like Version 3.5 ERL 1/22/93 ETM-S-86-12:jtb page 12 int M = 22; In this type of statement, a symbol named M is created, assigned the type integer and the value 22. If the name has been declared previ- ously, an error occurs. Type conversions, where sensible, work. An integer or character value may be assigned to a floating variable, and a character may be assigned to an integer variable. Integers in the range 0:127 may be assigned to character variables. Arrays may mix integers and floating values, provided that the array is assigned to a floating variable. Some things that don't work: int n = 12.0; # cannot assign float to int char q = "a"; # cannot assign string (even 1 char) to char string a = 'c'; # cannot assign character to string char a = 'b', *c = "def"; # unlike C, "char *" is just # a synonym for "string"; # no mixing allowed The other two types of assignment statements attach a default value to a variable and are indicated by adding a question mark to the equal sign (either before or after). An optional prompt string may appear, separated by a colon from the declaration. int M ?= 22 : "Model order"; When an attempt is made to retrieve the value of M, the user is prompted. If no prompt string is given, the variable name is used as the prompt. The default value is placed in square brackets: M [22]: Model order [22]: Here is an example that includes some parameter limitations: int M ?= 22 : "Model order": [1,30]; string method ?= "BURG" : "Enter the analysis method" : {"BURG", "AUTO", "MBURG"}; 7 . Programming Procedures for Parameter and Common Files
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -