Size: 292
Comment:
|
Size: 2301
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 10: | Line 10: |
------------------------------------------------------------------------------ #Bisher erzeugtes Programm: from pylab import * from scipy import * import time,calendar,os,pipes,struct,string import random import scipy.ndimage as ndi nk=3 #number of classes ndim=[100,100] #dimension of ASAR image in pixels fx0,fy0,fx2,fy2=[20.,100.,100.,10.] # freeboard coordinates from input file nf=11 #number of freeboard footprints fz_h=zeros(nf) #fz_h is the freeboard heights # produce a random array of freeboard heights for i in range(nf): fz_h[i]=random.random()*70 # the x,y positions of the freeboard footprints if fx2==fx0: fx=zeros(nf)+fx0 fy=linspace(0,ndim[1],nf) else: teta=(fy2-fy0)/(fx2-fx0) fx=linspace(fx0,fx2,nf) fy=(fx-fx0)*teta+fy0 #produce a random matrix of ASAR image classes (in 3 classes) a=zeros((ndim[0],ndim[1])) for i in range(ndim[0]): for j in range(ndim[1]): a[i,j]=int(random.random()*(nk)+1) #tranform from float to int #A=ndimage.gaussian_filter(a,1)+0.5 #B=A.astype(int) B=a.astype(int) #select the class of footprints from ASAR Image fz=zeros(nf) for i in range(nf): fz[i]=B[int(fx[i]-1),int(fy[i]-1)] #calculation of mean and standard deviation of freeboard heights in each class mean=zeros(nk) std_kl=zeros(nk) for kl in (1,2,3): s=(fz==kl) fh_kl=fz_h[s] mean[kl-1]=fh_kl.sum()/fh_kl.shape[0] std_kl[kl-1]=std(fh_kl) #plot mean and error bar kl=[1,2,3] bar(kl,mean,yerr=std_kl,ecolor='r',align='center') #calculate correlation coefficient #corr=xcorr(fz,fz_h,normed=True)[1][nf] figure() #plot ASAR image class together with freeboard heights x=arange(nf) bar(x,fz,align='center') ylim(0,6) ax=twinx() plot(x,fz_h,'r+-') xlim(-2,12) #plot ASAR image with freeboard flight figure() plot(fx,fy,'r+-',linewidth=2) xlim(0,100) ylim(0,100) colorbar() imshow(B,origin='lower',interpolation=None) hold(True) #figure() #imshow(a) show() |
die Besprechung ergab fuer diese Gruppe:
- Trockenprogrammierung: insbesondere die Konsistenz von Bildkoordinaten von ASAR und Freibord-Footprint klären die Klasseneinteilungen von ASAR und Freibordhöhen vergleichen Frage "welche Statistik will man anwenden" beantworten
#Bisher erzeugtes Programm:
from pylab import * from scipy import * import time,calendar,os,pipes,struct,string import random import scipy.ndimage as ndi
nk=3 #number of classes ndim=[100,100] #dimension of ASAR image in pixels
fx0,fy0,fx2,fy2=[20.,100.,100.,10.] # freeboard coordinates from input file nf=11 #number of freeboard footprints fz_h=zeros(nf) #fz_h is the freeboard heights # produce a random array of freeboard heights for i in range(nf):
- fz_h[i]=random.random()*70
# the x,y positions of the freeboard footprints if fx2==fx0:
- fx=zeros(nf)+fx0 fy=linspace(0,ndim[1],nf)
else:
- teta=(fy2-fy0)/(fx2-fx0) fx=linspace(fx0,fx2,nf) fy=(fx-fx0)*teta+fy0
#produce a random matrix of ASAR image classes (in 3 classes)
a=zeros((ndim[0],ndim[1])) for i in range(ndim[0]):
- for j in range(ndim[1]):
- a[i,j]=int(random.random()*(nk)+1)
#tranform from float to int
#A=ndimage.gaussian_filter(a,1)+0.5 #B=A.astype(int) B=a.astype(int)
#select the class of footprints from ASAR Image fz=zeros(nf) for i in range(nf):
- fz[i]=B[int(fx[i]-1),int(fy[i]-1)]
#calculation of mean and standard deviation of freeboard heights in each class mean=zeros(nk) std_kl=zeros(nk) for kl in (1,2,3):
- s=(fz==kl) fh_kl=fz_h[s] mean[kl-1]=fh_kl.sum()/fh_kl.shape[0] std_kl[kl-1]=std(fh_kl)
#plot mean and error bar kl=[1,2,3] bar(kl,mean,yerr=std_kl,ecolor='r',align='center')
#calculate correlation coefficient #corr=xcorr(fz,fz_h,normed=True)[1][nf]
figure() #plot ASAR image class together with freeboard heights x=arange(nf) bar(x,fz,align='center') ylim(0,6) ax=twinx() plot(x,fz_h,'r+-') xlim(-2,12)
#plot ASAR image with freeboard flight figure() plot(fx,fy,'r+-',linewidth=2) xlim(0,100) ylim(0,100) colorbar() imshow(B,origin='lower',interpolation=None) hold(True)
#figure() #imshow(a) show()