Changeset 1077
- Timestamp:
- Mar 20, 2020, 11:29:01 PM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mouse_motion.m
r1072 r1077 231 231 norm_plane(3)=OmAxis(3)*coeff+cos_om; 232 232 %Z0=norm_plane*Field.ProjObjectCoord'/norm_plane(3); 233 pos(3)=-(norm_plane(1)*pos(1) -norm_plane(2)*pos(2))/norm_plane(3);233 pos(3)=-(norm_plane(1)*pos(1)+norm_plane(2)*pos(2))/norm_plane(3); 234 234 end 235 235 pos=pos+Field.ProjObjectCoord; -
trunk/src/plot_field.m
r1071 r1077 102 102 103 103 %% default input and output 104 if ~exist('PlotParam','var'),PlotParam=[];end ;104 if ~exist('PlotParam','var'),PlotParam=[];end 105 105 PlotType='text'; %default 106 106 if ~isfield(PlotParam,'Axes') … … 114 114 115 115 %% check input structure 116 % check the cells of fields :117 118 % if ~isfield(PlotParam,'FieldName')119 % index_0D=[];120 % index_1D=1;121 % index_2D=[];%find 2D fields122 % index_3D=[];123 % else124 116 [CellInfo,NbDimArray,errormsg]=find_field_cells(Data); 125 117 if ~isempty(errormsg) … … 363 355 % --- plot 1D fields (usual x,y plots) 364 356 %------------------------------------------------------------------- 365 function PlotParamOut=plot_profile(data,CellInfo,haxes,PlotParam,CheckHold) 357 %INPUT 358 % Data: structure describing the field to plot 359 % (optional) .ListGlobalAttribute: cell listing the names of the global attributes 360 % .Att_1,Att_2... : values of the global attributes 361 % (requested) .ListVarName: list of variable names to select (cell array of char strings {'VarName1', 'VarName2',...} ) 362 % (requested) .VarDimName: list of dimension names for each element of .ListVarName (cell array of string cells) 363 % .VarAttribute: cell of attributes for each element of .ListVarName (cell array of structures of the form VarAtt.key=value) 364 % (requested) .Var1, .Var2....: variables (Matlab arrays) with names listed in .ListVarName 365 % 366 % Variable attribute .Role : 367 % The only variable attribute used for plotting purpose is .Role which can take 368 % the values: 369 % Role = 'coord_x' or 'histo' to label the x coordinate 370 % ='coord_y' or 'discrete' to label the y coordinate, variables labelled as 'discrete' 371 % will be plotted as isolated points while variables labelled as 'coord_y' will be plotted as continuous lines 372 % other variables will not be taken into account for plot_profile 373 374 function PlotParamOut=plot_profile(Data,CellInfo,haxes,PlotParam,CheckHold) 366 375 367 376 %% initialization … … 376 385 legend_str={}; 377 386 378 %% suppress existing plot if empty data379 if isempty( data)387 %% suppress existing plot if empty Data 388 if isempty(Data) 380 389 hplot=findobj(haxes,'tag','plot_line'); 381 390 if ~isempty(hplot) … … 407 416 MinY_cell=[]; 408 417 MaxY_cell=[]; 409 testplot=ones(size( data.ListVarName));%default test for plotted variables418 testplot=ones(size(Data.ListVarName));%default test for plotted variables 410 419 %loop on input fields 411 420 for icell=1:numel(CellInfo) 412 VarIndex=[CellInfo{icell}.YIndex CellInfo{icell}.YIndex_discrete];% indices of the selected variables in the list data.ListVarName421 VarIndex=[CellInfo{icell}.YIndex CellInfo{icell}.YIndex_discrete];% indices of the selected variables in the list Data.ListVarName 413 422 coord_x_index=CellInfo{icell}.XIndex; 414 coord_x_name{icell}= data.ListVarName{coord_x_index};415 coord_x{icell}= data.(data.ListVarName{coord_x_index});%coordinate variable set as coord_x423 coord_x_name{icell}=Data.ListVarName{coord_x_index}; 424 coord_x{icell}=Data.(Data.ListVarName{coord_x_index});%coordinate variable set as coord_x 416 425 if isempty(find(strcmp(coord_x_name{icell},coord_x_name(1:end-1)), 1)) %xtitle not already selected 417 426 xtitle=[xtitle coord_x_name{icell}]; 418 if isfield( data,'VarAttribute')&& numel(data.VarAttribute)>=coord_x_index && isfield(data.VarAttribute{coord_x_index},'units')419 xtitle=[xtitle '(' data.VarAttribute{coord_x_index}.units '), '];427 if isfield(Data,'VarAttribute')&& numel(Data.VarAttribute)>=coord_x_index && isfield(Data.VarAttribute{coord_x_index},'units') 428 xtitle=[xtitle '(' Data.VarAttribute{coord_x_index}.units '), ']; 420 429 else 421 430 xtitle=[xtitle ', ']; … … 432 441 testplot(CellInfo{icell}.VarIndex_warnflag)=0; 433 442 end 434 if isfield( data,'VarAttribute')435 VarAttribute= data.VarAttribute;443 if isfield(Data,'VarAttribute') 444 VarAttribute=Data.VarAttribute; 436 445 for ivar=1:length(VarIndex) 437 446 if length(VarAttribute)>=VarIndex(ivar) && isfield(VarAttribute{VarIndex(ivar)},'long_name') 438 447 plotname{VarIndex(ivar)}=VarAttribute{VarIndex(ivar)}.long_name; 439 448 else 440 plotname{VarIndex(ivar)}= data.ListVarName{VarIndex(ivar)};%name for display in plot A METTRE449 plotname{VarIndex(ivar)}=Data.ListVarName{VarIndex(ivar)};%name for display in plot A METTRE 441 450 end 442 451 end … … 453 462 for ivar=1:length(VarIndex) 454 463 if testplot(VarIndex(ivar)) 455 VarName= data.ListVarName{VarIndex(ivar)};464 VarName=Data.ListVarName{VarIndex(ivar)}; 456 465 nbplot=nbplot+1; 457 466 ytitle=[ytitle VarName]; 458 if isfield( data,'VarAttribute')&& numel(data.VarAttribute)>=VarIndex(ivar) && isfield(data.VarAttribute{VarIndex(ivar)},'units')459 ytitle=[ytitle '(' data.VarAttribute{VarIndex(ivar)}.units '), '];467 if isfield(Data,'VarAttribute')&& numel(Data.VarAttribute)>=VarIndex(ivar) && isfield(Data.VarAttribute{VarIndex(ivar)},'units') 468 ytitle=[ytitle '(' Data.VarAttribute{VarIndex(ivar)}.units '), ']; 460 469 else 461 470 ytitle=[ytitle ', ']; 462 471 end 463 eval([' data.' VarName '=squeeze(data.' VarName ');'])464 MinY(ivar)=min(min( data.(VarName)));465 MaxY(ivar)=max(max( data.(VarName)));466 plotstr=[plotstr 'coord_x{' num2str(icell) '}, data.' VarName ',' charplot_0 ','];467 eval(['nbcomponent2=size( data.' VarName ',2);']);468 eval(['nbcomponent1=size( data.' VarName ',1);']);472 eval(['Data.' VarName '=squeeze(Data.' VarName ');']) 473 MinY(ivar)=min(min(Data.(VarName))); 474 MaxY(ivar)=max(max(Data.(VarName))); 475 plotstr=[plotstr 'coord_x{' num2str(icell) '},Data.' VarName ',' charplot_0 ',']; 476 eval(['nbcomponent2=size(Data.' VarName ',2);']); 477 eval(['nbcomponent1=size(Data.' VarName ',1);']); 469 478 if numel(coord_x{icell})==2 470 479 coord_x{icell}=linspace(coord_x{icell}(1),coord_x{icell}(2),nbcomponent1); … … 521 530 end 522 531 title_str=''; 523 if isfield( data,'filename')524 [Path, title_str, ext]=fileparts( data.filename);532 if isfield(Data,'filename') 533 [Path, title_str, ext]=fileparts(Data.filename); 525 534 title_str=[title_str ext]; 526 535 end 527 if isfield( data,'Action')&&isfield(data.Action,'ActionName')536 if isfield(Data,'Action')&&isfield(Data.Action,'ActionName') 528 537 if ~isequal(title_str,'') 529 538 title_str=[title_str ', ']; 530 539 end 531 title_str=[title_str data.Action.ActionName];540 title_str=[title_str Data.Action.ActionName]; 532 541 end 533 542 htitle=title(title_str); … … 587 596 if isfield(CellInfo{icell},'VarIndex_histo')% case of histogram plot 588 597 TextDisplay=1; 589 VarName= data.ListVarName{CellInfo{icell}.CoordIndex};590 pdf_val= data.(data.ListVarName{CellInfo{icell}.VarIndex_histo});598 VarName=Data.ListVarName{CellInfo{icell}.CoordIndex}; 599 pdf_val=Data.(Data.ListVarName{CellInfo{icell}.VarIndex_histo}); 591 600 x=coord_x{icell}; 592 601 if isrow(x) … … 610 619 end 611 620 end 612 if TextDisplay ;621 if TextDisplay 613 622 disp(TableData); 614 623 PlotParamOut.TableDisplay=TableData; -
trunk/src/proj_field.m
r1072 r1077 719 719 ProjData.VarAttribute{nbvar+ivar}=FieldData.VarAttribute{VarIndex(ivar)};%reproduce var attribute 720 720 if isfield(ProjData.VarAttribute{nbvar+ivar},'Role') 721 if strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x') ;721 if strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x') 722 722 ivar_U=nbvar+ivar; 723 elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y') ;723 elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y') 724 724 ivar_V=nbvar+ivar; 725 725 end 726 726 end 727 ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles with continuoval(['us lines727 ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles as a set of individual dots 728 728 end 729 729 elseif isequal(ProjMode,'interp_lin') %filtering %linear interpolation: … … 756 756 ProjData.VarDimName=[ProjData.VarDimName {XName}]; 757 757 if isfield(VarAttribute{ivar},'Role') 758 if strcmp(VarAttribute{ivar}.Role,'vector_x') ;758 if strcmp(VarAttribute{ivar}.Role,'vector_x') 759 759 ivar_U=ivar+nbvar; 760 elseif strcmp(VarAttribute{ivar}.Role,'vector_y') ;760 elseif strcmp(VarAttribute{ivar}.Role,'vector_y') 761 761 ivar_V=ivar+nbvar; 762 762 end … … 787 787 ProjData.VarDimName=[ProjData.VarDimName {'X'}]; 788 788 if isfield(VarAttribute{ivar},'Role') 789 if strcmp(VarAttribute{ivar}.Role,'vector_x') ;789 if strcmp(VarAttribute{ivar}.Role,'vector_x') 790 790 ivar_U=ivar+nbvar; 791 elseif strcmp(VarAttribute{ivar}.Role,'vector_y') ;791 elseif strcmp(VarAttribute{ivar}.Role,'vector_y') 792 792 ivar_V=ivar+nbvar; 793 793 end … … 813 813 AY=FieldData.(AYName);% set of y positions 814 814 AZ=FieldData.(AZName);% set of z positions 815 815 AName=FieldData.ListVarName{VarIndex(1)}; 816 816 npxy=size(FieldData.(AName)); 817 817 npz=npxy(1); … … 820 820 AXI=linspace(AX(1),AX(end), npx);%set of x positions for the interpolated input data 821 821 AYI=linspace(AY(1),AY(end), npy);%set of x positions for the interpolated input data 822 822 AZI=linspace(AZ(1),AZ(end), npy);%set of x positions for the interpolated input data 823 823 for ivar=VarIndex 824 824 VarName=FieldData.ListVarName{ivar}; 825 825 FieldData.(VarName)=interp3(FieldData.(AXName),FieldData.(AYName),FieldData.(AZName),FieldData.(VarName),AXI,AYI,AZI); 826 827 % vec_A=reshape(squeeze(FieldData.(FieldData.ListVarName{ivar})),npx*npy,nbcolor); %put the original image in colum828 % if nbcolor==1829 % vec_B(ind_in)=vec_A(ICOMB);830 % vec_B(ind_out)=zeros(size(ind_out));831 % A_out=reshape(vec_B,npY,npX);832 % ProjData.(FieldData.ListVarName{ivar}) =sum(A_out,1)/npY;833 % elseif nbcolor==3834 % vec_B(ind_in,1:3)=vec_A(ICOMB,:);835 % vec_B(ind_out,1)=zeros(size(ind_out));836 % vec_B(ind_out,2)=zeros(size(ind_out));837 % vec_B(ind_out,3)=zeros(size(ind_out));838 % A_out=reshape(vec_B,npY,npX,nbcolor);839 % ProjData.(FieldData.ListVarName{ivar})=squeeze(sum(A_out,1)/npY);840 % end826 827 % vec_A=reshape(squeeze(FieldData.(FieldData.ListVarName{ivar})),npx*npy,nbcolor); %put the original image in colum 828 % if nbcolor==1 829 % vec_B(ind_in)=vec_A(ICOMB); 830 % vec_B(ind_out)=zeros(size(ind_out)); 831 % A_out=reshape(vec_B,npY,npX); 832 % ProjData.(FieldData.ListVarName{ivar}) =sum(A_out,1)/npY; 833 % elseif nbcolor==3 834 % vec_B(ind_in,1:3)=vec_A(ICOMB,:); 835 % vec_B(ind_out,1)=zeros(size(ind_out)); 836 % vec_B(ind_out,2)=zeros(size(ind_out)); 837 % vec_B(ind_out,3)=zeros(size(ind_out)); 838 % A_out=reshape(vec_B,npY,npX,nbcolor); 839 % ProjData.(FieldData.ListVarName{ivar})=squeeze(sum(A_out,1)/npY); 840 % end 841 841 ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}]; 842 842 ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate … … 941 941 ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}]; 942 942 ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate 943 nbvar=nbvar+1; 944 ProjData.VarAttribute{nbvar}.Role='coord_y';% for plot with continuous line 945 end 943 nbvar_proj=numel(ProjData.ListVarName); 944 if isfield(FieldData.VarAttribute{ivar},'Role') 945 if strcmp(FieldData.VarAttribute{ivar}.Role,'vector_x') 946 ivar_U=nbvar_proj; 947 elseif strcmp(FieldData.VarAttribute{ivar}.Role,'vector_y') 948 ivar_V=nbvar_proj; 949 end 950 end 951 if isequal(ProjMode,'projection') 952 ProjData.VarAttribute{nbvar_proj}.Role='discrete'; 953 else 954 ProjData.VarAttribute{nbvar_proj}.Role='coord_y'; 955 end 956 end 957 946 958 if nbcolor==3 947 959 ProjData.VarDimName{end}={AXName,'rgb'}; … … 950 962 951 963 end 952 if ~isempty(ivar_U) && ~isempty(ivar_V) 953 vector_x =ProjData.(ProjData.ListVarName{ivar_U}); 954 ProjData.(ProjData.ListVarName{ivar_U}) =cos(theta)*vector_x+sin(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 955 ProjData.(ProjData.ListVarName{ivar_V}) =-sin(theta)*vector_x+cos(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 956 end 964 % for vector fields, take the components longitudinal and tranverse to the projection line 965 if ~isempty(ivar_U) && ~isempty(ivar_V) 966 vector_x =ProjData.(ProjData.ListVarName{ivar_U}); 967 ProjData.(ProjData.ListVarName{ivar_U}) =cos(theta)*vector_x+sin(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 968 ProjData.(ProjData.ListVarName{ivar_V}) =-sin(theta)*vector_x+cos(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 969 end 957 970 end 958 971 … … 1175 1188 AYName='coord_y'; 1176 1189 AXName='coord_x'; 1177 if strcmp(ObjectData.ProjMode,'projection') ||strcmp(ObjectData.Type,'plane')1190 if strcmp(ObjectData.ProjMode,'projection')%||strcmp(ObjectData.Type,'plane') 1178 1191 ProjData.coord_y=[FieldData.YMin FieldData.YMax];%note that if projection is done on a grid, the Min and Max along each direction must have been defined 1179 1192 ProjData.coord_x=[FieldData.XMin FieldData.XMax]; -
trunk/src/series/turb_stat.m
r1071 r1077 194 194 DataOut.Curl2Mean=0; 195 195 DataOut.Div2Mean=0; 196 DataOut.KEflux=0; 196 197 U2Mean=0; 197 198 V2Mean=0; … … 231 232 DataOut.UMean=DataOut.UMean+Field.U; %increment the sum 232 233 DataOut.VMean=DataOut.VMean+Field.V; %increment the sum 234 233 235 U2Mean=U2Mean+(Field.U).*(Field.U); %increment the U squared sum 234 236 V2Mean=V2Mean+(Field.V).*(Field.V); %increment the V squared sum -
trunk/src/transform_field/ima2concentration.m
r1075 r1077 32 32 cpath=which('uvmat'); 33 33 addpath(fullfile(fileparts(cpath),'transform_field'))% define path for phys_polar.m 34 35 %% rescale the image 36 [nby,nbx]=size(DataIn.A); 37 x=linspace(DataIn.Coord_x(1),DataIn.Coord_x(2),nbx)-nbx/2; 38 y=linspace(DataIn.Coord_y(1),DataIn.Coord_y(2),nby)-nby/2; 39 [X,Y]=meshgrid(x,y); 40 coeff_quad=0.15*4/(nbx*nbx);% image luminosity reduced by 10% at the edge 41 DataIn.A=double(DataIn.A).*(1+coeff_quad*(X.*X+Y.*Y)); 34 42 35 43 %% Transform images to polar coordinates with origin at the light source position -
trunk/src/uvmat.m
r1076 r1077 1415 1415 end 1416 1416 1417 prompt = {'offset luminosity value in the absence of illumination';'smoothing width for the reference line (in pixels)'}; 1417 prompt = {'offset luminosity value in the absence of illumination';'smoothing width for the reference line (in pixels)';... 1418 'LIF Temperature Coeff1';'LIF Temperature Coeff2';'LIF Temperature Coeff3'}; 1418 1419 dlg_title = 'set the parameters for LIF'; 1419 num_lines= 2;1420 def = { num2str(BlackOffset);num2str(RefLineWidth) };1420 num_lines= 5; 1421 def = { num2str(BlackOffset);num2str(RefLineWidth);'0';'0';'0'}; 1421 1422 answer = inputdlg(prompt,dlg_title,num_lines,def); 1422 1423 if isempty(answer) … … 1425 1426 XmlData.LIFCalib.BlackOffset=str2double(answer{1}) ;% image value for black background, to be determined by taking images with a cover on the objective lens 1426 1427 XmlData.LIFCalib.RefLineWidth=str2double(answer{2}) ;% smoothing width used for the reference line 1428 XmlData.LIFCalib.TLIFCoeff=[str2double(answer{3}) str2double(answer{4}) str2double(answer{5})]; 1427 1429 end 1428 1430 … … 1443 1445 XmlData.LIFCalib.Ray2Coord=LineData{2}.Coord; 1444 1446 XmlData.LIFCalib.RefLineCoord=LineData{3}.Coord; 1447 1448 %% rescale the image 1449 [nby,nbx]=size(UvData.Field.A); 1450 x=linspace(UvData.Field.Coord_x(1),UvData.Field.Coord_x(2),nbx)-nbx/2; 1451 y=linspace(UvData.Field.Coord_y(1),UvData.Field.Coord_y(2),nby)-nby/2; 1452 [X,Y]=meshgrid(x,y); 1453 coeff_quad=0.15*4/(nbx*nbx);% image luminosity reduced by 10% at the edge 1454 UvData.Field.A=double(UvData.Field.A).*(1+coeff_quad*(X.*X+Y.*Y)); 1445 1455 1446 1456 %% display the current image in polar axes with origin at the illumination source
Note: See TracChangeset
for help on using the changeset viewer.