Changeset 1069 for trunk


Ignore:
Timestamp:
Jul 10, 2019, 12:17:42 PM (5 years ago)
Author:
sommeria
Message:

browse_data updated

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/browse_data.m

    r1068 r1069  
    9292    InputDir=pwd;% current dir is the starting data series by default
    9393end
    94 
    95 [ExpWithPath,DataSeries]=fileparts(InputDir);
    96 [Experiment,Device,Ext]=fileparts(ExpWithPath);
    97 Device=[Device Ext];
    98 [SourceDir,Experiment,Ext]=fileparts(Experiment);
    99 Experiment=[Experiment Ext];
    100 % [tild,CampaignName]=fileparts(Campaign);
    101 % RootXml=fullfile(Campaign,[CampaignName '.xml']);
     94if ischar(InputDir),InputDir={InputDir};end
     95for ilist=1:numel(InputDir)
     96    [ExpWithPath,DataSeries{ilist},Ext]=fileparts(InputDir{ilist});
     97    DataSeries{ilist}=['+/' DataSeries{ilist} Ext];
     98    [Experiment{ilist},Device{ilist},Ext]=fileparts(ExpWithPath);
     99    Device{ilist}=['+/' Device{ilist} Ext];
     100    [SourceDir{ilist},Experiment{ilist},Ext]=fileparts(Experiment{ilist});
     101    Experiment{ilist}=['+/' Experiment{ilist} Ext];
     102    if ~strcmp(SourceDir{ilist},SourceDir{1})||~strcmp(Experiment{ilist},Experiment{1})
     103        msgbox_uvmat('ERROR','replicate cannot be used with multiple root folders')
     104        return
     105    end
     106    if ~strcmp(DataSeries{ilist},DataSeries{1})
     107        set(handles.DataSeries,'enable','off')
     108    end
     109    if ~strcmp(Device{ilist},Device{1})
     110        set(handles.ListDevices,'enable','off')
     111    end
     112end
    102113s=[];
    103114% if exist(RootXml,'file')
     
    111122% end
    112123if isempty(s) %a source dir has been opened
    113     set(handles.SourceDir,'String',SourceDir);
     124    set(handles.SourceDir,'String',SourceDir{1});
    114125    set(handles.MirrorDir,'Visible','off');% no mirror dir display
    115126    set(handles.CreateMirror,'String','create_mirror')
    116127end
    117 set(handles.DataSeries,'String',{['+/' DataSeries]});
    118 set(handles.ListDevices,'String',{['+/' Device]});
    119 errormsg=scan_campaign(handles,SourceDir,['+/' Experiment]);
     128set(handles.DataSeries,'String',DataSeries);
     129set(handles.DataSeries,'Value',(1:numel(DataSeries)));
     130set(handles.ListDevices,'String',Device);
     131set(handles.ListDevices,'Value',(1:numel(Device)));
     132errormsg=scan_campaign(handles,SourceDir{1},Experiment{1});
    120133if ~isempty(errormsg)
    121134    msgbox_uvmat('ERROR',errormsg)
     
    242255Device=ListDevices(list_val);%choose selected devices
    243256end
    244 [ListFiles,indices]=list_dir_2(SourceDir,ListExperiments,Device);
     257check_fix=strcmp(get(handles.ListDevices,'enable'),'off');
     258[ListFiles,indices]=list_dir_2(SourceDir,ListExperiments,Device,check_fix);
    245259set(handles.ListDevices,'String',ListFiles)
    246260set(handles.ListDevices,'Value',indices)% initialise the menu selection with the folder defined by the input
     
    271285    DataSeries=[];
    272286end
    273 [ListFiles,indices]=list_dir_3(SourceDir,ListExperiments,ListDevices,DataSeries);
     287check_fix=strcmp(get(handles.DataSeries,'enable'),'off');
     288[ListFiles,indices]=list_dir_3(SourceDir,ListExperiments,ListDevices,DataSeries,check_fix);
    274289set(handles.DataSeries,'String',ListFiles)
    275290set(handles.DataSeries,'Value',indices)% initialise the menu selection with the folder defined by the input
     
    346361% Provide a list to display
    347362%------------------------------------------------------------------------
    348 function [ListFilesTot,indices]=list_dir_2(SourceDir,ListDir,ListSub)
     363function [ListFilesTot,indices]=list_dir_2(SourceDir,ListDir,ListSub,check_fix)
    349364ListFilesTot={};
    350365for ilist=1:numel(ListDir)
     
    358373    cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . )
    359374    check_keep=cellfun('isempty', cell_remove);
    360     ListFilesTot=[ListFilesTot;(ListFiles(check_keep))'];
     375    ListFilesTot=[ListFilesTot (ListFiles(check_keep))];
    361376    end
    362377end
     
    370385        indices=[indices index];
    371386    end
     387    if check_fix
     388        index_init=1:numel(ListFilesTot);
     389        %indices=sort(indices)
     390        index_init(indices)=[];
     391       ListFilesTot=ListFilesTot([indices index_init]);
     392       indices=1:numel(indices);
     393    end     
    372394end
    373395if isempty(indices), indices=1; end
     
    377399% Provide a list to display
    378400%------------------------------------------------------------------------
    379 function [ListFilesTot,indices]=list_dir_3(SourceDir,ListDir,ListSub,ListSubSub)
     401function [ListFilesTot,indices]=list_dir_3(SourceDir,ListDir,ListSub,ListSubSub,check_fix)
    380402ListFilesTot={};
    381403for ilist=1:numel(ListDir)
     
    392414                cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . )
    393415                check_keep=cellfun('isempty', cell_remove);
    394                 ListFilesTot=[ListFilesTot;(ListFiles(check_keep))'];
     416                ListFilesTot=[ListFilesTot (ListFiles(check_keep))];
    395417            end
    396418        end
     
    406428        indices=[indices index];
    407429    end
     430    if check_fix
     431        index_init=1:numel(ListFilesTot);
     432        index_init(indices)=[];
     433       ListFilesTot=ListFilesTot([indices index_init]);
     434       indices=1:numel(indices);
     435    end     
    408436end
    409437if isempty(indices), indices=1; end
  • trunk/src/series.m

    r1068 r1069  
    16131613    for iexp=1:numel(ListExp)
    16141614        if ~isempty(regexp(ListExp{iexp},'^\+/'))% if it is a folder
    1615             for idevice=1:numel(ListDevices)
    1616                 if ~isempty(regexp(ListDevices{idevice},'^\+/'))% if it is a folder
    1617                     for isubdir=1:numel(ListDataSeries)
    1618                         if ~isempty(regexp(ListDataSeries{isubdir},'^\+/'))% if it is a folder
    1619                             lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),...
    1620                                 regexprep(ListDevices{idevice},'^\+/',''));
    1621                             ldir= regexprep(ListDataSeries{isubdir},'^\+/','');
    1622                             if exist(fullfile(lpath,ldir),'dir')
    1623                                 NbExp=NbExp+1;
    1624                                 ListPath{NbExp}=lpath;
    1625                                 ListSubdir{NbExp}=ldir;
    1626                                 ExpIndex{NbExp}=iexp;
     1615            if strcmp(get(BrowseData.DataSeries,'enable'),'off');%case of a multiple input line for series
     1616                NbExp=NbExp+1;
     1617                ExpIndex{NbExp}=iexp;
     1618                for idevice=1:numel(ListDevices)
     1619                    lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),...
     1620                        regexprep(ListDevices{idevice},'^\+/',''));
     1621                    ldir=regexprep(ListDataSeries{idevice},'^\+/','');
     1622                    ListPath{idevice,NbExp}=lpath;
     1623                    ListSubdir{idevice,NbExp}=ldir;
     1624                end
     1625            else
     1626                for idevice=1:numel(ListDevices)
     1627                    if ~isempty(regexp(ListDevices{idevice},'^\+/'))% if it is a folder
     1628                        for isubdir=1:numel(ListDataSeries)
     1629                            if ~isempty(regexp(ListDataSeries{isubdir},'^\+/'))% if it is a folder
     1630                                lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),...
     1631                                    regexprep(ListDevices{idevice},'^\+/',''));
     1632                                ldir= regexprep(ListDataSeries{isubdir},'^\+/','');
     1633                                if exist(fullfile(lpath,ldir),'dir')
     1634                                    NbExp=NbExp+1;
     1635                                    ExpIndex{NbExp}=iexp;
     1636                                    ListPath{NbExp}=lpath;
     1637                                    ListSubdir{NbExp}=ldir;
     1638                                end
    16271639                            end
    16281640                        end
     
    16471659        end
    16481660        set(BrowseData.ListExperiments,'Value',ExpIndex{iexp})
    1649         Param.InputTable{1,1}=ListPath{iexp};
    1650         Param.InputTable{1,2}=ListSubdir{iexp};
     1661        Param.InputTable(:,1)=ListPath(:,iexp);
     1662        Param.InputTable(:,2)=ListSubdir(:,iexp);
     1663        if size(Param.InputTable,1)==1% case of single input line
    16511664        Param.OutputSubDir=ListSubdir{iexp};
     1665        end
    16521666        set(handles.InputTable,'Data',Param.InputTable)
    16531667%         set(handles.OutputSubDir,'String',ListSubdir{iexp})
     
    38303844function Replicate_Callback(hObject, eventdata, handles)
    38313845if get(handles.Replicate,'Value')
    3832 InputTable=get(handles.InputTable,'Data');
    3833 browse_data(fullfile(InputTable{1,1},InputTable{1,2}))
     3846    InputTable=get(handles.InputTable,'Data');
     3847    for ilist=1:size(InputTable,1)
     3848        InputDir{ilist}=fullfile(InputTable{ilist,1},InputTable{ilist,2});
     3849    end
     3850    browse_data(InputDir)
    38343851else
    38353852    hh=findobj(allchild(0),'Tag','browse_data');
  • trunk/src/series/time_series.m

    r1061 r1069  
    304304VarMesh=[];
    305305checkhisto=0;
    306 if isfield(Param,'ProjObject') && ismember(Param.ProjObject.ProjMode,{'inside','outside'})
     306checkline=0;
     307if isfield(Param,'ProjObject')
     308    if ismember(Param.ProjObject.ProjMode,{'inside','outside'})
    307309    checkhisto=1;
    308310    if isfield(Param,'ActionInput') && isfield(Param.ActionInput,'VarMesh')%case of histograms
     
    311313        VarMesh=[];
    312314        disp_uvmat('WARNING','automatic bin size for histograms, select time_series again to set the value',checkrun)
     315    end
     316    elseif ismember(Param.ProjObject.Type,{'line'})
     317        checkline=1;
    313318    end
    314319end
     
    401406                    DataOut.ListVarName=[DataOut.ListVarName {[VarName 'Histo']}];
    402407                    DataOut.VarDimName=[DataOut.VarDimName {{'Time',VarName}}];
    403 %                     if isfield(DataOut.VarAttribute{ivar},'Role')
    404 %                     DataOut.VarAttribute{ivar}=rmfield(DataOut.VarAttribute{ivar},'Role');
    405 %                     end
    406408                    StatName=pdf2stat;% get the names of statistical quantities to calcuilate at each time
    407409                    for istat=1:numel(StatName)
     
    430432                            eval(['DataOut=rmfield(DataOut,''' Field.ListVarName{ivar} ''');']);%remove variable
    431433                        end
    432                         if strcmp(var_role,'coord_x')||strcmp(var_role,'coord_y')||strcmp(var_role,'coord_z')||strcmp(var_role,'coord')
     434                        if strcmp(var_role,'coord_x')||strcmp(var_role,'coord_z')||strcmp(var_role,'coord')
    433435                            testsum(ivar)=1; %constant coordinates, record without time evolution
     436                        end
     437                        if strcmp(var_role,'coord_y')&& ~checkline
     438                             testsum(ivar)=1;
    434439                        end
    435440                    end
     
    567572end
    568573
    569 % %case of histograms
    570 % if checkhisto
    571 %     for ivar=1:numel(Field.ListVarName)
    572 %         VarName=Field.ListVarName{ivar};
    573 %         if isfield(Data{1},VarName)
    574 %             DataOut.ListVarName=[DataOut.ListVarName {[VarName 'Histo']}];
    575 %             DataOut.VarDimName=[DataOut.VarDimName {{'Time',VarName}}];
    576 %         end
    577 %     end
    578 % end
    579 % display nbmissing
    580574if ~isequal(nbmissing,0)
    581575    disp_uvmat('WARNING',[num2str(nbmissing) ' files skipped: missing files or bad input, see command window display'],checkrun)
Note: See TracChangeset for help on using the changeset viewer.