// $Id: condisconpowfig.hoc,v 1.3 2010/10/10 18:00:54 samn Exp $ 


// draw panels for condisconpowfig frontiers paper fig

if(!name_declared("nqbatch")) rcsopen("load.hoc",87)

if(g==nil) gg()

declare("nqf","o[2]","sidx",0,"nqfs","o[2]","winsz",201,"stdg",0.5)

for sidx=0,1 {
  nqf[sidx]=nqbatch.get("nqpmtm",sidx).o
  nqfs[sidx]=new NQS()
  nqfs[sidx].cp(nqf[sidx])
}

//* myfilt(code,vec) - code:0=gauss,1=triangle,2=box
proc myfilt () { local a localobj vx
  if($1==0) {
    a=allocvecs(vx)
    vx.indgen(-3,3,.03)
    gaussfilt($o2,stdg,vx)
  } else if($1==1) {
    triangfilt($o2,winsz)
  } else if($1==2) {
    boxfilt($o2,winsz)
  }
}

//* drit(code,filt)
proc drit () { local i,j,cc localobj lc
  {lc=new List() lc.append(new String("C%dintraE")) lc.append(new String("C%dintraI"))}
  {lc.append(new String("interE")) lc.append(new String("interI"))}
  if($1>=0 && $1<=1) {
    for i=0,1 for j=0,numcols-1 {
      sprint(tstr,lc.o($1).s,j)
      cc=nqfs[i].fi(tstr)
      nqfs[i].v[cc].copy(nqf[i].v[cc])
      myfilt($2,nqfs[i].v[cc])
      nqfs[i].gr(tstr,"f",0,i+1,1)
    }
  } else {
    tstr=lc.o($1).s
    print tstr
    cc=nqfs[i].fi(tstr)
    print cc
    for i=0,1 {      
      print i,cc
      nqfs[i].v[cc].copy(nqf[i].v[cc])
      print "A"
      myfilt($2,nqfs[i].v[cc])
      print "B"
      nqfs[i].gr(tstr,"f",0,i+1,1)
      print "C"
    }
  }
}