program camplo(baseline, sample, xyin, output); (* camplo: camspec plot Tom Schneider NCI/FCRDC Bldg 469. Room 144 P.O. Box B Frederick, MD 21702-1201 (301) 846-5581 (-5532 for messages) toms@ncifcrf.gov http://www-lmmb.ncifcrf.gov/~toms/ National Cancer Institute Laboratory of Mathematical Biology *) label 1; (* end of program *) const (* begin module version *) version = 1.02; (* of camplo.p 1996 March 19 origin 1996 March 18 *) (* end module version *) (* begin module describe.camplo *) (* name camplo: camspec plot synopsis camplo(baseline, sample: in, xyin: out, output: out) files baseline: baseline spectrum sample: sample spectrum xyin: difference between baseline and sample as input to xyplo output: messages to the user description Convert camspec output to plotting format. examples documentation see also xyplo.p author Thomas Dana Schneider bugs technical notes *) (* end module describe.camplo *) (* begin module camplo.const *) nmwid = 5; (* width of nm data output *) nmdec = 1; (* decimal places of nm data output *) odwid = 7; (* width of od data output *) oddec = 3; (* decimal places of od data output *) (* end module camplo.const *) var baseline, sample, (* file used by this program *) xyin: text; (* file used by this program *) (* begin module halt *) procedure halt; (* stop the program. the procedure performs a goto to the end of the program. you must have a label: label 1; declared, and also the end of the program must have this label: 1: end. examples are in the module libraries. this is the only goto in the delila system. *) begin writeln(output,' program halt.'); goto 1 end; (* end module halt version = 4.15; (@ of prgmod.p 1994 November 12 *) (* begin module copyaline *) procedure copyaline(var fin, fout: text); (* copy a line from file fin to file fout *) begin (* copyaline *) while not eoln(fin) do begin fout^ := fin^; put(fout); get(fin) end; readln(fin); writeln(fout); end; (* copyaline *) (* end module copyaline version = 4.15; (@ of prgmod.p 1994 November 12 *) (* begin module camplo.number *) function number(var thefile: text): boolean; (* does thefile contain a number next? *) begin number := thefile^ in ['0','1','2','3','4','5','6','7','8','9'] end; (* end module camplo.number *) (* begin module camplo.copyheader *) procedure copyheader(var infile, outfile: text); (* does thefile contain a number next? *) begin while not number(infile) do begin write(outfile,'* '); copyaline(infile, outfile) end end; (* end module camplo.copyheader *) (* begin module camplo.checkcomma *) procedure checkcomma(var f: text); (* check that the file f contained a comma next *) var c: char; (* a character to read from the files *) begin read(f, c); if c <> ',' then begin writeln(output,'"," missing, character was ',c,'"'); halt; end end; (* end module camplo.checkcomma *) (* begin module camplo.themain *) procedure themain(var baseline, sample, xyin: text); (* the main procedure of the program *) var absorbance: real; (* od for sample vs baseline *) nmbaseline: real; (* nm for baseline *) nmsample: real; (* nm for sample *) ln10: real; (* natural log of 10 *) Tbaseline: real; (* % Transmittance for baseline *) Tsample: real; (* % Transmittance for sample *) begin writeln(output,'camplo ',version:4:2); reset(baseline); reset(sample); rewrite(xyin); writeln(xyin,'* camplo ',version:4:2); ln10 := ln(10); (* copy headers *) writeln(xyin,'*'); writeln(xyin,'* baseline header:'); copyheader(baseline,xyin); writeln(xyin,'*'); writeln(xyin,'* sample header:'); copyheader(sample,xyin); writeln(xyin,'*'); writeln(xyin,'* columns:'); writeln(xyin,'* 1: identifier (b=%T for baseline, s=%T for sample,'); writeln(xyin,'* a=absorbance = -log10(sample/baseline)'); writeln(xyin,'* 2: wavelength in nm'); writeln(xyin,'* 3: od, optical density'); writeln(xyin,'*'); while not eof(baseline) do begin if number(baseline) then begin read(baseline,nmbaseline); checkcomma(baseline); readln(baseline,Tbaseline); read(sample,nmsample); checkcomma(sample); readln(sample,Tsample); { writeln(xyin,'b ', nmbaseline:nmwid:nmdec,' ',Tbaseline:odwid:oddec); writeln(xyin,'s ', nmsample:nmwid:nmdec ,' ', Tsample:odwid:oddec); } if nmbaseline <> nmsample then begin writeln(output,'nm of baseline (',nmbaseline:nmwid:nmdec,')'); writeln(output,'does not equal'); writeln(output,'nm of sample (',nmsample:nmwid:nmdec,')'); halt end; absorbance := -ln(Tsample/Tbaseline)/ln10; writeln(xyin,'d ', nmbaseline:nmwid:nmdec, ' ',absorbance:odwid:oddec); end else readln(baseline) end; end; (* end module camplo.themain *) begin themain(baseline, sample, xyin); 1: end.