;	histv2.pro
;	29.5.1996 	P. Brandt
;	determines "positions" of fast/slow moving UDs
;	in umbral field by computing the histogram of
;	INTENSITY values at the locations of fast/slow
;	moving UDs

restore,'ave'
restore,'odo1'

ave=ave/10000.		; normalize to photosphere = 1.0
			; select only intensities </= 0.60
mask=ave le .60
ave1=ave*mask

histi=histogram(ave1,min=0.18,max=0.60,binsize=0.02)
histi1=100*histi/total(histi)	; values in % per bin

xh=0.19+indgen(22)*0.02
plot,xh,histi1,psym=10,yrange=[0,20],xrange=[0.10,0.70]

;	find positions of points where |v| le 0.1 km/s
xyposv=fix(where(odo1(5,*) le 0.1))
xpos=fix(odo1(1,xyposv))	& xpos=reform(xpos)	
ypos=fix(odo1(2,xyposv))	& ypos=reform(ypos)

;	find intensity of "ave" at these locations
intv1=reform(ave1(xpos,ypos))

;			make histogram of corresponding intensities
hi1=histogram(intv1,min=0.18,max=0.68,binsize=0.02)
print,'number of slow runners (< 0.1 km/s) = ',total(hi1)
hi1=100*hi1/total(hi1)
xh1=0.19+indgen(26)*0.02
oplot,xh1,hi1,psym=10,linestyle=2

;	find positions of points where |v| gt 0.4 km/s
xyposv=fix(where(odo1(5,*) gt 0.4))
xpos=fix(odo1(1,xyposv))	& xpos=reform(xpos)	
ypos=fix(odo1(2,xyposv))	& ypos=reform(ypos)

intv4=reform(ave1(xpos,ypos))
;			make histogram of corresponding
;			intensities
hi4=histogram(intv4,min=0.18,max=0.68,binsize=0.02)
print,'number of fast runners (> 0.4 km/s) = ',total(hi1)
hi4=100*hi4/total(hi4)
xh4=0.19+indgen(26)*0.02
oplot,xh4,hi4,psym=10,linestyle=1


end