1 |
PRO IWEED, icasea |
2 |
|
3 |
idldir='$JSOCROOT/proj/globalhs/scripts/idl/' |
4 |
|
5 |
if (icasea le 2) then begin |
6 |
iasym=0 |
7 |
nm=24 |
8 |
paroff=7 |
9 |
sigoff=5 |
10 |
aoff=11 |
11 |
y0=0.30 |
12 |
dy=0.10 |
13 |
endif else begin |
14 |
iasym=1 |
15 |
nm=26 |
16 |
paroff=8 |
17 |
sigoff=6 |
18 |
aoff=13 |
19 |
y0=0.36 |
20 |
dy=0.09 |
21 |
end |
22 |
|
23 |
infile='xxx' |
24 |
nin=0l |
25 |
read,infile,prompt='Input file: ' |
26 |
spawn,'wc -l '+infile,help |
27 |
reads,help,nin |
28 |
x=dblarr(nm,nin) |
29 |
openr,1,infile |
30 |
readf,1,x |
31 |
close,1 |
32 |
|
33 |
lx=x(0,*) |
34 |
nx=x(1,*) |
35 |
fx=x(2,*) |
36 |
wx=fx/(lx+0.5) |
37 |
|
38 |
reffile='xxx' |
39 |
nref=0l |
40 |
read,reffile,prompt='Reference file: ' |
41 |
if (strlen(reffile) ne 0) then begin |
42 |
spawn,'wc -l '+reffile,help |
43 |
reads,help,nref |
44 |
z=dblarr(nm,nref) |
45 |
openr,1,reffile |
46 |
readf,1,z |
47 |
close,1 |
48 |
|
49 |
lz=z(0,*) |
50 |
fz=z(2,*) |
51 |
wz=fz/(lz+0.5) |
52 |
end |
53 |
|
54 |
q=dblarr(9,4627) |
55 |
openr,1,idldir+'a0' |
56 |
readf,1,q |
57 |
close,1 |
58 |
iq=intarr(320,50)-1 |
59 |
for i=0,4626 do iq(q(0,i),q(1,i))=i |
60 |
a=q(3:8,iq(lx,nx)) |
61 |
|
62 |
erase |
63 |
color0=!p.color |
64 |
tvlct,255,0,0,10 |
65 |
|
66 |
ia0=0 |
67 |
ia=1 |
68 |
|
69 |
mask=intarr(nin) |
70 |
|
71 |
repeat begin |
72 |
redraw=0 |
73 |
wgood=where(mask eq 0) |
74 |
wbad=where(mask ne 0,nbad) |
75 |
|
76 |
if (ia gt 0) then begin |
77 |
if (ia ne ia0) then begin |
78 |
xmin=0.9*min(wx(where(lx ne 0))) |
79 |
xmax=1.1*max(wx(where(lx ne 0))) |
80 |
end |
81 |
plot_oi,wx(wgood),x(aoff+ia,wgood),psym=6,xstyle=1,xrange=[xmin,xmax],/nodata,title=infile+', ia='+string(ia,format='(i2)') |
82 |
if (nbad ne 0) then begin |
83 |
!p.color=255 |
84 |
oplot,wx(wbad),x(aoff+ia,wbad),psym=6 |
85 |
errplot,wx(wbad),x(aoff+ia,wbad)-x(aoff+6+ia,wbad),x(aoff+ia,wbad)+x(aoff+6+ia,wbad),width=0.001 |
86 |
oplot,wx(wbad),a(ia-1,wbad),psym=1 |
87 |
!p.color=color0 |
88 |
end |
89 |
oplot,wx(wgood),x(aoff+ia,wgood),psym=6 |
90 |
if (nref ne 0) then oplot,wz,z(aoff+ia,*),psym=4 |
91 |
errplot,wx(wgood),x(aoff+ia,wgood)-x(aoff+6+ia,wgood),x(aoff+ia,wgood)+x(aoff+6+ia,wgood),width=0.001 |
92 |
oplot,wx(wgood),a(ia-1,wgood),psym=1 |
93 |
q=convert_coord(wx,x(aoff+ia,*),/data,/to_normal) |
94 |
wxn=reform(q(0,*)) |
95 |
xn=reform(q(1,*)) |
96 |
ymin=!y.crange[0] |
97 |
ymax=!y.crange[1] |
98 |
endif else begin |
99 |
; A or w |
100 |
if (ia ne ia0) then begin |
101 |
xmin=0.9*min(fx) |
102 |
xmax=1.1*max(fx) |
103 |
end |
104 |
if ((iasym eq 0) or (ia ne -1)) then begin |
105 |
plot_io,fx(wgood),x(paroff+ia,wgood),psym=6,xstyle=1,xrange=[xmin,xmax],/nodata,title=infile+', ia='+string(ia,format='(i2)'),ystyle=3 |
106 |
endif else begin |
107 |
plot,fx(wgood),x(paroff+ia,wgood),psym=6,xstyle=1,xrange=[xmin,xmax],/nodata,title=infile+', ia='+string(ia,format='(i2)'),ystyle=3 |
108 |
end |
109 |
if (nbad ne 0) then begin |
110 |
!p.color=255 |
111 |
oplot,fx(wbad),x(paroff+ia,wbad),psym=6 |
112 |
errplot,fx(wbad),x(paroff+ia,wbad)-x(paroff+sigoff+ia,wbad),x(paroff+ia,wbad)+x(paroff+sigoff+ia,wbad),width=0.001 |
113 |
!p.color=color0 |
114 |
end |
115 |
oplot,fx(wgood),x(paroff+ia,wgood),psym=6 |
116 |
if (nref ne 0) then oplot,fz,z(paroff+ia,*),psym=4 |
117 |
errplot,fx(wgood),x(paroff+ia,wgood)-x(paroff+sigoff+ia,wgood),x(paroff+ia,wgood)+x(paroff+sigoff+ia,wgood),width=0.001 |
118 |
q=convert_coord(fx,x(paroff+ia,*),/data,/to_normal) |
119 |
fxn=reform(q(0,*)) |
120 |
xn=reform(q(1,*)) |
121 |
if ((iasym eq 0) or (ia ne -1)) then begin |
122 |
ymin=10^!y.crange[0] |
123 |
ymax=10^!y.crange[1] |
124 |
endif else begin |
125 |
ymin=!y.crange[0] |
126 |
ymax=!y.crange[1] |
127 |
end |
128 |
end |
129 |
|
130 |
ia0=ia |
131 |
|
132 |
xyouts,0.03,y0-(2+iasym)*dy,'A',/normal,alignment=0.5 |
133 |
xyouts,0.03,y0-(1+iasym)*dy,'w',/normal,alignment=0.5 |
134 |
if (iasym ne 0) then xyouts,0.03,y0-(0+iasym)*dy,'S',/normal,alignment=0.5 |
135 |
xyouts,0.03,y0,'X',/normal,alignment=0.5 |
136 |
for i=1,6 do xyouts,0.03,y0+i*dy,string(i,format='(i1)'),/normal,alignment=0.5 |
137 |
|
138 |
repeat begin |
139 |
cursor,xcn,ycn,/up,/normal |
140 |
q=convert_coord(xcn,ycn,/normal,/data) |
141 |
xc=q(0) |
142 |
yc=q(1) |
143 |
if ((yc ge ymin) and (yc le ymax)) then begin |
144 |
if ((xc ge xmin) and (xc le xmax)) then begin |
145 |
; Datapoint |
146 |
if (ia gt 0) then begin |
147 |
d=min((wxn-xcn)^2+(xn-ycn)^2,imin) |
148 |
if (mask(imin) eq 0) then begin |
149 |
mask(imin)=ia |
150 |
plots,wx(imin),x(aoff+ia,imin),psym=6,color=255 |
151 |
plots,wx(imin),a(ia-1,imin),psym=1,color=255 |
152 |
print,x([0,1,2,aoff+ia,aoff+6+ia],imin),format='("-",2i4,f10.4,99g14.6)' |
153 |
endif else begin |
154 |
mask(imin)=0 |
155 |
plots,wx(imin),x(aoff+ia,imin),psym=6 |
156 |
plots,wx(imin),a(ia-1,imin),psym=1 |
157 |
print,x([0,1,2,aoff+ia,aoff+6+ia],imin),format='("+",2i4,f10.4,99g14.6)' |
158 |
end |
159 |
endif else begin |
160 |
; A or w |
161 |
d=min((fxn-xcn)^2+(xn-ycn)^2,imin) |
162 |
if (mask(imin) eq 0) then begin |
163 |
mask(imin)=ia |
164 |
plots,fx(imin),x(paroff+ia,imin),psym=6,color=255 |
165 |
print,x([0,1,2,paroff+ia,paroff+sigoff+ia],imin),format='("-",2i4,3f10.4)' |
166 |
endif else begin |
167 |
mask(imin)=0 |
168 |
plots,fx(imin),x(paroff+ia,imin),psym=6 |
169 |
print,x([0,1,2,paroff+ia,paroff+sigoff+ia],imin),format='("+",2i4,3f10.4)' |
170 |
end |
171 |
end |
172 |
endif else begin |
173 |
if (xc le xmin) then begin |
174 |
; Change plot |
175 |
ia=round((ycn-y0)/dy)<6 |
176 |
if (iasym eq 0) then begin |
177 |
if (ia lt 0) then ia=ia-2 |
178 |
endif else begin |
179 |
if (ia lt (-1)) then ia=ia-2 |
180 |
end |
181 |
redraw=1 |
182 |
end |
183 |
end |
184 |
endif else begin |
185 |
; Change range |
186 |
if (yc le ymin) then begin |
187 |
if (xc le xmin) then begin |
188 |
if (ia gt 0) then xmin=xmin/2 else xmin=xmin-1000 |
189 |
endif else begin |
190 |
if (xc le xmax) then xmin=xc |
191 |
end |
192 |
endif else begin |
193 |
if (xc ge xmax) then begin |
194 |
if (ia gt 0) then xmax=xmax*2 else xmax=xmax+1000 |
195 |
endif else begin |
196 |
if (xc ge xmin) then xmax=xc |
197 |
end |
198 |
end |
199 |
redraw=1 |
200 |
end |
201 |
endrep until (redraw ne 0) |
202 |
|
203 |
endrep until (ia eq 0) |
204 |
|
205 |
loadct,0 |
206 |
|
207 |
wgood=where(mask eq 0,ngood) |
208 |
print,'Input file: ',infile |
209 |
outfile='xxx' |
210 |
nout=0l |
211 |
read,outfile,prompt='Output file: ' |
212 |
if (strlen(outfile) ne 0) then begin |
213 |
openw,1,outfile |
214 |
for i=0,ngood-1 do begin |
215 |
if (icasea le 2) then begin |
216 |
printf,1,x(*,wgood(i)),format='(2i4,f10.4,f10.4,4f8.4,2f9.4,f10.4,f9.4,f10.4,99g14.6)' |
217 |
endif else begin |
218 |
printf,1,x(*,wgood(i)),format='(2i4,f10.4,f10.4,3f8.4,g14.6,f8.4,2f9.4,f10.4,f9.4,g14.6,f10.4,99g14.6)' |
219 |
end |
220 |
end |
221 |
close,1 |
222 |
end |
223 |
print,nin,ngood |
224 |
|
225 |
end |