Askiing Export Documentation The routine in file askiing.scr is used to convert the raw data collected, trial by trial, onto a data.scr file into an ASCII file ("askii" is a play on "ASCII"). Currently, the program is not parameterized in the sense that it only handles one data set. [By changing pts from the value of one data channel to the value of its multiples the program can be "tricked" into converting more data.] The reason it has not been parameterized, however, is that the ASCII files thus created could not be opened with the Excel spreadsheet program at the time. That is, the value of pts exceeded the value of allowed columns in Excel. Thus, parameterizing it to handle multiples of pts seemed pointless, although in reality it is trivial to include. Assuming that the column limit could be expanded in future spreadsheets, one alternative strategy would be to store the second, third, etc. data channels on subsequent rows. The number of columns in that case would not exceed pts. The hope was that data collected by the Runtime program could be exported and analyzed by an ordinary spreadsheet. That way the experimenter could analyze the data any way desired. This conversion is not necessary, however, for the Datamunch programs directly read these binary files. In fact, any programming language which can read binary files can be used to analyze the data. All that needs to be known is the file structure. The Runtime data.scr file structure is the following. The data file is accessed at every 1k boundary. The first 1k is called 0 (zero; block 0) which is mostly not used. The first two bytes are used to identify the last trial stored in the session (this is used to resume training at that point should the power have failed). Between bytes 64 and 127 is where the comment the user enter is stored. The rest of the first 1k space is not used and is usually filled with the decimal number 32 (hexadecimal 20), the ASCII code for a space. In the rest of the file, the trials are store on subsequent 1k boundaries: trial 1 one block 1 (beginning at byte 1024), trial 2 at block 2 (beginning at byte 2048), trial 3 at block 3 (beginning at byte 3072), etc. The 1k space for each trial is filled first with A/D (eyelid) data and followed by count (unit) data. Each of these data channels is pts long, with each entry representing a bin's worth of data. That is, first all of the first A/D channel is entered with successive bins, then the second A/D channel, etc., then the first unit channel with all its successive bins, then the next units channel, etc. If the original binwidth during data collection was 4 msec, then the first data point for each channel represents 0 - 4 msec, and the 50th bin represents 196 - 200 msec. The numbers are 8-bit binary in size. One of the functions of askiing (as well as adlibbing) is to convert the binary numbers into ASCII numbers suitable for viewing with a spreadsheet program. The remainder of the 1k space is filled with the decimal number 32 (hexadecimal 20), the ASCII code for a space. Note that the data file does not contain any parameters such as the binwidth (bin), the number of points per channel (pts), the number of A/D channels (#a/d) or unit channels (#units), when the tone came on (toneon), or whether the trial was tone alone (t&) or paired tone-airpuff (t&a), for example. As with the other programs in these appendices, this file has been modified in the following ways: comments have been expanded; screens have been idenfified by numbers; and for documentation instructions have been included as comments. \ screen 0 \ ASKIING file \ This file converts forth binary files to ascii format for use by spreadsheets. \ the first line is the comment from the data file. \ each of the following lines are individual trial data, delimited by spaces and followed by a return. \ \ TO USE: askiing file1,file2 \ where: file1 is a forth binary file \ file2 either exists or not and will be the ascii file. \ \ NOTE: based on EVOLUTION.SCR routines. \ screen 1 \ this screen controls all loading of the askiing routines. need it not \if forget it create it debug off debug @ \if 108 #trls ! 186 is pts decimal 2 size 1- thru \ the following code checks to make sure that parameters are set before trying to execute the program ... #trls @ 0= pts 0= or \if .( Warning: Set #trls and pts before askiing) roadrunner cr \ beep! beep! -- gets your attention decimal \ screen 2 \ askiing \formatting ... : stroke ( a # --) \ show data on screen (debug on) or move to file (debug off). debug @ if type else putdata then ; : comma ( -- ascii) \ used to parse command line (file1,file2,scr#). ascii , ; : return ( --) \ used to indicate the end of each trial. 13 cto" stroke 10 cto" stroke ; : delimiter ( --) \ a space is used as the delimiter between data within a trial. " " stroke ; \ file control ... : getfiles ( --) \ use: getfiles file1,file2,scr#. \ where: file1 is known library file. \ file 2 is known or new file. \ scr# is the library file1 screen number where the data is store. \ (use Summary menu option 6 to display the contents of a library disk.) comma word count data open dup 0= if ( abort if file1 is not found) flush abort then is input bl word count 2dup screens open ?dup 0= if ( make file2 if it does not already exist) screens make else ( write over old file2) -rot 2drop then is output ; \ screen 3 \ continued : getcomment ( --) \ move the comment (entered during the Runtime program) to the file. 64 0 input 6 + 2! ram drop 64 getdata 2drop ram drop 64 stroke return ; : asciize ( --) \ this is the workhorse routine that actually does the transfer. ram erase 1k 0 ( dn = pointer into input file) 1 #trls @ bounds ?do 2dup input 6 + 2! 23 0 at i s>d 4 d.r ram drop pts getdata 2drop ram drop pts bounds ?do i c@ 0 <# #s #> stroke delimiter loop return ( dn) 1k 0 d+ nuf? ?leave loop ( dn) 2drop ; \ screen 4 \ continued : finale ( --) input close output close roadrunner ; : askiing ( --) \ this is the main execution word. \ use: askiiing file1=known,file2=known|new,scr#. \ much of this definition is devoted to the user interface. getfiles dark 0 0 at ." Processing trial number " 0 3 at ." Input file " input is default filename type 0 4 at ." Output file " output is default filename type 0 6 at ." Press <return> <return> to stop " 0 7 at ." Press any other key to pause, then again to resume" getcomment asciize output is default 0 9 at filesize d. ." bytes in output file" finale ; \ screen 5 \ \ dark \ Instructions: \ Type "flush<return"> \ You MUST set the parameters #TRLS and PTS: \ e.g., "108. #trls !<return> 186 is pts <return>" \ Then type "askiing file1,file2<return>", \ where file1 is a forth binary DATA file \ and file2 is to be the new ascii data file. \ Notes: \ File2 can already exist [it will be overwritten] \ or askiing will make file2 if it does not exist. \ You can repeat "askiing file3,file4<return>" as many \ times as you wish.