Changeset 935 for trunk/src/series.m
- Timestamp:
- Mar 28, 2016, 9:15:18 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r934 r935 518 518 set(handles.InputTable,'Data',InputTable) 519 519 REFRESH_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)]) 525 563 % return 526 564 % end 527 565 % 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 538 583 % end 539 584 % end 540 % append='one';541 % set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0])542 % drawnow543 % 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 557 585 % 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') 565 591 % 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]) 616 593 617 594 % -------------------------------------------------------------------- … … 619 596 % -------------------------------------------------------------------- 620 597 set(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 device598 OutPut=browse_data(get(hObject,'Label'),'on','on');% open the GUI browse_data to get select a campaign dir, experiment and device 622 599 if ~isfield(OutPut,'Campaign') 623 600 return 624 601 end 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]) 602 NbLines=numel(OutPut.Experiment)*numel(OutPut.DataSeries); 603 icount=0; 604 InputTable=get(handles.InputTable,'Data'); 605 for 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 632 end 633 if size(InputTable,1)>icount 634 InputTable(icount+1:size(InputTable,1),:)=[]; 635 end 636 set(handles.InputTable,'Data',InputTable) 637 REFRESH_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]) 643 658 644 659 … … 1610 1625 NbCore=1;% no need to split the calculation 1611 1626 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 1621 1637 answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''}); 1622 1638 if isempty(answer) … … 1626 1642 NbCore=str2double(answer{1}); 1627 1643 extra_oar=answer{2}; 1628 end1644 % end 1629 1645 case 'cluster_pbs' 1630 1646 if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled) … … 1698 1714 DirXml=fullfile(OutputDir,'0_XML'); 1699 1715 if ~exist(DirXml,'dir') 1700 [ tild,msg1]=mkdir(DirXml);1716 [~,msg1]=mkdir(DirXml); 1701 1717 if ~strcmp(msg1,'') 1702 1718 errormsg=['cannot create ' DirXml ': ' msg1];%error message for directory creation … … 2113 2129 end 2114 2130 if exist(OutputDir,'dir') 2131 [SUCCESS,MESSAGE,MESSAGEID] = fileattrib (OutputDir) 2132 if MESSAGE.GroupWrite~=1 2115 2133 [success,msg] = fileattrib(OutputDir,'+w','g','s');% allow writing access for the group of users, recursively in the folder 2116 2134 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 2118 2137 end 2119 2138 end
Note: See TracChangeset
for help on using the changeset viewer.