die Besprechung ergab fuer diese Gruppe:


   1 #project_plot
   2 from pylab import *
   3 from scipy import *
   4 import time,calendar,os,pipes,struct,string
   5 import random
   6 import scipy.ndimage as ndi
   7 from matplotlib.patches import Ellipse
   8 
   9 nk=5 #number of classes
  10 ndim=[1000,1000] #dimension of ASAR image in pixels
  11 res=12.5
  12 freeb_asar_pixels=int(60./res)# footprint of freeboard is 60m
  13 
  14 fx0,fy0,fx2,fy2=[0.2,1.,1.,0.1]
  15 fx0,fy0,fx2,fy2=fx0*ndim[0],fy0*ndim[0],fx2*ndim[0],fy2*ndim[0] # freeboard coordinates from input file
  16 dist=sqrt((fx2-fx0)**2+(fy2-fy0)**2)*res
  17 fdist=172 #distance of two freeboard footprints is 172m
  18 nf=int(dist/fdist)
  19 
  20 fz_h=zeros(nf) #fz_h is the freeboard heights
  21 # produce a random array of freeboard heights
  22 for i in range(nf):
  23    fz_h[i]=random.random()*70
  24 
  25 # the x,y positions of the freeboard footprints   
  26 if fx2==fx0:
  27    fx=zeros(nf)+fx0
  28    fy=linspace(0,ndim[1],nf)
  29 else:
  30    teta=(fy2-fy0)/(fx2-fx0)
  31    fx=linspace(fx0,fx2,nf)
  32    fy=(fx-fx0)*teta+fy0
  33 #produce a random matrix of ASAR image classes (in 3 classes)
  34 
  35 a=zeros((ndim[0],ndim[1]))
  36 for i in range(ndim[0]):
  37    for j in range(ndim[1]):
  38       a[i,j]=int(random.random()*(nk)+1)
  39 
  40 #tranform from float to int
  41 
  42 #A=ndimage.gaussian_filter(a,1)+0.5
  43 #B=A.astype(int)
  44 B=a.astype(int)
  45 
  46 #select the class of footprints from ASAR Image 
  47 fz=zeros(nf)
  48 for i in range(nf):
  49    fz[i]=B[int(fx[i]-1),int(fy[i]-1)]
  50 
  51 #calculation of mean and standard deviation of freeboard heights in each class
  52 mean=zeros(nk)
  53 std_kl=zeros(nk)
  54 for kl in range(1,6):
  55    s=(fz==kl)
  56    fh_kl=fz_h[s]
  57    mean[kl-1]=fh_kl.sum()/fh_kl.shape[0]
  58    std_kl[kl-1]=std(fh_kl) 
  59 
  60 #plot mean and error bar
  61 kl=arange(nk)+1
  62 bar(kl,mean,yerr=std_kl,ecolor='r',align='center')
  63 axis('tight')
  64 savefig('kl_mean_std', orientation='portrait', format='png')
  65  
  66 #calculate correlation coefficient   
  67 #corr=xcorr(fz,fz_h,normed=True)[1][nf]
  68 
  69 figure()
  70 #plot ASAR image class together with freeboard heights 
  71 x=arange(nf)
  72 bar(x,fz,width=0.3,align='center')
  73 ylim(0,10)
  74 ax=twinx()
  75 plot(x,fz_h,'r+-',ms=10,linewidth=1)
  76 ylim(0,70)
  77 savefig('asar_fb', orientation='portrait', format='png')
  78 
  79 #axis('tight')
  80 
  81 #plot ASAR image with freeboard flight
  82 figure()
  83 ct=zeros((nf,4))
  84 for i in range(nf):
  85    ct[i]=cm.gist_rainbow(int(fz_h[i]))
  86 ax=axes()
  87 ells=[Ellipse(xy=[fx[i],fy[i]],width=freeb_asar_pixels,height=freeb_asar_pixels) for i in xrange(nf)]
  88 n=0
  89 for e in ells:
  90    ax.add_artist(e)
  91    e.set_clip_box(ax.bbox)
  92    e.set_alpha(0.5)
  93    e.set_facecolor(ct[n])
  94    n+=1
  95 gray()
  96 imshow(B,origin='lower',interpolation=None)
  97 hold(True)
  98 #plot(fx,fy,'r+-',linewidth=2)
  99 xlim(400,600)
 100 ylim(500,700)
 101 #xlim(0,1000)
 102 #ylim(0,1000)
 103 colorbar()
 104 savefig('asar_fb_track', orientation='portrait', format='png')
 105 
 106 #figure()
 107 #imshow(a)
 108 show()

Figure 1 (class_mean_standard deviation):

kl_mean_std.png

Figure 2 (asar, freboard):

asar_fb.png

Figure 3 (asar, freeboard track):

asar_fb_track.png

Ziele für Mittwoch:

Mittwoch

asar_fb_track_RAW.png

Ziele für Donnerstag

Donnerstag