Ignore:
Timestamp:
Feb 28, 2017, 10:41:54 AM (7 years ago)
Author:
sommeria
Message:

correlation_time and correlation_x corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r977 r1002  
    730730                        if  strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x');
    731731                            ivar_U=nbvar+ivar;
    732                         elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y');
     732                        elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y');TriScatteredInterp
    733733                            ivar_V=nbvar+ivar;
    734734                        end
    735735                    end
    736                     ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles with continuous lines
     736                    ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles with continuoval(['us lines
    737737                end
    738738            elseif isequal(ProjMode,'interp_lin')  %filtering %linear interpolation:
    739739                if ~check_abscissa
    740740                    XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
    741                     ProjData.ListVarName=[ProjData.ListVarName {XName}];
     741                    ProjData.ListVarName=[ProjData.ListVarName {XName}];TriScatteredInterp
    742742                    ProjData.VarDimName=[ProjData.VarDimName {XName}];
    743743                    nbvar=numel(ProjData.ListVarName);
     
    811811            end%
    812812            test_interp2=0;%default
    813             AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
    814             AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
    815             AX=FieldData.(AXName);% set of x positions
    816             AY=FieldData.(AYName);% set of y positions
    817             AName=FieldData.ListVarName{VarIndex(1)};
    818             npxy=size(FieldData.(AName));
     813           
    819814            if max(NbDim)==3 % 3D case
     815                AZName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
     816                AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
     817                AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-2)};
     818                AX=FieldData.(AXName);% set of x positions
     819                AY=FieldData.(AYName);% set of y positions
     820                AZ=FieldData.(AZName);% set of z positions
     821                 AName=FieldData.ListVarName{VarIndex(1)};
     822                npxy=size(FieldData.(AName));
     823                npz=npxy(1);
     824                npy=npxy(2);
     825                npx=npxy(1);
     826                AXI=linspace(AX(1),AX(end), npx);%set of  x  positions for the interpolated input data
     827                AYI=linspace(AY(1),AY(end), npy);%set of  x  positions for the interpolated input data
     828                 AZI=linspace(AZ(1),AZ(end), npy);%set of  x  positions for the interpolated input data
     829                for ivar=VarIndex
     830                    VarName=FieldData.ListVarName{ivar};
     831                    FieldData.(VarName)=interp3(FieldData.(AXName),FieldData.(AYName),FieldData.(AZName),FieldData.(VarName),AXI,AYI,AZI);
     832
     833%                     vec_A=reshape(squeeze(FieldData.(FieldData.ListVarName{ivar})),npx*npy,nbcolor); %put the original image in colum
     834%                     if nbcolor==1
     835%                         vec_B(ind_in)=vec_A(ICOMB);
     836%                         vec_B(ind_out)=zeros(size(ind_out));
     837%                         A_out=reshape(vec_B,npY,npX);
     838%                         ProjData.(FieldData.ListVarName{ivar}) =sum(A_out,1)/npY;
     839%                     elseif nbcolor==3
     840%                         vec_B(ind_in,1:3)=vec_A(ICOMB,:);
     841%                         vec_B(ind_out,1)=zeros(size(ind_out));
     842%                         vec_B(ind_out,2)=zeros(size(ind_out));
     843%                         vec_B(ind_out,3)=zeros(size(ind_out));
     844%                         A_out=reshape(vec_B,npY,npX,nbcolor);
     845%                         ProjData.(FieldData.ListVarName{ivar})=squeeze(sum(A_out,1)/npY);
     846%                     end
     847                    ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}];
     848                    ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate
     849                    ProjData.VarAttribute{ivar}.Role='continuous';% for plot with continuous line
     850                end
     851               
     852               
     853               
     854               
    820855               
    821856            else
     857                AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
     858                AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
     859                AX=FieldData.(AXName);% set of x positions
     860                AY=FieldData.(AYName);% set of y positions
     861                AName=FieldData.ListVarName{VarIndex(1)};
     862                npxy=size(FieldData.(AName));
    822863                npx=npxy(2);
    823864                npy=npxy(1);
     
    860901                    XMin=0;
    861902                end
    862                 eval(['ProjData.' AXName '=linspace(XMin,XMin+linelength,linelength/DXY_line+1);'])%abscissa of the new pixels along the line
     903                ProjData.(AXName)=linspace(XMin,XMin+linelength,linelength/DXY_line+1);%abscissa of the new pixels along the line
    863904                y=linspace(-width,width,2*width/DXY_line+1);%ordintes of the new pixels (coordinate across the line)
    864                 eval(['npX=length(ProjData.' AXName ');'])
     905                npX=length(ProjData.(AXName));
    865906                npY=length(y); %TODO: utiliser proj_grid
    866                 eval(['[X,Y]=meshgrid(ProjData.' AXName ',y);'])%grid in the line coordinates
     907                [X,Y]=meshgrid(ProjData.(AXName),y);%grid in the line coordinates
    867908                XIMA=ObjectData.Coord(1,1)+(X-XMin)*cos(theta)-Y*sin(theta);
    868909                YIMA=ObjectData.Coord(1,2)+(X-XMin)*sin(theta)+Y*cos(theta);
     
    876917                ICOMB=(XIMA-1)*npy+YIMA;
    877918                ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A
    878                 nbcolor=1; %color images
    879919                if numel(npxy)==2
    880920                    nbcolor=1;
     
    886926                    return
    887927                end
    888                 nbvar=length(ProjData.ListVarName);% number of var from previous cells
    889928                ProjData.ListVarName=[ProjData.ListVarName {AXName}];
    890929                ProjData.VarDimName=[ProjData.VarDimName {AXName}];
     
    916955                end
    917956            end
    918 
    919 end
     957           
     958    end
    920959if ~isempty(ivar_U) && ~isempty(ivar_V)
    921960    vector_x =ProjData.(ProjData.ListVarName{ivar_U});
Note: See TracChangeset for help on using the changeset viewer.