set fileContentList { {} { % This file is interpreted by tcl so each LaTeX back slash must be duplicated % \\documentclass[brazilian,PublicacaoLivro,SemFormatacaoCapitulo,SemFolhaAprovacao]{http://urlib.net/iconet.com.br/banon/2008/03.25.01.19/tdiinpe} \\documentclass[brazilian,PublicacaoLivro,SemFormatacaoCapitulo,SemFolhaAprovacao]{tdiinpe} \\repositorio{$thisRepository} %% repositório onde está depositado o documento \\RequirePackage{comment} % In order to distinguish between LaTeX and tcl square brackets, tcl square brackets must be duplicated \\begin{comment} % hiding tcl script from LaTeX [[ # TCL LIBRARY proc CreateDataSet {args} { set i 0 set data {} foreach input [[lindex $args 0]] { set line {} foreach list $args { lappend line [[lindex $list $i]] } lappend data $line incr i } return [[join $data \n]] } # erf -- # The error function # Arguments: # x The value for which the function must be evaluated # Result: # erf(x) # Note: # The algoritm used is due to George Marsaglia # See: http://www.velocityreviews.com/forums/t317358-erf-function-in-c.html # I did not want to copy and convert the even more accurate but # rather lengthy algorithm used by lcc-win32/Sun # proc erf {x} { set x [[expr {$x*sqrt(2.0)}]] if {$x > 10.0} {return 1.0} if {$x < -10.0} {return -1.0} set a 1.2533141373155 set b -1.0 set pwr 1.0 set t 0.0 set z 0.0 set s [[expr {$a+$b*$x}]] set i 2 while {$s != $t} { set a [[expr {($a+$z*$b)/double($i)}]] set b [[expr {($b+$z*$a)/double($i+1)}]] set pwr [[expr {$pwr*$x*$x}]] set t $s set s [[expr {$s+$pwr*($a+$x*$b)}]] incr i 2 } return [[expr {1.0-2.0*$s*exp(-0.5*$x*$x-0.9189385332046727418)}]] } proc Mean {xList} { set Mean 0. foreach x $xList {set Mean [[expr $Mean + $x]]} return [[expr $Mean / [[llength $xList]]]] } proc Variance {xList} { set Mean [[Mean $xList]] set Variance 0. foreach x $xList {set Variance [[expr $Variance + pow(($x - $Mean), 2)]]} return [[expr $Variance / ([[llength $xList]] - 1)]] } proc StandardDeviation {xList} { return [[expr sqrt([[Variance $xList]])]] } # LIST OF FIGURES TO BE UPDATED set figuresToBeUpdatedList {specificity} # set figuresToBeUpdatedList {} ]] [[ # PREPARE DATA FOR FIGURE 1 if {[[lsearch $figuresToBeUpdatedList specificity]] != -1} { set firstValue 8.5 set lastValue 11.5 set increment 0.01 set thresholdList {} for {set i $firstValue} {$i <= $lastValue} {set i [[expr $i + $increment]]} { lappend thresholdList [[format %2.2f $i]] } # Specificity # LOAD VHSInterobservadorNormais.txt (must be a one line file) set specificityDataList [[Execute $serverAddressWithIP [[list Load2 $thisRepository VHSInterobservadorNormais.txt $writeUserCodedPassword doc]] 0]] regsub -all {,} $specificityDataList {.} specificityDataList2 set soundMean [[Mean $specificityDataList2]] set soundStandardDeviation [[StandardDeviation $specificityDataList2]] } ]] \\end{comment} \\input{./preamble} %% faça as modificações pertinentes no arquivo preamble.tex \\begin{document} \\input{./document} \\end{document} } [[ set dynamicList {} # CREATE FIGURE 1 # ===== specificity.pdf ===== # if {[[lsearch $figuresToBeUpdatedList specificity]] != -1} { lappend dynamicList {specificity.dat} lappend dynamicList \ [[ # tcl script set alpha 1 # Specificity set weightedSpecificityList {} foreach value $thresholdList { lappend weightedSpecificityList [[expr (0.5 + 0.5 * [[erf [[expr ($value - $soundMean) / $soundStandardDeviation]]]]) * 100 * $alpha]] } set graphymove 0 set graphxsize 6.2 set graphysize 4.2 set dxticks 0.5 set dyticks 10 CreateDataSet $thresholdList $weightedSpecificityList ]] lappend dynamicList {specificity.gle} lappend dynamicList \ " ! gle script - this script is executed in CreateTclPageFile (see col/dpi.inpe.br/banon/1998/08.02.08.56/doc/utilities1.tcl) size $graphxsize [[expr $graphysize * 0.92 + $graphymove]] set font ss lwidth 0.01 set alabeldist .8 amove 0 $graphymove begin graph size $graphxsize $graphysize center data \"specificity.dat\" xtitle \"Valor observado\" ytitle \"Porcentagem\" xaxis dticks $dxticks dsubticks $dxticks min $firstValue max $lastValue grid yaxis dticks $dyticks dsubticks $dyticks min 0 max 100 grid xticks lwidth .005 yticks lwidth .005 xlabels hei .16 ylabels hei .16 d1 line smooth color blue lwidth 0.02 end graph " # ===== soundData.tex ===== # lappend dynamicList {soundData.tex} lappend dynamicList \ [[ join $specificityDataList {; } ]]% # ===== soundMean.tex ===== # lappend dynamicList {soundMean.tex} lappend dynamicList [[format %2.2f $soundMean]]% # ===== soundStandardDeviation.tex ===== # lappend dynamicList {soundStandardDeviation.tex} lappend dynamicList [[format %2.2f $soundStandardDeviation]]% } set dynamicList ]] }