Changeset 881 for trunk/src


Ignore:
Timestamp:
Mar 6, 2015, 9:10:16 PM (9 years ago)
Author:
sommeria
Message:

various bug fix

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_field.m

    r880 r881  
    299299
    300300% data need to be displayed in a table
    301 if strcmp(get(htext,'Type'),'uitable')% display data in a table
    302     VarNameCell=cell(1,numel(VarIndex));% prepare list of variable names to display (titles of columns)
    303     VarLength=zeros(1,numel(VarIndex));  % default number of values for each variable
    304     for ivar=1:numel(VarIndex)
    305         VarNameCell{ivar}=FieldData.ListVarName{VarIndex(ivar)};
    306         VarLength(ivar)=numel(FieldData.(VarNameCell{ivar}));
    307     end
    308     set(htext,'ColumnName',VarNameCell)
    309     Data=cell(max(VarLength),numel(VarIndex));% prepare the table of data display
    310    
    311     for ivar=1:numel(VarIndex)
    312         VarValue=FieldData.(VarNameCell{ivar});
    313         VarValue=reshape(VarValue,[],1);% reshape values array in a column
    314         Data(1:numel(VarValue),ivar)=num2cell(VarValue);
    315     end
    316     set(htext,'Data',Data)
    317 end
     301% if strcmp(get(htext,'Type'),'uitable')% display data in a table
     302%     VarNameCell=cell(1,numel(VarIndex));% prepare list of variable names to display (titles of columns)
     303%     VarLength=zeros(1,numel(VarIndex));  % default number of values for each variable
     304%     for ivar=1:numel(VarIndex)
     305%         VarNameCell{ivar}=FieldData.ListVarName{VarIndex(ivar)};
     306%         VarLength(ivar)=numel(FieldData.(VarNameCell{ivar}));
     307%     end
     308%     set(htext,'ColumnName',VarNameCell)
     309%     Data=cell(max(VarLength),numel(VarIndex));% prepare the table of data display
     310%    
     311%     for ivar=1:numel(VarIndex)
     312%         VarValue=FieldData.(VarNameCell{ivar});
     313%         VarValue=reshape(VarValue,[],1);% reshape values array in a column
     314%         Data(1:numel(VarValue),ivar)=num2cell(VarValue);
     315%     end
     316%     set(htext,'Data',Data)
     317% end
    318318%         if numel(VarValue)>1 && numel(VarValue)<10 % case of a variable with several values
    319319%             for ind=1:numel(VarValue)
     
    577577%% give statistics for pdf
    578578%ind_var=find(testplot);
    579 TableData={'Variable';'SampleNbr';'bin size';'Mean';'RMS';'Skewness';'Kurtosis';'    centered ';...
     579TableData={'Variable';'SampleNbr';'bin size';'Mean';'RMS';'Skewness';'Kurtosis';...
    580580    'Min';'FirstCentile';'FirstDecile';'Median';'LastDecile';'LastCentile';'Max'};
    581581
     
    587587        pdf_val=data.(data.ListVarName{CellInfo{icell}.VarIndex_histo});
    588588        x=coord_x{icell};
    589        
    590         Val=pdf2stat(x',pdf_val');
    591 
    592         Column=mat2cell(Val,ones(13,1),1);
    593         Column=[{VarName};Column(1:6);{'stat: --'};Column(7:13)];
     589        if isrow(x)
     590            x=x';
     591        end
     592        if ~isequal(size(x,1),size(pdf_val,1))
     593            pdf_val=pdf_val';
     594        end
     595        Val=pdf2stat(x,pdf_val);
     596        Column=mat2cell(Val,ones(13,1),ones(1,size(Val,2)));
     597        if size(Val,2)==1%single component
     598            TitleBar={VarName};
     599        else
     600            TitleBar=cell(1,size(Val,2));
     601            for icomp=1:size(Val,2)
     602                TitleBar{icomp}=[VarName '_' num2str(icomp)];
     603            end
     604        end
     605        Column=[TitleBar;Column];
    594606        TableData=[TableData Column];
    595607    end
  • trunk/src/series/aver_stat.m

    r872 r881  
    8888        if ismember(SeriesData.ProjObject.ProjMode,{'inside','outside'})
    8989            answer=msgbox_uvmat('INPUT_TXT','set bin size for histograms (or keep ''auto'' by default)?','auto');
    90             ParamOut.ActionInput.VarMesh=str2double(answer);
     90            ParamOut.ActionInput.VarMesh=str2num(answer);
    9191        end
    9292    end
  • trunk/src/series/civ_input.m

    r880 r881  
    332332%% list the possible index pairs, depending on the option set in ListPairMode
    333333ListPairMode_Callback([], [], handles)
    334 ListPairCiv1_Callback(hObject, eventdata, handles)
     334%ListPairCiv1_Callback(hObject, eventdata, handles)
    335335
    336336%% set the GUI to modal: wait for OK to close
     
    875875end
    876876nom_type_ima=CivInputData.NomTypeIma;
    877 initial=get(handles.ListPairCiv1,'Value');%previous choice of pair
    878 menu_pair=get(handles.ListPairCiv1,'String');%previous choice of pair.ListPairCiv1
    879 init_choice=menu_pair{initial};
     877menu_pair=get(handles.ListPairCiv1,'String');%previous menu of ListPairCiv1
     878PairCiv1Init=menu_pair{get(handles.ListPairCiv1,'Value')};%previous choice of pair
     879menu_pair=get(handles.ListPairCiv2,'String');%previous menu of ListPairCiv1
     880PairCiv2Init=menu_pair{get(handles.ListPairCiv2,'Value')};%previous choice of pair
    880881
    881882%% determine nom_type_nc, nomenclature type of the .nc files:
     
    973974
    974975%% determine the default selection in the pair menu for Civ1
    975 ichoice=find(select,1);% index of first selected pair
    976 if (isempty(ichoice) || ichoice < 1); ichoice=1; end;
    977 ichoice=find(strcmp(init_choice,displ_pair'),1);
     976%ichoice=find(select,1);% index of first selected pair
     977%if (isempty(ichoice) || ichoice < 1); ichoice=1; end;
     978ichoice=find(strcmp(PairCiv1Init,displ_pair'),1);
    978979if ~isempty(ichoice)
    979980    set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu
     
    987988%% determine the default selection in the pair menu for Civ2
    988989if strcmp(get(handles.ListPairCiv2,'Visible'),'on')
    989     initial=get(handles.ListPairCiv2,'Value');
    990     if initial>length(displ_pair')%|~isequal(select(initial),1)
    991         if ichoice <= length(displ_pair')
    992             set(handles.ListPairCiv2,'Value',ichoice);% same pair proposed by default for civ2
    993         else
    994             set(handles.ListPairCiv2,'Value',1);% same pair proposed by default for civ2
    995         end
    996     end
     990    ichoice=find(strcmp(PairCiv2Init,displ_pair'),1);
     991    if ~isempty(ichoice)
     992        set(handles.ListPairCiv2,'Value',ichoice);% first valid pair proposed by default in the menu
     993    else
     994        set(handles.ListPairCiv2,'Value',1)
     995    end
     996   
     997    %
     998    %     initial=get(handles.ListPairCiv2,'Value');
     999    %
     1000    %
     1001    %     if initial>length(displ_pair')%|~isequal(select(initial),1)
     1002    %         if ichoice <= length(displ_pair')
     1003    %             set(handles.ListPairCiv2,'Value',ichoice);% same pair proposed by default for civ2
     1004    %         else
     1005    %             set(handles.ListPairCiv2,'Value',1);% same pair proposed by default for civ2
     1006    %         end
     1007    %     end
    9971008else
    9981009    set(handles.ListPairCiv2,'Value',get(handles.ListPairCiv1,'Value'))% initiate the choice of Civ2 as a reproduction of if civ1
  • trunk/src/series/time_series.m

    r880 r881  
    471471                DataOut.([VarName 'Histo'])(index,ind_start:ind_start+MaxIndex_new-MinIndex_new)=...
    472472                    DataOut.([VarName 'Histo'])(index,ind_start:ind_start+MaxIndex_new-MinIndex_new)+Field.([VarName 'Histo']);
    473                 VarVal=pdf2stat(Field.(VarName),Field.([VarName 'Histo']));% max of the current field
     473                VarVal=pdf2stat((Field.(VarName))',(Field.([VarName 'Histo']))');% max of the current field
    474474                for istat=1:numel(VarVal)
    475475                    DataOut.([VarName StatName{istat}])(index)=VarVal(istat);
     
    506506        DataOut.Time(index,1)=time(index);%
    507507    end
    508    
     508    index
    509509    % record the number of missing input fields
    510510    if ~isempty(errormsg)
  • trunk/src/transform_field/signal_bandpass_filter.m

    r810 r881  
    2626%=======================================================================
    2727
    28 function DataOut=signal_bandpass_filter(DataIn)
     28function DataOut=signal_bandpass_filter(DataIn,Param)
     29
     30%% request input parameters
     31if isfield(DataIn,'Action') && isfield(DataIn.Action,'RUN') && isequal(DataIn.Action.RUN,0)
     32    VarNbDim=cellfun('length',DataIn.VarDimName);
     33    [tild,rank]=sort(VarNbDim,2,'descend');% sort the list of input variables, putting the ones with higher dimensionality first
     34    ListVarName=DataIn.ListVarName(rank);
     35    VarDimName=DataIn.VarDimName(rank);
     36    InitialValue=1;%default choice
     37    if isfield(Param,'TransformInput') && isfield(Param.TransformInput,'VariableName')
     38        val=find(strcmp(Param.TransformInput.VariableName,ListVarName));
     39        if ~isempty(val);
     40            InitialValue=val;
     41        end
     42    end
     43    [s,OK] = listdlg('PromptString','Select the variable to process:',...
     44        'SelectionMode','single','InitialValue',InitialValue,...
     45        'ListString',ListVarName);
     46    if OK==1
     47        VarName=ListVarName{s};
     48        DataOut.TransformInput.VariableName=VarName;
     49        dlg_title = [mfilename ' filter signal along first dim ' VarDimName{s}{1}];% title of the input dialog fig
     50        prompt = {'central filtering frequency';'bandwith (relative to the central frequency) '};% titles of the edit boxes
     51        %default input:
     52        def={'';'0.1'};% filtering frequency and relative bandwidth
     53
     54        if isfield(Param,'TransformInput')% if parameters have been memorised
     55            if isfield(Param.TransformInput,'CentralFrequency')
     56                def{1}=num2str(Param.TransformInput.CentralFrequency);
     57            end
     58            if isfield(Param.TransformInput,'BandWidth')
     59                 def{2}=num2str(Param.TransformInput.BandWidth);
     60            end
     61        end
     62        num_lines= 1;%numel(prompt);
     63        % open the dialog fig
     64        answer = inputdlg(prompt,dlg_title,num_lines,def);
     65        DataOut.TransformInput.CentralFrequency=str2num(answer{1});
     66        DataOut.TransformInput.BandWidth=str2num(answer{2});
     67    end
     68    return
     69end
     70
     71
     72
    2973%% set GUI config
    3074DataOut=[];
     
    3478end
    3579%%%%%%%%%%%%%%%%%%%%%%%%%
    36 frequency=2*5/54.5;% frequency at which the signal needs to be filetered
     80frequency=Param.TransformInput.CentralFrequency;% frequency at which the signal needs to be filetered
     81Bw=Param.TransformInput.BandWidth;
     82 DataOut=DataIn;
    3783 %d=fdesign.bandpass(0.8*frequency, 0.95*frequency, 1.05*frequency, 1.2*frequency, 60, 1, 60);
    38  d=fdesign.bandpass(0.7*frequency, 0.9*frequency, 1.1*frequency, 1.3*frequency, 60, 1, 60);
     84 d=fdesign.bandpass((1-2*Bw)*frequency, (1-Bw)*frequency, (1+Bw)*frequency, (1+2*Bw)*frequency, 60, 1, 60);
    3985 Hd=design(d);% command  fvtool(Hd) to visualize the filter frequency response
    40  DataOut=DataIn;
     86
    4187 if isfield(DataIn,'U')
    4288 DataOut.U = filter(Hd,DataIn.U);
  • trunk/src/view_field.m

    r873 r881  
    8080set(handles.PlotAxes,'UserData',AxeData)
    8181if exist('Field','var')
    82     [PlotType,PlotParamOut]= plot_field(Field,handles.PlotAxes);%,PlotParam,KeepLim,PosColorbar)
     82    [PlotType,PlotParamOut]= plot_field(Field,handles.PlotAxes);
    8383    set(handles.Axes,'Visible','on')
    8484    if isfield(PlotParamOut,'Vectors')
     
    9191    else
    9292        set(handles.Scalar,'Visible','off')
    93     end
    94    
     93    end   
    9594    errormsg=fill_GUI(PlotParamOut,hObject);
    9695    if ~isempty(errormsg)
     
    9897        return
    9998    end
    100     %write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters
    10199end
    102100
Note: See TracChangeset for help on using the changeset viewer.