Changeset 935 for trunk/src/series.m


Ignore:
Timestamp:
Mar 28, 2016, 9:15:18 PM (8 years ago)
Author:
sommeria
Message:

various improvments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r934 r935  
    518518set(handles.InputTable,'Data',InputTable)
    519519REFRESH_Callback(hObject, eventdata, handles)
    520 % DataSeries=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
    521 % fileinput=uigetfile_uvmat('pick an input file',DataSeries);
    522 % hh=dir(fileinput);
    523 % if numel(hh)>1
    524 %     msgbox_uvmat('ERROR','invalid input, probably a broken link');
     520
     521
     522% %------------------------------------------------------------------------
     523% % --- fct activated by the browser under 'Open campaign/Browse...'
     524% %------------------------------------------------------------------------
     525% function MenuBrowseCampaignAppend_Callback(hObject, eventdata, handles)
     526% append='append';
     527% browse_campaign(handles,append);
     528
     529% %------------------------------------------------------------------------
     530% function browse_campaign(handles,append);
     531%
     532% %% look for the previously opened file 'oldfile'
     533%
     534% %
     535% %
     536% % InputTable=get(handles.InputTable,'Data');
     537% % RootPath=InputTable{1,1};
     538% % CampaignPath=fileparts(fileparts(RootPath));
     539% % DirFull=uigetfile_uvmat('define this path as the Campaign folder:',CampaignPath,'uigetdir');
     540% % if ~ischar(DirFull)|| ~exist(DirFull,'dir')
     541% %     return
     542% % end
     543% OutPut=browse_data(oldfile);% open the GUI browse_data to get select a campaign dir, experiment and device
     544% if ~isfield(OutPut,'Campaign')
     545%     return
     546% end
     547% DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
     548% ListStruct=dir(DirName); %list files and the dir DataSeries
     549% % select the first appropriate file in the dir
     550% FileName='';
     551% for ilist=1:numel(ListStruct)
     552%     if ~isequal(ListStruct(ilist).isdir,1)%look for files, not dir
     553%         FileName=ListStruct(ilist).name;
     554%         FileInfo=get_file_info(fullfile(DirName,FileName));
     555%         switch FileInfo.FileType
     556%             case {'image','multimage','civx','civdata','netcdf'}
     557%                 break
     558%         end
     559%     end
     560% end
     561% if isempty(FileName)
     562%     msgbox_uvmat('ERROR',['no appropriate input file in the DataSeries folder ' fullfile(DirName)])
    525563%     return
    526564% end
    527565%
    528 %
    529 %
    530 % %% launch the browser
    531 % fileinput=uigetfile_uvmat('pick an input file in the series',oldfile);
    532 % hh=dir(fileinput);
    533 % if numel(hh)>1
    534 %     msgbox_uvmat('ERROR','invalid input, probably a broken link');
    535 % else
    536 %     if ~isempty(fileinput)
    537 %         display_file_name(handles,fileinput,'one')
     566% %% update the list of campaigns in the menubar
     567% MenuCampaign=[{get(handles.MenuCampaign_1,'Label')};{get(handles.MenuCampaign_2,'Label')};...
     568%     {get(handles.MenuCampaign_3,'Label')};{get(handles.MenuCampaign_4,'Label')};{get(handles.MenuCampaign_5,'Label')}];
     569% check_dir=isempty(find(strcmp(DirName,MenuCampaign)));
     570% if check_dir %insert the new campaign in the list if it is not found
     571%     MenuCampaign(end)=[]; %suppress the last item
     572%     MenuCampaign=[{DirName};MenuCampaign];%insert the new campaign
     573%     for ilist=1:numel(MenuCampaign)
     574%         set(handles.(['MenuCampaign_' num2str(ilist)]),'Label',MenuCampaign{ilist})
     575%     end
     576%     % save the list for future opening:
     577%     dir_perso=prefdir;
     578%     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     579%     if exist(profil_perso,'file')
     580%         save (profil_perso,'MenuCampaign','-append'); %store the file names for future opening of uvmat
     581%     else
     582%         save (profil_perso,'MenuCampaign','-V6'); %store the file names for future opening of uvmat
    538583%     end
    539584% end
    540 % append='one';
    541 % set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0])
    542 % drawnow
    543 % browse_campaign(handles,append);
    544 
    545 %------------------------------------------------------------------------
    546 % --- fct activated by the browser under 'Open campaign/Browse...'
    547 %------------------------------------------------------------------------
    548 function MenuBrowseCampaignAppend_Callback(hObject, eventdata, handles)
    549 append='append';
    550 browse_campaign(handles,append);
    551 
    552 %------------------------------------------------------------------------
    553 function browse_campaign(handles,append);
    554 
    555 %% look for the previously opened file 'oldfile'
    556 
    557585%
    558 %
    559 % InputTable=get(handles.InputTable,'Data');
    560 % RootPath=InputTable{1,1};
    561 % CampaignPath=fileparts(fileparts(RootPath));
    562 % DirFull=uigetfile_uvmat('define this path as the Campaign folder:',CampaignPath,'uigetdir');
    563 % if ~ischar(DirFull)|| ~exist(DirFull,'dir')
    564 %     return
     586% %% display the selected field and related information
     587% if get(handles.CheckAppend,'Value')
     588%     display_file_name(handles,fullfile(DirName,FileName),'append')
     589% else
     590%     display_file_name(handles,fullfile(DirName,FileName),'one')
    565591% end
    566 OutPut=browse_data(oldfile);% open the GUI browse_data to get select a campaign dir, experiment and device
    567 if ~isfield(OutPut,'Campaign')
    568     return
    569 end
    570 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
    571 ListStruct=dir(DirName); %list files and the dir DataSeries
    572 % select the first appropriate file in the dir
    573 FileName='';
    574 for ilist=1:numel(ListStruct)
    575     if ~isequal(ListStruct(ilist).isdir,1)%look for files, not dir
    576         FileName=ListStruct(ilist).name;
    577         FileInfo=get_file_info(fullfile(DirName,FileName));
    578         switch FileInfo.FileType
    579             case {'image','multimage','civx','civdata','netcdf'}
    580                 break
    581         end
    582     end
    583 end
    584 if isempty(FileName)
    585     msgbox_uvmat('ERROR',['no appropriate input file in the DataSeries folder ' fullfile(DirName)])
    586     return
    587 end
    588 
    589 %% update the list of campaigns in the menubar
    590 MenuCampaign=[{get(handles.MenuCampaign_1,'Label')};{get(handles.MenuCampaign_2,'Label')};...
    591     {get(handles.MenuCampaign_3,'Label')};{get(handles.MenuCampaign_4,'Label')};{get(handles.MenuCampaign_5,'Label')}];
    592 check_dir=isempty(find(strcmp(DirName,MenuCampaign)));
    593 if check_dir %insert the new campaign in the list if it is not found
    594     MenuCampaign(end)=[]; %suppress the last item
    595     MenuCampaign=[{DirName};MenuCampaign];%insert the new campaign
    596     for ilist=1:numel(MenuCampaign)
    597         set(handles.(['MenuCampaign_' num2str(ilist)]),'Label',MenuCampaign{ilist})
    598     end
    599     % save the list for future opening:
    600     dir_perso=prefdir;
    601     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    602     if exist(profil_perso,'file')
    603         save (profil_perso,'MenuCampaign','-append'); %store the file names for future opening of uvmat
    604     else
    605         save (profil_perso,'MenuCampaign','-V6'); %store the file names for future opening of uvmat
    606     end
    607 end
    608 
    609 %% display the selected field and related information
    610 if get(handles.CheckAppend,'Value')
    611     display_file_name(handles,fullfile(DirName,FileName),'append')
    612 else
    613     display_file_name(handles,fullfile(DirName,FileName),'one')
    614 end
    615 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
     592% set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
    616593
    617594% --------------------------------------------------------------------
     
    619596% --------------------------------------------------------------------
    620597set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0])
    621 OutPut=browse_data(get(hObject,'Label'));% open the GUI browse_data to get select a campaign dir, experiment and device
     598OutPut=browse_data(get(hObject,'Label'),'on','on');% open the GUI browse_data to get select a campaign dir, experiment and device
    622599if ~isfield(OutPut,'Campaign')
    623600    return
    624601end
    625 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
    626 hdir=dir(DirName); %list files and dirs
    627 for ilist=1:numel(hdir)
    628     if ~isequal(hdir(ilist).isdir,1)%look for files, not dir
    629         FileName=hdir(ilist).name;
    630         FileInfo=get_file_info(fullfile(DirName,FileName));
    631         switch FileInfo.FileType
    632             case {'image','multimage','civx','civdata','netcdf'}
    633             break
    634         end
    635     end
    636 end
    637 if get(handles.CheckAppend,'Value')
    638     display_file_name(handles,fullfile(DirName,FileName),'append')
    639 else
    640     display_file_name(handles,fullfile(DirName,FileName),'one')
    641 end
    642 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
     602NbLines=numel(OutPut.Experiment)*numel(OutPut.DataSeries);
     603icount=0;
     604InputTable=get(handles.InputTable,'Data');
     605for iexp=1:numel(OutPut.Experiment)
     606    for idevice=1:numel(OutPut.DataSeries)
     607        icount=icount+1;
     608        InputTable{icount,1}=fullfile(OutPut.Campaign,OutPut.Experiment{iexp});
     609        InputTable{icount,2}=OutPut.DataSeries{idevice};
     610        if isempty(InputTable{icount,3})
     611            if icount>1
     612                InputTable{icount,3}=InputTable{icount-1,3};
     613            else
     614                InputTable{icount,3}='';
     615            end
     616        end
     617        if isempty(InputTable{icount,4})
     618            if icount>1
     619                InputTable{icount,4}=InputTable{icount-1,4};
     620            else
     621                InputTable{icount,4}='';
     622            end
     623        end
     624        if isempty(InputTable{icount,5})
     625            if icount>1
     626                InputTable{icount,5}=InputTable{icount-1,5};
     627            else
     628                InputTable{icount,5}='';
     629            end
     630        end
     631    end
     632end
     633if size(InputTable,1)>icount
     634    InputTable(icount+1:size(InputTable,1),:)=[];
     635end
     636set(handles.InputTable,'Data',InputTable)
     637REFRESH_Callback(hObject, eventdata, handles)
     638
     639
     640% DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
     641% hdir=dir(DirName); %list files and dirs
     642% for ilist=1:numel(hdir)
     643%     if ~isequal(hdir(ilist).isdir,1)%look for files, not dir
     644%         FileName=hdir(ilist).name;
     645%         FileInfo=get_file_info(fullfile(DirName,FileName));
     646%         switch FileInfo.FileType
     647%             case {'image','multimage','civx','civdata','netcdf'}
     648%             break
     649%         end
     650%     end
     651% end
     652% if get(handles.CheckAppend,'Value')
     653%     display_file_name(handles,fullfile(DirName,FileName),'append')
     654% else
     655%     display_file_name(handles,fullfile(DirName,FileName),'one')
     656% end
     657% set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
    643658
    644659
     
    16101625        NbCore=1;% no need to split the calculation
    16111626    case 'cluster_oar'
    1612         if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
    1613             NbCore=1;% one core used only (limitation of Matlab licences)
    1614             answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
    1615             if ~strcmp(answer,'Yes')
    1616                 errormsg='Action launch interrupted by user';
    1617                 return
    1618             end
    1619             extra_oar='';
    1620         else
     1627        %%%%% TEST A REMETTRE%%%%%
     1628 %       if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
     1629%             NbCore=1;% one core used only (limitation of Matlab licences)
     1630%             answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
     1631%             if ~strcmp(answer,'Yes')
     1632%                 errormsg='Action launch interrupted by user';
     1633%                 return
     1634%             end
     1635%             extra_oar='';
     1636 %       else
    16211637            answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''});
    16221638            if isempty(answer)
     
    16261642            NbCore=str2double(answer{1});
    16271643            extra_oar=answer{2};
    1628         end
     1644 %       end
    16291645    case 'cluster_pbs'
    16301646        if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
     
    16981714DirXml=fullfile(OutputDir,'0_XML');
    16991715if ~exist(DirXml,'dir')
    1700     [tild,msg1]=mkdir(DirXml);
     1716    [~,msg1]=mkdir(DirXml);
    17011717    if ~strcmp(msg1,'')
    17021718        errormsg=['cannot create ' DirXml ': ' msg1];%error message for directory creation
     
    21132129end
    21142130if exist(OutputDir,'dir')
     2131    [SUCCESS,MESSAGE,MESSAGEID] = fileattrib (OutputDir)
     2132    if MESSAGE.GroupWrite~=1
    21152133    [success,msg] = fileattrib(OutputDir,'+w','g','s');% allow writing access for the group of users, recursively in the folder
    21162134    if success==0
    2117         msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg1});%error message for directory creation
     2135        msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg});%error message for directory creation
     2136    end
    21182137    end
    21192138end
Note: See TracChangeset for help on using the changeset viewer.