Changeset 1137
- Timestamp:
- Apr 24, 2024, 7:45:09 PM (6 months ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field_tps.m
r1127 r1137 108 108 109 109 %% loop on subdomains 110 NbSubDomain 110 111 for isub=1:NbSubDomain 111 112 nbvec_sub=NbCentre(isub); 112 113 check_range=(Coord_interp >=ones(nb_sites,1)*SubRange(:,1,isub)' & Coord_interp<=ones(nb_sites,1)*SubRange(:,2,isub)'); 113 ind_sel=find(sum(check_range,2)==nb_coord);% select points whose all coordinates are in the prescribed range 114 nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap) 114 ind_sel=find(sum(check_range,2)==nb_coord);% select points whose all coordinates are in the prescribed range 115 x_width=(SubRange(1,2,isub)-SubRange(1,1,isub))/pi;%width of the subdomain/pi 116 y_width=(SubRange(2,2,isub)-SubRange(2,1,isub))/pi;%width of the subdomain/pi 117 CentreX=(SubRange(1,2,isub)+SubRange(1,1,isub))/2;%centre of the subdomain 118 CentreY=(SubRange(2,2,isub)+SubRange(2,1,isub))/2; 119 x_dist=(Coord_interp(ind_sel,1)-CentreX)/x_width;% relative x distance to the retangle centre*pi/2 120 y_dist=(Coord_interp(ind_sel,2)-CentreY)/y_width;% relative ydistance to the retangle centre 121 weight=cos(x_dist).*cos(y_dist);%weighting fct =1 at the rectangle center and 0 at edge 122 nbval(ind_sel)=nbval(ind_sel)+weight;% records the number of values for eacn interpolation point (in case of subdomain overlap) 115 123 if check_grid 116 124 EM = tps_eval(Coord_interp(ind_sel,:),Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the velocity from tps 'sources' … … 122 130 switch FieldName{ilist} 123 131 case 'vec(U,V)' 124 DataOut.U(ind_sel)=DataOut.U(ind_sel)+ EM *FieldVar(1:nbvec_sub+3,isub,1);125 DataOut.V(ind_sel)=DataOut.V(ind_sel)+ EM *FieldVar(1:nbvec_sub+3,isub,2);132 DataOut.U(ind_sel)=DataOut.U(ind_sel)+weight.*EM *FieldVar(1:nbvec_sub+3,isub,1); 133 DataOut.V(ind_sel)=DataOut.V(ind_sel)+weight.*EM *FieldVar(1:nbvec_sub+3,isub,2); 126 134 case 'U' 127 DataOut.U(ind_sel)=DataOut.U(ind_sel)+ EM *FieldVar(1:nbvec_sub+3,isub,1);135 DataOut.U(ind_sel)=DataOut.U(ind_sel)+weight.*EM *FieldVar(1:nbvec_sub+3,isub,1); 128 136 case 'V' 129 DataOut.V(ind_sel)=DataOut.V(ind_sel)+ EM *FieldVar(1:nbvec_sub+3,isub,2);137 DataOut.V(ind_sel)=DataOut.V(ind_sel)+weight.*EM *FieldVar(1:nbvec_sub+3,isub,2); 130 138 case 'norm(U,V)' 131 U=DataOut.U(ind_sel)+ EM *FieldVar(1:nbvec_sub+3,isub,1);132 V=DataOut.V(ind_sel)+ EM *FieldVar(1:nbvec_sub+3,isub,2);139 U=DataOut.U(ind_sel)+weight.*EM *FieldVar(1:nbvec_sub+3,isub,1); 140 V=DataOut.V(ind_sel)+weight.*EM *FieldVar(1:nbvec_sub+3,isub,2); 133 141 DataOut.norm(ind_sel)=sqrt(U.*U+V.*V); 134 142 case 'curl(U,V)' 135 DataOut.curl(ind_sel)=DataOut.curl(ind_sel)- EMDY *FieldVar(1:nbvec_sub+3,isub,1)+EMDX *FieldVar(1:nbvec_sub+3,isub,2);143 DataOut.curl(ind_sel)=DataOut.curl(ind_sel)-weight.*EMDY *FieldVar(1:nbvec_sub+3,isub,1)+weight.*EMDX *FieldVar(1:nbvec_sub+3,isub,2); 136 144 case 'div(U,V)' 137 DataOut.div(ind_sel)=DataOut.div(ind_sel)+ EMDX*FieldVar(1:nbvec_sub+3,isub,1)+EMDY *FieldVar(1:nbvec_sub+3,isub,2);145 DataOut.div(ind_sel)=DataOut.div(ind_sel)+weight.*EMDX*FieldVar(1:nbvec_sub+3,isub,1)+EMDY *FieldVar(1:nbvec_sub+3,isub,2); 138 146 case 'strain(U,V)' 139 DataOut.strain(ind_sel)=DataOut.strain(ind_sel)+ EMDY*FieldVar(1:nbvec_sub+3,isub,1)+EMDX *FieldVar(1:nbvec_sub+3,isub,2);147 DataOut.strain(ind_sel)=DataOut.strain(ind_sel)+weight.*EMDY*FieldVar(1:nbvec_sub+3,isub,1)+EMDX *FieldVar(1:nbvec_sub+3,isub,2); 140 148 case 'DUDX(U,V)' 141 DataOut.DUDX(ind_sel)=DataOut.DUDX(ind_sel)+ EMDX *FieldVar(1:nbvec_sub+3,isub,1);149 DataOut.DUDX(ind_sel)=DataOut.DUDX(ind_sel)+weight.*EMDX *FieldVar(1:nbvec_sub+3,isub,1); 142 150 case 'DUDY(U,V)' 143 DataOut.DUDY(ind_sel)=DataOut.DUDY(ind_sel)+ EMDY*FieldVar(1:nbvec_sub+3,isub,1);151 DataOut.DUDY(ind_sel)=DataOut.DUDY(ind_sel)+weight.*EMDY*FieldVar(1:nbvec_sub+3,isub,1); 144 152 case 'DVDX(U,V)' 145 DataOut.DVDX(ind_sel)=DataOut.DVDX(ind_sel)+ EMDX*FieldVar(1:nbvec_sub+3,isub,2);153 DataOut.DVDX(ind_sel)=DataOut.DVDX(ind_sel)+weight.*EMDX*FieldVar(1:nbvec_sub+3,isub,2); 146 154 case 'DVDY(U,V)' 147 DataOut.DVDY(ind_sel)=DataOut.DVDY(ind_sel)+ EMDY *FieldVar(1:nbvec_sub+3,isub,2);155 DataOut.DVDY(ind_sel)=DataOut.DVDY(ind_sel)+weight.*EMDY *FieldVar(1:nbvec_sub+3,isub,2); 148 156 end 149 157 end -
trunk/src/filter_tps.m
r1135 r1137 95 95 break % go to next subdomain 96 96 % if too few selected vectors, increase the subrange for next iteration 97 elseif numel(ind_sel)<SubDomainSize/4 && ~isequal( ind_sel,ind_sel_previous) ;97 elseif numel(ind_sel)<SubDomainSize/4 && ~isequal( ind_sel,ind_sel_previous) 98 98 SubRange(:,1,isub)=SubRange(:,1,isub)-Siz'/4; 99 99 SubRange(:,2,isub)=SubRange(:,2,isub)+Siz'/4; … … 112 112 % if no value exceeds threshold, the result is recorded 113 113 if isequal(numel(ind_ind_sel),numel(ind_sel)) 114 U_smooth(ind_sel)=U_smooth(ind_sel)+U_smooth_sub; 115 V_smooth(ind_sel)=V_smooth(ind_sel)+V_smooth_sub; 114 x_width=(SubRange(1,2,isub)-SubRange(1,1,isub))/pi; 115 y_width=(SubRange(2,2,isub)-SubRange(2,1,isub))/pi; 116 x_dist=(Coord(ind_sel,1)-CentreX(isub))/x_width;% relative x distance to the retangle centre 117 y_dist=(Coord(ind_sel,2)-CentreY(isub))/y_width;% relative ydistance to the retangle centre 118 weight=cos(x_dist).*cos(y_dist);%weighting fct =1 at the rectangle center and 0 at edge 119 U_smooth(ind_sel)=U_smooth(ind_sel)+weight.*U_smooth_sub; 120 V_smooth(ind_sel)=V_smooth(ind_sel)+weight.*V_smooth_sub; 116 121 NbCentre(isub)=numel(ind_sel); 117 122 Coord_tps(1:NbCentre(isub),:,isub)=Coord(ind_sel,:); 118 123 U_tps(1:NbCentre(isub)+3,isub)=U_tps_sub; 119 124 V_tps(1:NbCentre(isub)+3,isub)=V_tps_sub; 120 nb_select(ind_sel)=nb_select(ind_sel)+ 1;125 nb_select(ind_sel)=nb_select(ind_sel)+weight; 121 126 display(['tps done in subdomain # ' num2str(isub) ' among ' num2str(NbSubDomain)]) 122 127 break 123 128 % if too few selected vectors, increase the subrange for next iteration 124 elseif numel(ind_ind_sel)<SubDomainSize/4 && ~isequal( ind_sel,ind_sel_previous) ;129 elseif numel(ind_ind_sel)<SubDomainSize/4 && ~isequal( ind_sel,ind_sel_previous) 125 130 SubRange(:,1,isub)=SubRange(:,1,isub)-Siz'/4; 126 131 SubRange(:,2,isub)=SubRange(:,2,isub)+Siz'/4; … … 129 134 [U_smooth_sub,U_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel),:),U(ind_sel(ind_ind_sel)),rho); 130 135 [V_smooth_sub,V_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel),:),V(ind_sel(ind_ind_sel)),rho); 131 U_smooth(ind_sel(ind_ind_sel))=U_smooth(ind_sel(ind_ind_sel))+U_smooth_sub; 132 V_smooth(ind_sel(ind_ind_sel))=V_smooth(ind_sel(ind_ind_sel))+V_smooth_sub; 136 x_width=(SubRange(1,2,isub)-SubRange(1,1,isub))/pi; 137 y_width=(SubRange(2,2,isub)-SubRange(2,1,isub))/pi; 138 x_dist=(Coord(ind_sel(ind_ind_sel),1)-CentreX(isub))/x_width;% relative x distance to the retangle centre 139 y_dist=(Coord(ind_sel(ind_ind_sel),2)-CentreY(isub))/y_width;% relative ydistance to the retangle centre 140 weight=cos(x_dist).*cos(y_dist);%weighting fct =1 at the rectangle center and 0 at edge 141 U_smooth(ind_sel(ind_ind_sel))=U_smooth(ind_sel(ind_ind_sel))+weight.*U_smooth_sub; 142 V_smooth(ind_sel(ind_ind_sel))=V_smooth(ind_sel(ind_ind_sel))+weight.*V_smooth_sub; 133 143 NbCentre(isub)=numel(ind_ind_sel); 134 144 Coord_tps(1:NbCentre(isub),:,isub)=Coord(ind_sel(ind_ind_sel),:); 135 145 U_tps(1:NbCentre(isub)+3,isub)=U_tps_sub; 136 146 V_tps(1:NbCentre(isub)+3,isub)=V_tps_sub; 137 nb_select(ind_sel(ind_ind_sel))=nb_select(ind_sel(ind_ind_sel))+ 1;147 nb_select(ind_sel(ind_ind_sel))=nb_select(ind_sel(ind_ind_sel))+weight; 138 148 display(['tps redone after elimination of erratic vectors in subdomain # ' num2str(isub) ' among ' num2str(NbSubDomain)]) 139 149 break -
trunk/src/read_field.m
r1134 r1137 203 203 find(strcmp(ParamIn.Coord_x,VarDimName{ilist}))]; 204 204 end 205 if ~isempty(DimOrder)205 if numel(DimOrder)>=ndims(Field.(ListVarName{ilist})) 206 206 Field.(ListVarName{ilist})=permute(Field.(ListVarName{ilist}),DimOrder); 207 207 VarDimName{ilist}=VarDimName{ilist}(DimOrder); -
trunk/src/series/civ_input.m
r1127 r1137 81 81 set(handles.CheckThreshold,'Visible','on') 82 82 set(handles.CheckDeformation,'Value',0)% desactivate 83 set(handles.num_SubDomainSize(1),'String','250') 84 set(handles.num_SubDomainSize(2),'String','500') 83 85 end 84 86 switch Param.Action.ActionName -
trunk/src/series/civ_series.m
r1131 r1137 924 924 time_total=toc(tstart); 925 925 disp(['ellapsed time ' num2str(time_total/60,2) ' minutes']) 926 disp(['time image reading ' num2str(time_input /60,2) ' minutes'])927 disp(['time civ1 ' num2str(time_civ1 /60,2) ' minutes'])928 disp(['time patch1 ' num2str(time_patch1 /60,2) ' minutes'])929 disp(['time civ2 ' num2str(time_civ2 /60,2) ' minutes'])930 disp(['time patch2 ' num2str(time_patch2 /60,2) ' minutes'])931 disp(['time other ' num2str((time_total-time_input-time_civ1-time_patch1-time_civ2-time_patch2) /60,2) ' minutes'])926 disp(['time image reading ' num2str(time_input,2) ' s']) 927 disp(['time civ1 ' num2str(time_civ1,2) ' s']) 928 disp(['time patch1 ' num2str(time_patch1,2) ' s']) 929 disp(['time civ2 ' num2str(time_civ2,2) ' s']) 930 disp(['time patch2 ' num2str(time_patch2,2) ' s']) 931 disp(['time other ' num2str((time_total-time_input-time_civ1-time_patch1-time_civ2-time_patch2),2) ' s']) 932 932 end 933 933 end -
trunk/src/series/merge_proj.m
r1135 r1137 68 68 ParamOut.FieldTransform = 'on';%can use a transform function 69 69 %%%%% list of possible transform functions (needed only for compilation) 70 % ListTransform={'phys','phys_polar','sub_field'};%list of possible transform functions (needed only for compilation) 71 % if 0==1 %never satisfied but trigger compilation with the appropriate transform functions 72 % phys 73 % phys_polar 74 % sub_field 75 try 76 for ilist=1:numel(ListTransform) 77 eval(ListTransform{ilist}) 78 end 79 end 70 if 0==1 %never satisfied but trigger compilation with the appropriate transform functions ('eval' inactive for compilation) 71 phys 72 phys_polar 73 sub_field 74 end 80 75 81 76 ParamOut.TransformPath=fullfile(fileparts(which('uvmat')),'transform_field');% path to transform functions … … 192 187 currentdir=pwd; 193 188 cd(Param.FieldTransform.TransformPath) 189 if strcmp(Param.FieldTransform.TransformName,'sub_field') 190 checksub=2;% the two into field series will be subtracted 191 end 194 192 transform_fct=str2func(Param.FieldTransform.TransformName); 195 193 cd (currentdir) … … 199 197 end 200 198 end 201 checksub=nargin(transform_fct);% number of input arguments for the selected transform fct202 199 if checksub>2 && NbView>2 203 200 disp_uvmat('WARNING',['only the two first input file series will be combined by ' Param.FieldTransform.TransformName],checkrun) … … 321 318 322 319 %% transform the input field iview (e.g; phys) if requested (no transform involving two input fields at this stage) 323 checksub=0; 324 if ~isempty(transform_fct) 320 if ~isempty(transform_fct)&& checksub==0 325 321 checksub=nargin(transform_fct); 326 if checksub>=2322 if nargin(transform_fct)>=2 327 323 Data{iview}=transform_fct(Data{iview},XmlData{iview}); 328 else if checksub==1324 else 329 325 Data{iview}=transform_fct(Data{iview}); 330 326 end … … 356 352 357 353 %% merge the NbView fields 358 % if checksub<=2 354 if checksub==0 359 355 [MergeData,errormsg]=merge_field(Data);%concatene all the input field series by fct merge_data 360 % elseif checksub==3 361 %MergeData=transform_fct(Data{1},XmlData{1},Data{2}); %combine the two input file series362 %else363 %MergeData=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});%combine the two input file series with calibration parameters364 %end356 else 357 MergeData=transform_fct(Data{1},XmlData{1},Data{2}); %combine the two input file series 358 % else 359 % MergeData=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});%combine the two input file series with calibration parameters 360 end 365 361 if ~isempty(errormsg) 366 362 disp_uvmat('ERROR',errormsg,checkrun); -
trunk/src/tps_coeff_field.m
r1127 r1137 43 43 Smoothing=0; 44 44 end 45 SubDomainNbPoint= 1000; %default, estimated nbre of data source points in a subdomain used for tps45 SubDomainNbPoint=300; %default, estimated nbre of data source points in a subdomain used for tps 46 46 if isfield(DataIn,'SubDomain') 47 47 SubDomainNbPoint=DataIn.SubDomain;%old convention -
trunk/src/uvmat.m
r1129 r1137 3640 3640 end 3641 3641 % case of input vector field, get the scalar used for vector color 3642 if ~isempty(regexp(FieldName,'^vec(' ))3642 if ~isempty(regexp(FieldName,'^vec(','once')) 3643 3643 list_code=get(handles.ColorCode,'String');% list menu fields 3644 3644 index_code=get(handles.ColorCode,'Value');% selected string index
Note: See TracChangeset
for help on using the changeset viewer.