head 3.8; access; symbols; locks; strict; comment @# @; 3.8 date 2007.06.29.00.42.51; author aki; state Exp; branches; next 3.7; 3.7 date 2007.06.28.05.04.30; author aki; state Exp; branches; next 3.6; 3.6 date 2007.06.27.00.28.42; author aki; state Exp; branches; next 3.5; 3.5 date 2007.06.26.05.52.15; author aki; state Exp; branches; next 3.4; 3.4 date 2007.06.26.05.22.04; author aki; state Exp; branches; next 3.3; 3.3 date 2007.06.26.02.07.29; author aki; state Exp; branches; next 3.2; 3.2 date 2007.06.22.06.55.14; author aki; state Exp; branches; next 3.1; 3.1 date 2007.06.21.08.14.22; author aki; state Exp; branches; next 2.14; 2.14 date 2007.06.21.06.56.24; author aki; state Exp; branches; next 2.13; 2.13 date 2007.06.21.06.05.20; author aki; state Exp; branches; next 2.12; 2.12 date 2007.06.21.05.38.12; author aki; state Exp; branches; next 2.11; 2.11 date 2007.06.21.04.17.38; author aki; state Exp; branches; next 2.10; 2.10 date 2007.06.21.02.33.45; author aki; state Exp; branches; next 2.9; 2.9 date 2007.06.21.02.25.43; author aki; state Exp; branches; next 2.8; 2.8 date 2007.06.21.02.03.58; author aki; state Exp; branches; next 2.7; 2.7 date 2007.06.21.01.30.21; author aki; state Exp; branches; next 2.6; 2.6 date 2007.06.20.08.41.37; author aki; state Exp; branches; next 2.5; 2.5 date 2007.06.20.07.54.58; author aki; state Exp; branches; next 2.4; 2.4 date 2007.06.20.06.40.05; author aki; state Exp; branches; next 2.3; 2.3 date 2007.06.20.06.27.19; author aki; state Exp; branches; next 2.2; 2.2 date 2007.06.20.05.02.41; author aki; state Exp; branches; next 2.1; 2.1 date 2007.06.20.02.20.34; author aki; state Exp; branches; next 1.1; 1.1 date 2007.06.12.06.30.43; author aki; state Exp; branches; next ; desc @@ 3.8 log @*** empty log message *** @ text @column: # make column f='vgs_n "Id(Mn)"' -@@cat |awk '\ function same(a,b,i){for(m=i=0;i<=length(a);i++)if(substr(a,i,1)==substr(b,i,1)){m++}{return (m==i)}} \ BEGIN{ \ for(i=2;i2)?"stepped":""; \ param[0] = NF ; \ for(i=1;i<=NF;i++){param[i]=$$i} \ }/^[^ ]/{ \ l[record++] = $$0 ; \ }BEGIN{ \ print "Title: * '$${HOSTNAME}' '$${PWD}'" ; \ "LANG= date"|getline; \ print "Date: "$$0 ; \ print "Plotname: Generated from a .rdb file" ; \ }END{ \ print "No. Variables: "param[0] ; \ print "No. Points: "record ; \ print "Offset: 0" ; \ print "Variables:" ; \ for(i=0;i2) { \ for(j=0;j"/dev/stderr" ; \ pline=$$0 ; \ }{ \ ZDY=zdy+1e-15 ; \ if($$0!=pline) \ { \ gsub(/\r/,"") ; \ dx = $$1 - zx ; \ zx = $$1 ; \ dy = $$2 - zy ; \ zy = $$2 ; \ ddy = dy - zdy ; \ zdy = dy ; \ printf"%g\t%g\t%g\t%g\n",$$1,$$2,dy,ddy >"/dev/stderr" ; \ if (record > 2 && ddy * zddy <= 0) \ { \ last_slope=dx/ZDY ; \ print "#slope"last_slope >"/dev/stderr" ; \ last_intercept=zx-dx*zy/ZDY ; \ print"#xintercept"last_intercept >"/dev/stderr" ; \ found++ ; \ } \ zddy=ddy ; \ record++ ; \ } \ pline=$$0 ; \ }END{ \ if (record > 0) \ { \ print " slope"," xintercept" ;\ print found?last_slope:dx/ZDY, \ found?last_intercept:zx-dx*zy/ZDY ; \ exit 0 \ } \ exit 1 \ }' 2>/dev/null dat: #gnuplot .dat file # make dat p=4 -@@cat |awk -v OFS='\t' -v p=$$p -F'\t' ' \ $$p!=l[p]{ \ print"" ; \ } { \ print ; \ split($$0,l) ; \ }' d: -@@cat |awk -v OFS='\t' -F'\t' ' \ /^#/{ \ gsub(/\r/,"") ; \ gsub("#","",$$NF) ;\ $$NF="#"$$NF"\t#d"$$NF ; \ print$$0 ; \ pline=$$0 ; \ }{ \ if($$0!=pline) \ { \ gsub(/\r/,"") ; \ print$$0,$$NF-last ; \ last = $$NF ; \ } \ pline=$$0 ; \ }' 2>/dev/null sxp: #make sxp x=4 y=6 [ #p1 #p2 ... #pn #x #y1 #y2 #y ... #dy #ddy ] -@@cat |awk -v OFS='\t' -v x=$$x -v y=$$y -F'\t' ' \ /^#/{ \ print $$0,"#slope","#xintercept" ; \ pline=$$0 ; \ }{ \ if($$0!=pline) \ { \ dx = $$x - zx ; \ zx = $$x ; \ dy = $$(NF-1) ; \ zy = $$y ; \ ddy = $$NF ; \ zdy = $$(NF-1) ; \ if (record > 2 && ddy * zddy <= 0) \ { \ ZDY=zdy+1e-15 ; \ last_slope=dx/ZDY ; \ last_intercept=zx-dx*zy/ZDY ; \ print $$0,last_slope,last_intercept ; \ } \ zddy = $$NF ; \ record ++ ; \ } \ pline=$$0 ; \ }' last: -@@ awk '$1!=p[1]||$2!=p[2]||$3!=p[3]{print pline}{split($0,p);pline=$0}' ltspice: # out -@@cat|awk ' \ NR==1{ \ for(i=1;i<=NF;i++){printf" "$$i;if(i!=NF){printf"\t"}}\ }/^Step/ && !headered++ { \ for(f=1;f<=NF;f++) if($$f~/=/) \ { \ param[0]++ ;\ label=$$f ;\ gsub("=.*$$","",label) ; \ printf"\t "label ; \ } \ printf"\n" ;\ }/^Step/{ \ p=0 ;\ for(f=1;f<=NF;f++) if($$f~/=/) \ { \ gsub("^.*=","",$$f);gsub("n$$","e-9",$$f); \ gsub("u$$","e-6",$$f);gsub("m$$","e-3",$$f); \ param[++p]=$$f ;\ } \ }/^\t/{ \ if(!headered++) {printf"\n"}\ sub("^\t","");printf$$0 ;\ if (param[0]) for(p=1;p<=param[0];p++) \ { \ printf"\t%s",param[p] \ } \ printf"\n" ;\ }'|tr -d '\r' @ 3.7 log @*** empty log message *** @ text @d1 22 d45 1 a45 41 -@@awk ' \ BEGIN{ \ print"plot \"-\" with lines" ; \ }END{ \ print"e" ; \ }/#/||/^ /{ \ next \ }{ \ print $$1,$$2 \ }' |gnuplot -persist s-vb: #vbs='Vbs' file='file vgs='Vgs' log='log(Id)' length='Lgate' make s-vb -@@set $$($(MAKE) -s steps f=$$vbs <${file}) ; \ >,vbs ; echo ' '$$1 >,vbs ;shift ; \ for i ;\ do echo $$i >>,vbs ;\ awk ' \ /^#/{ \ next \ }/^ /||$$'$${f}'=='$${i}'&&$$'$${l}'==200e-9{ \ print \ }' <${file} | \ cut -sf $$x,$$y | \ $(MAKE) -s sfactor-vth ; \ done | \ awk '/^ /{if(NR==1){print" "$$1}}/^[^ ]/{print$$1}' | \ paste ,vbs - | sort -g |$(MAKE) -s ascii ; -@@rm ,vbs field-name-with-paren: awk '/^#/{next}/^ /{for(i=1;i<=NF;i++)if($i~/^'Id\\\(Mn\\\)'$/){print$i}}' split.table |less row-extraction: awk -F'\t' '/^#/{next}/^ /{gsub("^"," ");p()}{gsub("u","e-6");gsub("n","e-9")}$1==0.4e-6{p()}function p(){print$2"\t"$5}' "/dev/stderr" ; \ d160 2 a161 19 dx = $$1 - zx ; \ zx = $$1 ; \ ddx = dx - zdx ; \ zdx = dx ; \ dy = $$2 - zy ; \ zy = $$2 ; \ ddy = dy - zdy ; \ zdy = dy ; \ printf"%g\t%g\t%g\t%g\n",$$1,$$2,dy,ddy >"/dev/stderr" ; \ if (record > 2 && ddy <= 0 && zddy >= 0) \ { \ ZDY=zdy+1e-15 ; \ last_slope=zdx/ZDY/2.3/.026 ; \ print "#slope"last_slope >"/dev/stderr" ; \ last_intercept=zx-zdx*zy/ZDY ; \ print"#xintercept"last_intercept >"/dev/stderr" ; \ } \ zddy=ddy ; \ record++ ; \ a163 8 }END{ \ if (record > 0) \ { \ print " slope\t xintercept" ;\ print last_slope"\t"last_intercept ; \ exit 0 \ } \ exit 1 \ d166 7 a172 9 column: # make column f='vgs_n "Id(Mn)"' -@@cat |awk '\ function same(a,b,i){for(m=i=0;i<=length(a);i++)if(substr(a,i,1)==substr(b,i,1)){m++}{return (m==i)}} \ BEGIN{ \ for(i=2;i 2 && ddy <= 0 && zddy >= 0) \ @ 3.4 log @*** empty log message *** @ text @d137 1 @ 3.3 log @*** empty log message *** @ text @d1 1 a1 1 gnuplot: #make gnuplot |gnuplot d4 1 a4 2 print"f(x)=(x-0.963124)/1161.64" ; \ print"plot [] [0:] f(x),\"-\"" ; \ d11 1 a11 1 }' d91 2 a92 2 slope-xintercept: -@@cat |awk ' \ a114 2 last_slope=zdx/ZDY ; \ last_intercept=zx-zdx*zy/ZDY ; \ d121 1 d130 3 a132 2 print " slope\t xintercept" ;\ print last_slope"\t"last_intercept ; \ @ 3.2 log @*** empty log message *** @ text @d4 2 a5 2 print"f(x)=(x-0.70163)/601915./2.3/.026" ; \ print"set term svg\nset out \"test.svg\"\nplot [0:1.8] f(x),\"-\"" ; \ d11 1 a11 1 print $$1,$$3 \ d92 47 @ 3.1 log @added s-vb demonstration @ text @d1 13 @ 2.14 log @*** empty log message *** @ text @d1 17 a17 3 vt-vg-vb: set $$($(MAKE) -s steps <${file}) ;name=$$1 ;shift ;echo $$name,$$# ;\ for i ;do echo $$i ;done d79 1 a79 1 slope_xintercept: @ 2.13 log @*** empty log message *** @ text @d1 4 d15 3 @ 2.12 log @*** empty log message *** @ text @d38 17 a54 2 for(i=0;i"/dev/stderr" ; \ d34 1 a34 1 print $$1" "$$2" "dy" "ddy >"/dev/stderr" ; \ d39 1 a39 1 print "-->"last_slope"<--" >"/dev/stderr" ; \ d41 1 a41 1 print "-->"last_intercept"<--" >"/dev/stderr" ; \ d100 1 a100 1 ltspice: out @ 2.9 log @added slope_xintercept @ text @d50 2 a51 2 print last_slope ; \ print last_intercept ; \ @ 2.8 log @*** empty log message *** @ text @d12 5 a16 8 slope: cat |awk ' \ NR==1{ \ if (NF < 2) \ { \ record = 0 ; \ exit 1 ; \ } \ d20 1 a20 1 }/^Step/{ \ d22 1 a22 19 gsub(/[):(]\r/,"") ; \ gsub(/[\/=]/," ") ; \ if ($$6>$$7) \ { \ record = 0 ; \ exit 1 ; \ } \ if ($$6=="1") \ { \ print $$6,$$3,$$4"\t"abscissa,ordinate >"/dev/stderr" ; \ step_var=$$3 ; \ step_value=$$4 ; \ record ++ ; \ } \ else if (record > 0) \ { \ exit 0 ; \ } \ }record&&/^ /{ \ d38 4 a41 10 if (ordinate ~ /log/) \ { \ last_slope=zdx/ZDY/2.3/.026 ; \ print "-->"last_slope"<--" >"/dev/stderr" \ } \ else \ { \ last_intercept=zx-zdx*zy/ZDY ; \ print "-->"last_intercept"<--" >"/dev/stderr" \ } \ d50 2 a51 12 sub(/n$$/,"e-9",step_value) ; \ sub(/u$$/,"e-6",step_value) ; \ sub(/m$$/,"e-3",step_value) ; \ printf step_var" "step_value" "ordinate ; \ if (ordinate ~ /log/) \ { \ print "_slope "last_slope \ } \ else \ { \ print "_intercept "last_intercept \ } \ @ 2.7 log @added list @ text @d12 83 a94 1 list: d115 1 a115 1 column: d137 1 a137 1 ltspice: @ 2.6 log @*** empty log message *** @ text @d12 21 @ 2.5 log @*** empty log message *** @ text @d11 1 d13 21 a33 1 cat |awk 'BEGIN{for(c=2;c