diff toolboxes/bioakustik_tools/conversion/extract_buchfink_xls.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolboxes/bioakustik_tools/conversion/extract_buchfink_xls.m	Tue Feb 10 15:05:51 2015 +0000
@@ -0,0 +1,128 @@
+
+
+%seglengths
+%vols
+%periods
+%name
+
+% 
+% datlen=size(data,1);
+% maxseglen=10;
+% clear segvol;
+% clear seglengths;
+% clear repetitions;
+% clear name;
+% 
+% filectr=0;
+% lineptr=15;
+% 
+% while lineptr <= size(textdata,1)
+%     if ~strcmp('',textdata{lineptr,1}) 
+%         path = textdata{lineptr,1};
+%     end
+%     if ~strcmp('',textdata{lineptr,2}) 
+%         filectr=filectr+1;
+%         name{filectr} = strcat(path,'\',textdata{lineptr,2});
+%         datapos=lineptr-14;
+%         
+%         segctr=0;
+%         while ~isnan(data(datapos,2))&& datapos < datlen
+%             segctr=segctr+1;
+%             seglengths(filectr,segctr)= data(datapos,2);
+%             if ~isnan(data(datapos,3))
+%                 repetitions(filectr,segctr)=data(datapos,3);
+%             end
+%             segvol(filectr,segctr)=data(datapos,4);
+%             datapos=datapos+1;
+%             lineptr = lineptr+1;
+%         end
+%     end
+%     lineptr = lineptr+1;
+% end
+
+
+compl_len=sum(seglengths,2);%ins secs
+compl_std=std(compl_len);
+compl_mean=mean(compl_len);
+
+numsegs=seglengths>0;
+numsegs=sum(numsegs,2);
+meannumsegs=mean(numsegs)
+minnumsegs=min(numsegs)
+maxnumsegs=max(numsegs)
+
+for i=1:maxnumsegs %segmentlänge, betrachtet werden jeweils alle segs 
+                    % mit ausreichender länge
+    valid_cols=find(numsegs>=i);
+    mean_seglen(i)=mean(seglengths(valid_cols,i));
+    min_seglen(i)=min(seglengths(valid_cols,i));
+    max_seglen(i)=max(seglengths(valid_cols,i));
+    std_seglen(i)=std(seglengths(valid_cols,i));%in s
+end
+
+% valid_cols=find(numsegs==floor(meannumsegs));
+% for i=1:floor(mean(numsegs)) %segmentlänge, betrachtet werden jeweils alle segs 
+%                     % mit genau floor(mittlerer) länge
+%     mean_seglen2(i)=mean(seglengths(valid_cols,i));
+%     min_seglen2(i)=min(seglengths(valid_cols,i));
+%     max_seglen2(i)=max(seglengths(valid_cols,i));
+%     std_seglen2(i)=std(seglengths(valid_cols,i));%in s
+% end
+
+%längen
+seglen_all=reshape(seglengths,115*6,1);
+goodlens=find(seglen_all>0);
+mean_seglen_all=mean(seglen_all(goodlens));
+std_seglen_all=std(seglen_all(goodlens));
+for i=1:maxnumsegs
+    segs(i)=sum(numsegs==i);
+end
+
+period_segs=sum(repetitions>0,2);
+for i=1:maxnumsegs
+    havenumperiodsegs(i)=sum(period_segs==i);
+end
+segs_period=(repetitions>0);
+sum((period_segs==3)&(numsegs==4))
+sum((period_segs==2)&(numsegs==4))
+sum(((period_segs==4)&(numsegs==5)))
+sum(((period_segs==3)&(numsegs==5)))
+
+better_half_ind=find((period_segs==3)&(numsegs==4));
+better_half_len=seglengths(better_half_ind,:);
+better_half_mean=mean(better_half_len,1);
+better_half_std=std(better_half_len);
+
+%wiederholungen
+period_all=reshape(repetitions,115*6,1);
+goodreps=find(period_all>0);
+period_all=period_all(goodreps);
+peri_all_mean=mean(period_all);
+peri_all_std=std(period_all);
+
+%frequenzen
+freqs = repetitions./(seglengths./1000);
+freqs_all=reshape(freqs,115*6,1);
+freqs_all=freqs_all(find(~isnan(freqs_all) & (freqs_all>0)));
+freqs_all_mean=mean(freqs_all);
+freqs_all_std=std(freqs_all);
+
+
+better_h_f=repetitions(better_half_ind,2:4)./(seglengths(better_half_ind,2:4)./1000);
+better_h_f_mean=mean(better_h_f);
+better_h_f_std=std(better_h_f);
+better_h_f_min=min(better_h_f);
+better_h_f_max=max(better_h_f);
+
+better_half2_ind=find((period_segs==4)&(numsegs==5));
+
+better_h2_f=repetitions(better_half2_ind,2:5)./(seglengths(better_half2_ind,2:5)./1000);
+better_h2_f_mean=mean(better_h2_f);
+better_h2_f_std=std(better_h2_f);
+better_h2_f_min=min(better_h2_f);
+better_h2_f_max=max(better_h2_f);
+
+abweichung_f=better_h_f-repmat(better_h_f_mean,size(better_h_f,1),1);
+corrcoef(abweichung_f)
+abweichung2_f=better_h2_f-repmat(better_h2_f_mean,size(better_h2_f,1),1);
+corrcoef(abweichung2_f)