program xyda(predata, xydap, postdata, output); (* xyda: back convert histogram to data file Dr. Thomas D. Schneider National Institutes of Health National Cancer Institute Center for Cancer Research Nanobiology Program Molecular Information Theory Group Frederick, Maryland 21702-1201 toms@ncifcrf.gov permanent email: toms@alum.mit.edu (use only if first address fails) http://www.ccrnp.ncifcrf.gov/~toms/ *) label 1; (* end of program *) const (* begin module version *) version = 1.00; (* of xyda.p 2007 Nov 02 2007 Nov 02, 1.00: origin *) updateversion = 1.00; (* defines lowest acceptable current parameter file *) (* end module version *) (* begin module describe.xyda *) (* name xyda: back convert histogram to data file synopsis xyda(predata: in, xydap: in, postdata: out, output: out) files predata: A data file containing lines with two values: position (an integer or real number) number of events at that position (integer) Blank lines or lines that begin with '*' are copied to the postdata file. Negative number values halt the program. Zero number values are ignored postdata: For each pair of position and number lines in the predata, the position value is written out repeatedly according to the number given. xydap: parameters to control the program. The file must contain the following parameters, one per line: parameterversion: The version number of the program. This allows the user to be warned if an old parameter file is used. Other than the parameterversion, this file is not used yet. output: messages to the user description Convert data in the form of a histogram back to a set of raw numbers. When these numbers are put into genhis, the original histogram should be reconstructed. examples documentation see also {xy plotting program: } xyplo.p {histogram plotting: } genhis.p {histogram analysis of gaussians: } higa.p author Thomas Dana Schneider bugs There should be parameters that let one pick columns from the predata file. technical notes *) (* end module describe.xyda *) var predata, (* file used by this program *) xydap, (* file used by this program *) postdata: 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 = 'delmod 6.16 84 mar 12 tds/gds'; *) (* 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 *) (* begin module xyda.themain *) procedure themain(var predata, xydap, postdata: text); (* the main procedure of the program *) var parameterversion: real; (* parameter version number *) position: real; (* position in the graph *) number: integer; (* number of data points *) n: integer; (* index to number *) begin writeln(output,'xyda ',version:4:2); reset(xydap); readln(xydap, parameterversion); if round(100*parameterversion) < round(100*updateversion) then begin writeln(output, 'You have an old parameter file!'); halt end; rewrite(postdata); reset(predata); while not eof (predata) do begin if (predata^ = '*') or (eoln(predata)) then begin copyaline(predata, postdata) end else begin readln(predata, position, number); writeln(output, position:15:8, ' ', number:5); if number < 0 then begin writeln(output, 'Number is less than zero - bad predata file?'); halt end; for n := 1 to number do writeln(postdata, position:15:8); end end; end; (* end module xyda.themain *) begin themain(predata, xydap, postdata); 1: end.