First this: this version of Lise was sent to us by Rainer Kowallik for exclusive use in the UGA PD series. After his release of the Ql-emulator this is his second big program which will amaze many AMIGA users. We like to thank Rainer for his support of our library and hope the commercial version will be a success. This disk may be freely copied as long as don't change the contents of it. Documentation for LISE, ----------------------- the on Line Interactive Spectra Examination environment for multitasking Computers. A word about LISE and OTTO -------------------------- Both programs were develloped from physicists in the Hyperfine group at the Hahn - Meitner - Institute in Berlin. The older Program, OTTO (after Otto Hahn), was written by Mathias Menningen. The intention of OTTO was to provide a universal program for analysing 1-dim spectra and giving pictures, ready for publication. It includes a very good multi parameter fit routine, and many specialized functions for Moessbauer, PAC and PAD. This Program has proofed very usefull when analysing data, which have been allready collected. But if you are collecting data, you want to have an On Line analysis, and you want to manage auxillary devices and spectra files simultaneusly. After a long time of incremental devellopment, OTTO has become so big, that Linking time will prevent every programm devellopment. Furthermore, the program was written in FORTRAN, and uses lots of special libraries. After all, there are implementations for the IBM PC (scaled down because of memory problems), the ATARI ST, and DEC VAXes under VMS, each having different sources and libraries. From these three Versions, only the VAX version can be considerd really, since the other computers are unable to run Multitasking. After Mathias has left the group, there was nobody, who could manage to port the OTTO to our UNIX Workstation. So the Idea came up, to create a new program, which should fulfill the following conditions: 1) It should allow for easy expansion. 2) It should work together with Hardware controlling tasks. 3) It should be able to do Analysis without any human help, 4) It should be as close as possible to the known syntax from OTTO. So I develloped LISE (after Lise Meitner). Its itention is a little bit different from OTTO, so that both programs can be considered complementary, though both of them are closely related. OTTO is best for final analysis, giving correct error values and producing pictures ready for publishing. LISE is best for On Line Analysis, giving results without huge pre analysis, (finding time 0 , finding correct background...). gives possibility to export pictures to other programs, for further modification and including in DTP programs. Introduction ------------- LISE is not a single program, but a collection of programs, which may be called from the system command line interface. This allows for writing macro procedures in the script language of your computer (preferably the Korn-shell on UNIX and Amiga computers, but also the Rexx language on big IBMs and the Amiga), thus having access to all system features (as for example the cron utility on UNIX and Amiga computers) and saving your time, by not teaching you another lousy macro language. The other advantage of this concept is, that you may use all routines from within your own programs via a system call. And last, but not least, this concept enables you to add and modify programs in a very easy way. To enable a beginner to write programs for LISE, the spectra format was kept so simple, but still flexible, that it is possible to use pure ASCII input and output to access spectra files (but it is recommended, that you use binary formats, because loading time is much faster and Diskspace is saved). (There is another good reason for implementing an ASCII format: It makes transport of data between different processors very simple.) Questions you may ask: 1) why C ? All programs are written in C because this language is the native programming language of all UNIX machines, and on the Amiga. This makes porting to other UNIX computers as simple as possible. 2) why not using GKS, GEM, VDI, starbase, GRAFIX... ? Thats the reason why! 3) why Amiga ? For measurement and control, the UNIX Version would fully suffice. Since you may want to have pictures included in your slides and papers, and since you may want to modify the spectra in a more sophisticated drawing programm, it seemd to be the easiest way to write an Amiga Version, which may print out drawings in a format, readable for Text formatters (TeX) Drawing programs (Aegis Draw) Painting programs (Deluxe Paint) Desktop Publishing programs (Page Stream) The other reason was, that there is a number of MCA plug in cards available for the IBM PC, and that the Amiga has the ability to use these cards via a PC Bridge board, which provides this machine with an (more or less) intelligent peripheral bus controller, programmable, for example, in Turbo PASCAL. The other way around, it provides an industry standard bus with an intelligent Computer, capable of realtime multitasking, able to use any amount of core memory and advanced, high speed graphics, and with a number of very good tools and programs, especially for DTP and program devellopment. (did you ever hear about the enormous software crisis at the IBM PC ? too much, too lousy programms. Now, at least, you have heard about it.) 4) any other computers ? a. IBM PC yes, if you have an 80386 and switch over to UNIX. b. ATARI ST / TT Why the hell did you buy this stupid piece of trash ? ("MINIX" you say ? but do you have XWindows for MINIX ? O.K. forget it !) c. Apple MacIntosh If I find the time, I will try to port an older Version of the Amiga C-Shell to the Mac, to provide it with a command language interface. After this I will try porting LISE. d. VAX - VMS May be, one fine day... e. Sinclair QL Just mentioned for curiosity, remembering the good old times. 5) why Public Domain ? In Germany, there is up to now a gigantic dominance for DEC VAXes under VMS and IBM PCs and (less common, but still relatively wide spreaded) the ATARI ST for scientific measurment and control. There are three very good arguments for it: First, it is allready quasi standard. Second, there is so much Software and hardware available, and all scietists are allready used to these machines. Third, most of the scientiffic long bearded Software cancer is written in FORTRAN, and the standard language for more modern computers is C, which most scientists are going to belive is an abbreviation for Chinese. Without any miracle, they will keep on with it the next 2000 years. There are lots of possible miracles: An ecologic catastrophe will throw back the whole humankind to the middle age. (most probably miracle) DEC gives up producing computers and switches over to the weapon market. A hardware virus makes all IBM PCs unusable. A gentechnological Terrorist constructs a bacterium which eats up the plastic covers of all Atari STs. I will start and try another (less destructive) miracle: Demonstrating, that real computing power is better than stupid standards. First we have to go against the argument, that there is no scientific Software available for UNIX and Amiga computers. For this I want to start a scientific software library, which contains portable Programs in SOURCE code format (to be really portable, you can not rely on any "standard" libraries, which are going to be superseded in five years, and you must be able to recompile the software on new computers) and best written in C, because this is the standard language on all UNIX computers. So I give this piece of Software to the Public domain, hoping for response and believing, that this is the fastest way for an ever increasing scientific portable C-Source code library for UNIX. I. Basics ----------- spectra arrays are simply files on your disk. There are normally 3 related files, which contain the data (*.spc) the corresponding error values (*.err) and an optional nonlinear time axis (*.tim). If there is no .tim array, then the internally stored calibration factor is used. Error spectra are normally generated automatically, when the input spectra have pure statistical (sqrt(n)) errors. Spectra may be specyfied as whole spectrum by just giving the name (e.g.: ksh> ash myspectrum ) If you just want to use a part of the spectrum you can use the "[" and "]" to enclose the range, where the starting channel is separated by ":" from the last channel. (e.g.: ksh> ash myspectrum[123:234] ) The spectrum must allways be the first parameter ! If no spectrum is specified, it is expected to be "piped" to stdin ! Output goes allway to stdout (if not graphical of course) if it is not explicitly redirected by the "-o filename" option ! You can allway get help on the routine you want to use by specifying the "-h" or "-help" option. The PAC and PAD spectra arrangement is stored in the file "global.def" The actual time calibrationfactor is stored in "tica.all" II. Files needed for liese: --------------------------- 1) Programms a. graphic primitives pag.c used to erase the tektronix screen vect.c routine to draw vectors from the shell point.c plot a point (circle, triangle...) tpo.c print text on screen. (TyPe Origin). rmtek.c remove tektronix screen. hco.c make a hardcopy of the tektronix screen. b. spectra analysis stype.c typing the contents of a spectrum ash.c plotting spectrum with axis (Axis and SHow) cur.c asking for cursor position tcal.c makes a time calibration fprompt.c finding prompt peak positions four.c Fourieranalysis of spectrum pacsplit.c splits an 8K spectrum into 2 1K spectra. rvt.c calculates the ratio function of two spectra Here we use the PAD ratio function ! rvt2.c PAC ratio function ! linfit.c Polynom and linear function fit to data c. spectra manipulation genspc.c generates an artificial spectrum. mspc.c modifies an existing spectrum. These programs should be replaced by a better formular parser, which allows for a more intuitive spectra arithmetic. lbn.c changes the time calibration factor of all spectra specified. d. miscellaneous tekdaemonhp.c A programm, which reads graphic input from a pipe, and sends it to the actual tektronix emulation. It also may be responsable for hardcopies on some systems. tekamiga.c The graphics communications programm for the amiga version of liese. vka.c read a spectrum from the halder vka and create corresponding error and time arrays Also does some other communications. halderserv.c Another communication programm for the Halder vka. mca.c Reading Spectra from the MANY 86 MCA on the Amiga. Includes all other communication. MCAah.c Window oriented Multi Channel Analyser program (not only) for the MANY 86 MCA. It provides Life Display and some more complex features. auger.c Makes one Auger scann and reads the Spectrum. cio.c CESSNA format conversion programm. Limited to 25 Spectra ! 2) includefiles /usr/include/lise/strigs.h some string handling functions /usr/include/lise/spec.h simple spectra i/o routines, readspec(), writespec(), and option string parsing: checkopt(). /usr/include/lise/gfx.h graphic primitives: tekopen(), vectoa(), posita(), gfxtext(), gfxflush(). /usr/include/lise/gfxamiga.h the same definitions for the Amiga Version of liese. /usr/include/lise/auxcfg.h reads the auxillary configuration file /dev/Aux_Config to get the device addresses , error handler and some specific information. filedescriptor=auxopen("entryname"); 3) shell scripts lise lise startup definitions pas pag ; ash... (store parameters) pad pag ; ash with last parameters adi ash with last parameters dis ash -d with last parameters dpeak display around peaks (1-4) dpeak2 display around peaks (5-8) 4) menue files /usr/lib/X11/bitmaps/lise The liese icon in the control panel /usr/lib/X11/helpfiles/lise The help message for this icon /usr/lib/X11/app-defaults/XCtrl (has been changed) /usr/lib/X11/app-defaults/OnLine The OnLine pushbutton menu /usr/lib/X11/app-defaults/VKA The VKA pushbutton menu 5) other files 6) dependencies *.spc spectra files (data) *.err absolute errors *.tim calibrated time *.def peak positions and detektor positions generated by fprompt.c Must be modified before calling pacsplit.c /src/liese/Aux_Config Text file containing description of auxillary devices. tica.all Time calibration factor as generated by tcal global.def peak positions and detektor positions as generated by fprompt. This file will be read by pacsplit.c if no *.def file exists liese_on only used as flag for the liese script. It is generated when liese is called, and will be deleted on the next login. /tmp/gcursor is generated by the tekdaemon to tell gfx.h where the cursor is. /tmp/ashbdry is generated by ash.c to store the actual boundaries for cur.c III. Implementation notes. -------------------------- IV. Spectra file format. ------------------------ 1) binary format: const byte = 0 Identifier for binary format const byte = [0,1,2] 0 for short int (16 bits) 1 for long int (32 bits) 2 for float (32 bits) short int max number of channels in spectrum char s[80] spectrum comment (ASCII text) float _tica time calibration factor short int _spare[4] for future expansion float / long / short spc[max] data 2) ASCII format const char = ['1','2'] 1 for integer 2 for float int (%d) max number of channels in spectrum char (%s) s[80] spectrum comment, terminated by LF float (%E) _tica time calibration factor int (%d) _spare[4] for future expansion int (%d) / float (%E) spc[max] data V. precedence of time calibration factors ----------------------------------------- In order to have the possibility to produce a non linear x-axis on the display, the *.tim spectra array is read with the highest priority over all other time calibration factors. If no *.tim spectrum is present (this saves diskspace) the time calibration factor will be taken from a file with the name tica.all, in order to give you an easy way to change this calibration factor, if you, for example, find out, that your first time calibration was wrong. If neither a *.tim file nor the tica.all file are present, the time calibration is taken from the value stored in the spectrum at generation time. VI. General structure ---------------------- ------------------------------- | graphic device or program | | (graphic Terminal at any | | port, xterm emulation, | | advanced graphic program) | ------------------------------- | ------------------------------- | tekdaemon server process | | uses Vector Fonts and | | holds buffer for hardcopy. |-------------------------------------------| | Communication via named | | | pipe (UNIX) or direct calls | | | (Amiga) | | ------------------------------- | | | ------------------------------- ------------------------------ | | Unix command shell (Ksh) | | LISE Software pool, | | | or Arexx, or Any shell you |--| User defined functions, |-----------| | like | | Hardware controll tasks | | ------------------------------- ------------------------------ | | | | ------------------------------- ------------------------------ | | Graphic user interface | | Communication of programs | | | For UNIX and Amiga the | | via files on Disk (spectra | | | MDL was develloped to | | files), unix style pipes | | | provide a common Interface. | | and command line parameters| | ------------------------------- ------------------------------ | ---------------------------------- | | Hardware description file | | | Aux_Config | | | (global at /src/lise or local |--- | at $HOME) | | contains device names and error| | handlers and specific info. | ---------------------------------- VII Description of routines: ----------------------------- a. graphic primitives pag ------- clear grafic window standard spectra options: -h (call help routine) -help (call help routine) -p n (sets grafic pipe number) -n (n=0..6 specifies a subwindow) vect ------- draw a vector on the grafic screen vect x y [x2 y2] [options] standard spectra options: -h (call help routine) -help (call help routine) -p n (sets grafic pipe number) -n (n=0..6 specifies a subwindow) point -------- plot a point on the grafic screen point x y [options] -v draws vectors -c draws circles -cir n draws circles with radius n.m -crf n draws filled circles with radius n -tri n draws triangles with baseline n (negative n gives inverted triangles) -trf n draws filled triangles with baseline n -qua n draws quadrates with baseline n -qaf n draws filled quadrates with baseline n standard spectra options: -h (call help routine) -help (call help routine) -p n (sets grafic pipe number) -n (n=0..6 specifies a subwindow) tpo ------- print text on the grafic screen tpo x y [options] -t text options: -w n gives angle in degree -xs n sets size of characters (integers) -ys n sets size of characters (integers) -xt n sets repetition (thicknes) for x -yt n sets repetition (thicknes) for y -font name sets fontname -c n sets paper and ink colour standard spectra options: -h (call help routine) -help (call help routine) -p n (sets grafic pipe number) -n (n=0..6 specifies a subwindow) rmtek -------- hco ------- make hardcopy of LISE picture options: -out string sets another printer driver standard spectra options: -h (call help routine) -help (call help routine) -p n (sets grafic pipe number) -n (n=0..6 specifies a subwindow) b. spectra analysis stype -------- ash ------- cur ------ tcal ------- fprompt Take an 8K spectrum and find the maxima (peaks) ----------- for each single spectrum. This method (simple maximum) is rather crude, so that you should have a look at your spectra anyway. options and theier meaning: -range number specifies length of single spectrum. is ignored when specifying a spectra definition file, but overwrites the value from global.def. -dev number specifies a maximum deviation of the prompt peak from 2**n value. -get filename read spectra definition file instead of global.def -def filename redirects output to file rather than global.def Format of spectra definition file global.def: this file consists of 4 entrys for each spectrum and has as many lines as spectra were present. The entrys are: prompt phase first last | | | | | | | |---- last channel containing | | | usable data | | | | | |---- first channel containing | | usable data | | | |---- 1 for 0 degree spectrum | 2 for 90 degree spectrum | negative when mirrored | |---- position of prompt peak four Fast fourier transformation from input spectrum ------- The resulting spectrum is allready a power spectrum options and theier meaning: -iv inverse spectrum -rf name save real part to file -if name save imaginary part to file -pc n append n peaks to comment -pp n print n peaks to stdout -s suppress printing of powerspectrum to stdout pacsplit Takes one 8K spectrum, splits it into single spectra ------------ as defined in global.def (or any file supplied) and adds corresponding files together. If the parity of the spectrum was defined negative, the spectrum is reversed when adding to the others. AFTER calulation of the sum spectra USP1 and USP2 the errorbars are calculated using USP1.err = sqrt(USP1.spc); USP2.err = sqrt(USP2.spc); options and theier meaning: -o1 spectrum defines output other than USP1 -o2 spectrum defines output other than USP2 -def filename read spectra definition from file other than global.def Format of spectra definition file global.def: this file consists of 4 entrys for each spectrum and has as many lines as spectra were present. The entrys are: prompt phase first last | | | | | | | |---- last channel containing | | | usable data | | | | | |---- first channel containing | | usable data | | | |---- 1 for 0 degree spectrum | 2 for 90 degree spectrum | negative when mirrored | |---- position of prompt peak rvt calculating the ratio function ------- rvt = (a*usp1 - b*usp2) / (a*usp1 + b*usp2) of two spectra files. Input is read from USP1.spc and USP2.spc. The errorbars are calculated from the Spectra: err = sqrt(usp1 + usp2)/(usp1 + usp2) Before the normalizing factors a and b are calculated, the Background is subtracted. The default method for finding an appropriate background is, to try linearization of the exponential decay in USP1 and USP2. For different background values a chi**2 is calculated after linear regression with the logarithm of the resulting spectrum. the value with the best chi**2 fit is taken as background. options and theier meaning: -s1 spectrum read 0 degree spectrum other than USP1 -s2 spectrum read 90 degree spectrum other than USP2 -ba1 value set background for 0 degree spectrum. (if ba2 is not specified, it is set to ba1) No fit is made afterwards. -ba2 value set background fo 90 degree spectrum. (if ba1 was not specified, it is set to ba2) No fit is made afterwards. -last number sets the background to the arithmetic mean of the last number channels. Very crude method, but it saves time, when running on a pure (poor) 68000 Amiga -v If you are going to be nervous when the background fit runs, you may try this option. It also will tell you the background values, so that you might verify them, or use them for OTTO. rvt2 ------- Splitting spectrum file into single spectra, possibly reversing them, subtracting Background Calculating PAC Ratio function: 1/4 2 (product(Si(180,t) - BACKi)) R(t) = - * --------------------------------- - 1 3 (product(Sj(90,t) - BACKj))^(1/4) 1 2 [ 1 Error(t) = ------ * - * [-- * sum(1/(Si(180,t)-BACKi)) + R(t)+1 3 [16 1/2 1 ] + -- * sum(1/(Sj(180,t)-BACKj)) ] 16 ] RVT2 file [-o file] [-back n] [-last n] options: -o file output spectrum instead of stdout -back n background for all spectra -last n takes arithmetic mean of last n channels as background. Default is, to find the background by fitting an exponential curve to the spectrum -v ves fitted background The definition of the spectrum is read from global.def This file should be in a format as generated by the FPROMPT routine and is organized as follows: Each line consists of 4 integers. The first specifies the Time 0 position. The second can be +1 -1 +2 or -2 and specifies, if it is to be mirrored (-) and if it is a 0 degree (1) or 90 degree (2) spectrum If any other number is given, the spectrum is ignored The last two numbers are used to specify the range of the usable data area. Up to now, these parameters are only significant in the last line ! linfit --------- Linear or Polynomial Fit to Data. Highest possible order: 10 LinFIT [-in file] [-o file] [-dif file] [-v] [-poly n] options: -in filename reads data from spectrum file -o filename output calculated fitcurve to spectrum file -dif filename diferentiate fitcurve and write data to spectrum -v verbouse: prints out resulting coeffitients -poly n calculate polynom of order n (default is 3) -cexp n.m calculate critical exponent for Tc = n.m Formula: y = a * (Tc - x) ^b if Tc is set to 0, x is assumed to be (Tc - T) -nexp n.m calculate normal exponential curve for Background n.m Formula: y = a * x ^b + n.m standard spectra options: -i (Integer ASCII output), -r (float ASCII output), -i2 (short integer binary), -i4 (long integer binary), -r4 (float binary, !! NOT PORTABLE !! yet), -o name (output goes to files [.spc and .err] and not to stdout) -h (call help routine) -help (call help routine) -p n (sets grafic pipe number) -n (n=0..6 specifies a subwindow) c. spectra manipulation genspc --------- generate spectrum genspc sp[{i:j}] {-lin a b} {-sin a b c} {-exp a b c} contrary to the normal behaviour, the WHOLE spectrum (and corresponding error array) is stored back -t generate timespectrum only. -e generate errorspectrum only. -m n maximum of n elements -sin a b c for all n: spc(n) = a*sin(b*n+c)) -exp a b c for all n: spc(n) = a+b*exp(c*n) -lin a b for all n: spc(n) = a+n*b mspc ------- modify spectrum mspc sp{[i:j]} n1 n2 ... {-sin} {-cos} {-exp} {-ln} {-sqr} {-sqrt} {-abs} {-s n} {-d n} {-p n} {-q n} the contents of sp is modified starting from i, ending with j. contrary to the normal behaviour, the WHOLE spectrum (and corresponding error array) is stored back If n1 n2 ... is specified, then sp[i:j] is set to the constant values with the last one repeated up to j. other operations: -f use as Filter (do not write back) -c text change comment only. -tica n.m change time calibration for this file -t modify timespectrum only. -e modify errorspectrum only. -sin for all n: spc(n) = sin(spc(n)) -cos for all n: spc(n) = cos(spc(n)) -exp for all n: spc(n) = exp(spc(n)) -ln for all n: spc(n) = log(spc(n)) -sqr for all n: spc(n) = spc(n)*spc(n) -sqrt for all n: spc(n) = sqrt(spc(n)) -abs for all n: spc(n) = fabs(spc(n)) -int for all n: spc(n) = floor(spc(n)) -lin for all n: spc(n) = n -mir for all n: spc(n) = spc(max-n), modifies error array too -add x for all n: spc(n) = spc(n) + x -sub x for all n: spc(n) = spc(n) - x -mul x for all n: spc(n) = spc(n) * x -div x for all n: spc(n) = spc(n) / x -sr x for all n: spc(n+x) = spc(n) (shift right) -srt x for all n: spc(n+x) = spc(n) (shift right, including time) -sl x for all n: spc(n) = spc(n+x) (shift left) -slt x for all n: spc(n) = spc(n+x) (shift left, including time) -com x compress spectra, modifying error and timearrays too -bel x smoothly cut spectrum after x, modifies error array too instead of numbers, other spectra arrays may be specified. these spectra arrays are taken starting from the first element. ONLY ONE OPERATION CAN BE PERFORMED AT A TIME ! lbn ------- changing the time calibration factors of all spectra specified Abbreviation stands for: Late is Better than Never Call like lbn 0.03456 *.err *.spc d. miscellaneous tekdaemonhp --------------- tekamiga ----------- vka ------ halderserv -------------- mca ------ MCAah -------- auger -------- cio -------