Changeset 1168
- Timestamp:
- Dec 9, 2024, 7:40:14 PM (12 days ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r1163 r1168 257 257 end 258 258 ytable=npy_ima-ytable+1;%reverse from j index to image coordinate y 259 result_conv=result_conv *corrmax/sum_square;% keep the last (not normalised)correlation matrix for output259 result_conv=result_conv/sum_square;% keep the last correlation matrix for output 260 260 261 261 -
trunk/src/mouse_motion.m
r1163 r1168 276 276 'LineStyle','-','Tag','PIV_box_marker'); 277 277 rectangle('Curvature',[0 0],... 278 'Position',[xround-isx2 +shiftx yround-isy2+shifty 2*isx2 2*isy2],'EdgeColor','m',...278 'Position',[xround-isx2-ibx2+shiftx yround-isy2-iby2+shifty 2*isx2+2*ibx2 2*isy2+2*iby2],'EdgeColor','m',... 279 279 'LineStyle','- -','Tag','PIV_search_marker'); 280 280 else 281 281 set(hhh,'Position',[xround-ibx2 yround-iby2 2*ibx2 2*iby2]) 282 set(hhhh,'Position',[xround-isx2 +shiftx yround-isy2+shifty 2*isx2 2*isy2])282 set(hhhh,'Position',[xround-isx2-ibx2+shiftx yround-isy2-iby2+shifty 2*isx2+2*ibx2 2*isy2+2*iby2]) 283 283 end 284 284 285 285 % perform the PIV calculation as the single point xround yround 286 Param.CheckFix1=0; 287 Param.CheckPatch1=0;%desactivate all calculations except Civ2 or Civ1 286 Param.ActionInput.CheckCiv1=1; 287 % Param.CheckFix1=0; 288 % Param.CheckPatch1=0;%desactivate all calculations except Civ2 or Civ1 288 289 Param.Action.RUN=1; 289 290 Param.ActionInput.ListCompareMode='PIV'; … … 299 300 text_displ_5=errormsg; 300 301 else 301 rangx(1)=-(isx2-ibx2)+shiftx; 302 rangx(2)=isx2-ibx2+shiftx; 303 rangy(1)=-(isy2-iby2)-shifty; 304 rangy(2)=(isy2-iby2)-shifty; 302 % rangx(1)=-(isx2-ibx2)+shiftx; 303 % rangx(2)=isx2-ibx2+shiftx; 304 % rangy(1)=-(isy2-iby2)-shifty; 305 % rangy(2)=(isy2-iby2)-shifty; 306 rangx(1)=-isx2+shiftx; 307 rangx(2)=isx2+shiftx; 308 rangy(1)=-isy2-shifty; 309 rangy(2)=isy2-shifty; 305 310 hcorr=[]; 306 311 if isfield(AxeData,'CurrentCorrImage') -
trunk/src/series.m
r1161 r1168 3224 3224 FirstFileName=fullfile_uvmat(Param.InputTable{iview,1},Param.InputTable{iview,2},Param.InputTable{iview,3},... 3225 3225 Param.InputTable{iview,5},Param.InputTable{iview,4},i1,i2,j1,j2); 3226 Data=nc2struct(FirstFileName); 3226 3227 [FileInfo,VideoObject]=get_file_info(FirstFileName); 3228 3229 3230 % Data=nc2struct(FirstFileName); 3227 3231 if isfield(Data,'Civ2_Mask') 3232 if exist(Data.Civ2_Mask,'file') 3228 3233 MaskTable{iview,1}=Data.Civ2_Mask; 3229 3234 checkmask=1; 3235 end 3230 3236 end 3231 3237 if ~checkmask -
trunk/src/series/civ_series.m
r1165 r1168 284 284 end 285 285 end 286 if CheckInputFile 286 % if CheckInputFile 287 if CheckOutputFile 287 288 OutputPath=fullfile(Param.OutputPath,Param.Experiment,Param.Device); 288 289 if iview_A==0 % no nc file has been entered … … 488 489 489 490 % caluclate velocity data 490 tstart_civ1=tic;491 % tstart_civ1=tic; 491 492 [Data.Civ1_X,Data.Civ1_Y,Data.Civ1_U,Data.Civ1_V,Data.Civ1_C,Data.Civ1_FF, result_conv, errormsg] = civ (par_civ1); 492 493 if ~isempty(errormsg) -
trunk/src/transform_field/FFT2_detrend.m
r1127 r1168 1 % 'FFT2_detrend': calculate the 2D spectrum of the input scalar after removing the linear trend1 % 'FFT2_detrend': calculate the 2D spectrum of the input scalar or image after removing the linear trend 2 2 %------------------------------------------------------------------------ 3 3 %%%% Use the general syntax for transform fields with a single input %%%% … … 34 34 end 35 35 %%%%%%%%%%%%%%%%%%%%%%%%% 36 [CellInfo,NbDim,errormsg]=find_field_cells(DataIn); 36 [CellInfo,NbDim,errormsg]=find_field_cells(DataIn);% detect the input fields 37 37 if ~isempty(errormsg) 38 38 DataOut.Txt=errormsg; … … 42 42 DataOut.VarDimName={}; 43 43 for ilist=1:numel(CellInfo) 44 if NbDim(ilist)==2 && numel(CellInfo{ilist}.CoordIndex)==2 % field with structured coordinates 44 if NbDim(ilist)==2 && numel(CellInfo{ilist}.CoordIndex)==2 % field with structured 2D coordinates 45 %process scalar 46 ivar=CellInfo{ilist}.VarIndex_scalar(1); 47 VarName=DataIn.ListVarName{ivar};% name o the scalar field 48 z=double(DataIn.(VarName));% transform integer input to double real 49 z(isnan(z))=0;% set NaN values to 0 50 [npy,npx]=size(z); 51 45 52 %process coordinates 46 53 CoordName=DataIn.ListVarName(CellInfo{ilist}.CoordIndex); 47 x1 = DataIn.(CoordName{2}); y1 = DataIn.(CoordName{1});48 [x y] = meshgrid(x1,y1);49 coeff(1,1) = sum(sum(x.^2)); coeff(1,2) = sum(sum(x.*y)); coeff(1,3) = sum(sum(x));50 coeff(2,1) = sum(sum(x.*y)); coeff(2,2) = sum(sum(y.^2)); coeff(2,3) = sum(sum(y));51 coeff(3,1) = sum(sum(x)); coeff(3,2) = sum(sum(y)); coeff(3,3) = length(x1)*length(y1);54 x1 = linspace(DataIn.(CoordName{2})(1),DataIn.(CoordName{2})(end),npx); 55 y1 =linspace(DataIn.(CoordName{1})(1),DataIn.(CoordName{1})(end),npy); 56 [x,y] = meshgrid(x1,y1);% 2D grid of coordinates 57 58 % prepare the grid of wave vectors 52 59 delta_x = x1(2) - x1(1); delta_y = y1(2) - y1(1); 53 60 Nx = length(x1); Ny = length(y1); … … 55 62 ssx = find(Nxa<Nx/2); ssy = find(Nya<Ny/2); 56 63 Nxa(Nx-ssx+1) = -Nxa(ssx)+1; Nya(Ny-ssy+1) = -Nya(ssy)+1; 57 [Nxa Ix] = sort(Nxa); [Nya Iy] = sort(Nya);64 [Nxa, Ix] = sort(Nxa); [Nya, Iy] = sort(Nya); 58 65 kx1 = (2*pi/delta_x/Nx)*(Nxa-1); ky1 = (2*pi/delta_y/Ny)*(Nya-1); 59 66 ss = find(ky1>=0); ky1 = ky1(ss); 60 [kx 67 [kx,ky] = meshgrid(kx1,ky1); 61 68 DataOut.(CoordName{2}) = kx1; DataOut.(CoordName{1}) = ky1; 62 69 if isfield(DataIn,'CoordUnit') 63 DataOut.CoordUnit=[DataIn.CoordUnit '^{-1}']; 70 DataOut.CoordUnit=[DataIn.CoordUnit '^{-1}'];%unit of wave vectors 64 71 DataOut.ListGlobalAttribute={'CoordUnit'}; 65 72 end 66 %process scalar67 ivar=CellInfo{ilist}.VarIndex_scalar(1);68 VarName=DataIn.ListVarName{ivar};69 z=DataIn.(VarName);70 z(isnan(z))=0;% set to 0 NaN values73 74 % get the coeff to calulate the linear trend 75 coeff(1,1) = sum(sum(x.^2)); coeff(1,2) = sum(sum(x.*y)); coeff(1,3) = sum(sum(x)); 76 coeff(2,1) = sum(sum(x.*y)); coeff(2,2) = sum(sum(y.^2)); coeff(2,3) = sum(sum(y)); 77 coeff(3,1) = sum(sum(x)); coeff(3,2) = sum(sum(y)); coeff(3,3) = length(x1)*length(y1); 71 78 rhs(1) = sum(sum(x.*z)); rhs(2) = sum(sum(y.*z)); rhs(3) = sum(sum(z)); 72 lin_coeff = inv(coeff)*rhs'; 79 % lin_coeff = inv(coeff)*rhs'; 80 lin_coeff = coeff\rhs'; 73 81 lin_trend = lin_coeff(1)*x + lin_coeff(2)*y + lin_coeff(3); 74 z2 = z - lin_trend; 75 spec2 = abs(fft2(z2)).^2; 82 z2 = z - lin_trend;% substract the linear trend to the input field 83 84 spec2 = abs(fft2(z2)).^2;% get spectrum as squared of fft modulus 76 85 spec2 = spec2(Iy,Ix); 77 86 spec2 = spec2(ss,:); 78 DataOut.(VarName) = log10(spec2); 87 DataOut.(VarName) = log10(spec2);% take the log10 of spectrum 79 88 %DataOut.(VarName) = spec2; 80 spec_sum=sum(sum(spec2));81 kx_mean=sum(sum(spec2.*kx))/spec_sum;82 ky_mean=sum(sum(spec2.*ky))/spec_sum;83 theta=atand(ky_mean/kx_mean);84 lambda=2*pi/(sqrt(kx_mean*kx_mean+ky_mean*ky_mean));89 % spec_sum=sum(sum(spec2)); 90 % kx_mean=sum(sum(spec2.*kx))/spec_sum; 91 % ky_mean=sum(sum(spec2.*ky))/spec_sum; 92 % theta=atand(ky_mean/kx_mean); 93 % lambda=2*pi/(sqrt(kx_mean*kx_mean+ky_mean*ky_mean)); 85 94 86 95 DataOut.ListVarName=[CoordName {VarName}];%list of variables -
trunk/src/transform_field/ima_filter.m
r1127 r1168 39 39 dlg_title = 'get the filter size in x and y'; 40 40 num_lines= 2; 41 def = { '2 0';'20'};41 def = { '21';'21'}; 42 42 if isfield(Param,'TransformInput')&&isfield(Param.TransformInput,'FilterBoxSize_x')&&... 43 43 isfield(Param.TransformInput,'FilterBoxSize_y') … … 74 74 else 75 75 DataOut.(VarName)=filter2(Mfiltre,DataIn.(VarName)); 76 %DataOut.(VarName)=filter2_uvmat(Param.TransformInput.FilterBoxSize_x,Param.TransformInput.FilterBoxSize_y,DataIn.(VarName)); 76 77 DataOut.(VarName)=feval(Atype,DataOut.(VarName));%transform to the initial image format 77 78 end -
trunk/src/uvmat.m
r1167 r1168 2294 2294 set(handles.j2,'String',num2stra(j2,NomType)); 2295 2295 if isfield(FileInfo,'MaskFile') 2296 if exist(FileInfo.MaskFile) 2296 2297 set(handles.CheckMask,'Value',1) 2298 else 2299 set(handles.CheckMask,'Value',0) 2300 end 2297 2301 Mask.File=FileInfo.MaskFile; 2298 2302 if isfield(FileInfo,'MaskNbSlice') … … 2932 2936 Mask.File=filemask; 2933 2937 [RootPath,SubDir,RootFile,i1_series,i2,j1,j2,NomType]=find_file_series(MaskPath,[FileName FileExt]); 2934 Mask.NbSlice= 1;%default2938 Mask.NbSlice=[];%default 2935 2939 Mask.VolumeScan=0;% TO UPDATE *** 2936 2940 if strcmp(NomType,'_1') … … 2944 2948 set(handles.CheckMask,'UserData',Mask); 2945 2949 errormsg=update_mask(handles); 2950 if ~isempty(errormsg) 2951 msgbox_uvmat(['ERROR','error in displaying mask, ' errormsg]); 2952 end 2946 2953 testmask=1; 2947 2954 end … … 2969 2976 MaskInfo=get(handles.CheckMask,'UserData'); 2970 2977 if isfield(MaskInfo,'File') 2971 if isfield(MaskInfo,'NbSlice') 2978 if isfield(MaskInfo,'NbSlice')&& ~isempty(MaskInfo.NbSlice) 2972 2979 if isfield(MaskInfo,'VolumeScan') && MaskInfo.VolumeScan 2973 2980 MaskIndex_i=str2num(get(handles.j1,'String'));
Note: See TracChangeset
for help on using the changeset viewer.