  This file gives an example of turning a sample submission 
  file (./detware/submission/nist/nist) into a meaningful 
  DET Curve, using only:

	   shell scripts,
	   "c" code,
	and
	   "gnuplot"


  This package untar's into the following file structure:

	./detware/readme.txt
	./detware/bin/
	./detware/bin/plot
	./detware/bin/hd_dcf
	./detware/key/fem97_release_v4.2
	./detware/key/mal97_release_v4.2
	./detware/key/release_v4.2.txt
	./detware/plt_data/
	./detware/scripts/A_separate_submission.sh
	./detware/scripts/B_divide_tar_non_by_hand.pl
	./detware/scripts/gnu_det.sh
	./detware/submission/
	./detware/submission/nist/
	./detware/submission/nist/nist


#####################################################################
#								    #
# NOTE:  What follows is a step by step example to produce a single #
#        Det-Curve.  						    #
#								    #
#	 Steps 1 and 2 are only performed once, while steps 3-6 may #
#	 be repeated for the various tests.		 	    #
#     								    #
#	 The script for step 2 "B_divide_tar_non_by_hand.pl" maybe  #
#        modified to perform some other partitioning. 		    #
#								    #
#####################################################################
	


Step 1:  Split up the original submission file.

        $> cd ./detware/submisssion/nist
	$> ../../scripts/A_separate_submission.sh nist


Step 2:  Divide each test by target and non-target trials.

	$> foreach f (`ls *_f_??`)
	foreach? ../../scripts/B_divide_tar_non_by_hand.pl ${f} ../../key/fem97_release_v4.2
	foreach? end
	$> foreach f (`ls *_m_??`)
	foreach? ../../scripts/B_divide_tar_non_by_hand.pl ${f} ../../key/mal97_release_v4.2
	foreach? end
         

Step 3:  Pool Data of Interest.

	$> cd ../../plt_data
        $> cat ../submission/nist/nist_30_?_2h.tarout >nist_tar
	$> cat ../submission/nist/nist_30_?_2h.non > nist_non

     step 3b: pull out just the probability scores.

        $> cat nist_tar | awk '{print $NF}' >TAR
	$> cat nist_non | awk '{print $NF}' >NON


Step 4:  Extract the points that will make up the DET curve

        $> ../bin/plot TAR NON DET_nist
        ntrue = 3050, nfalse = 50004, npts = 53053
	$> cat DET_nist.points | awk '{print $2,$3}' >cdet.points
        $> ../bin/hd_dcf nist_tar nist_non >nist.hd.points
	$> head -2 nist.hd.points | awk '{printf "%s ",$NF} END {printf "\n"}' >hd.points



Step 5:  Prepare the input file for gnuplot


	 Prepare the input file with an editor or with the following
	 few echo statements.

	 The format of the infile:
	
		<file_of_points> <color> <point_type> [OPTIONAL LEGEND TITLE]

		where:
			file_of_points -> the output from "plot"

			color ----------> green   blue   red    magenta  cyan  
					  yellow  black  brown  grey

			point_type -----> line    star   circle
				
	 NOTE:  If you DO NOT want the points to appear in the legend, leave
                off the "min_Cdet" and "hd_Cdet" title in the following 
	        statements.

	$> echo cdet.points black star min_Cdet >>infile
	$> echo hd.points black circle hd_Cdet >>infile
	$> echo DET_nist black line nist >infile
        $> ../scripts/gnu_det.sh "NIST 2-Handset 30-seconds Non-Training Line" infile >nist.plt
    

Step 6:  Run gnuplot

	$> gnuplot <nist.plt >nist.plt.ps
